diff --git a/files.html b/files.html
index 56c23756a108e90063cb8218d761c6051ccff34a..34e6f7a2ec874581abd676e29dceccbbb1307de9 100644
--- a/files.html
+++ b/files.html
@@ -97,9 +97,9 @@
 <i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;socket</i><br>
 <i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;server</i><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./modules/socket/server/command'>command</a><br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./modules/socket/server/device'>device</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./modules/socket/server/echo'>echo</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./modules/socket/server/print'>print</a><br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./modules/socket/server/printer'>printer</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./modules/socket/server/serial'>serial</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./modules/socket/server/udp'>udp</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./modules/socket/websocket'>websocket</a><br>
diff --git a/js/printserver.js b/js/printserver.js
index d8a353cfc0f3d4983fb2cde11ce7d4b3ef4cd0e1..4391f6941cb238356097cff67af09d79b7301bba 100644
--- a/js/printserver.js
+++ b/js/printserver.js
@@ -35,7 +35,6 @@ console.log("listening for connection from client address "+client_address+" on
 // requires
 //
 var printer = require("printer")
-//var util = require('util')
 var WebSocketServer = require('ws').Server
 //
 // start WebSocket server
@@ -62,6 +61,7 @@ wss.on('connection',function(ws) {
    var cancel
    var pagesPrinted
    ws.on("message",function(msg) {
+      console.log(msg)
       //
       // cancel job
       //
@@ -72,70 +72,68 @@ wss.on('connection',function(ws) {
       // start job
       //
       else {
-         pagesPrinted = 0
-         var printerName = printer.getDefaultPrinterName()
+         //pagesPrinted = 0
+         //var printerName = printer.getDefaultPrinterName()
          var job = JSON.parse(msg)
-         console.log('writing ' + job.name + ' (length ' + job.contents.length + ') to printer ' + printerName)
-         console.log(job.contents)
+         console.log('writing '+job.name+' (length '+job.contents.length+') to printer '+job.printer)
          cancel = false
          print()
          //
          // print all
          //
          function print() {
-            printer.printDirect({data:job.contents
-	            //, printer:'Roland GS-24' // printer name, if missing then will print to default printer
-                //, printer: job.device
-	            , type: 'RAW' // type: RAW, TEXT, PDF, JPEG, .. depends on platform
-	            , success: function (jobID) {
-	                console.log("sent to printer with ID: " + jobID)
-	                check_process()
-	                //
-	                // Check process
-	                //
-	                function check_process() {
-	                    var jobInfo
-		                try {
-		                    jobInfo = printer.getJob(printerName, jobID)
-		                } catch (err) {
-		                    ws.send('done')
-		                    return
-		                }
+            printer.printDirect({data:job.contents,type:'RAW',
+             printer:job.printer,success: function (jobID) {
+               console.log("sent to printer with ID: "+jobID)
+               check_process()
+               //
+               // Check process
+               //
+               function check_process() {
+                  var jobInfo
+                  try {
+                     jobInfo = printer.getJob(job.printer,jobID)
+                     }
+                  catch (err) {
+                     ws.send('done')
+                     return
+                     }
+                  console.log("current job info:"+
+                     JSON.stringify(jobInfo))
+                  if (jobInfo.status.indexOf('PRINTED') !== -1) {
 
-		                pagesPrinted = jobInfo.pagesPrinted
-		                console.log("current job info:" + util.inspect(jobInfo, { depth: 10, colors: true }))
-		                if (jobInfo.status.indexOf('PRINTED') !== -1) {
-		                    ws.send('done')
-		                    return
-		                }
+                     var ret = printer.setJob(job.printer,
+                        jobID,'CANCEL')
 
-		                //
-		                // cancel
-		                //
-		                if (cancel) {
-		                    console.log('cancelling...')
-		                    ws.send('cancel')
-		                    var is_ok = printer.setJob(printerName, jobID, 'CANCEL')
-		                    console.log("cancelled: " + is_ok)
-		                }
-		                    //
-		                    // continue
-		                    //
-		                else {
-		                    ws.send(jobInfo.status[0])
-		                    setTimeout(check_process, 1000)
-		                }
-		            }
-	            }
-	            , error:function(err){
-                    console.log(err)
-                    ws.send('error '+err+' 0 '+ 0)
+                     ws.send('done')
+                     return
+                     }
+                  //
+                  // cancel
+                  //
+                  if (cancel) {
+                     console.log('cancelling...')
+                     ws.send('cancel')
+                     var ret = printer.setJob(job.printer,
+                        jobID,'CANCEL')
+                     console.log("cancelled: "+ret)
+                     }
+                  //
+                  // continue
+                  //
+                  else {
+                     ws.send(jobInfo.status[0])
+                     setTimeout(check_process,1000)
+                     }
                   }
-            })
-
+               }, error: function(err) {
+                  console.log(err)
+                  ws.send('error '+err)
+                  }
+               })
+            }
          }
-       }
-    })
+      })
    //
    // close
    //
diff --git a/modules/index.html b/modules/index.html
index dda199f0d4c4fcd8c0b77365857183675ce6fbc7..ee52361631ddfdb0347efe2b57b20259294d39b9 100644
--- a/modules/index.html
+++ b/modules/index.html
@@ -72,9 +72,9 @@
 <i>socket</i><br>
 <i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;server</i><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:handler('modules/socket/server/command')">command</a><br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:handler('modules/socket/server/device')">device</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:handler('modules/socket/server/echo')">echo</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:handler('modules/socket/server/print')">print</a><br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:handler('modules/socket/server/printer')">printer</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:handler('modules/socket/server/serial')">serial</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:handler('modules/socket/server/udp')">udp</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:handler('modules/socket/websocket')">websocket</a><br>
diff --git a/modules/socket/server/printer b/modules/socket/server/device
similarity index 84%
rename from modules/socket/server/printer
rename to modules/socket/server/device
index 70b4d0f19e5a1f2a9d2c56a4f27e293d403b8327..3c16cbd196fe41cc613b66e67514759d6cced6cf 100644
--- a/modules/socket/server/printer
+++ b/modules/socket/server/device
@@ -1,8 +1,8 @@
 //
-// printer server module
+// devie server module
 //
 // Neil Gershenfeld 
-// (c) Massachusetts Institute of Technology 2017
+// (c) Massachusetts Institute of Technology 2016
 // 
 // This work may be reproduced, modified, distributed, performed, and 
 // displayed for any purpose, but must acknowledge the mods
@@ -20,14 +20,14 @@ var mod = {}
 //
 // name
 //
-var name = 'WebSocket printer'
+var name = 'WebSocket device'
 //
 // initialization
 //
 var init = function() {
    mod.address.value = '127.0.0.1'
    mod.port.value = 1234
-   mod.printer.value = 'laser'
+   mod.device.value = 'usb/lp0'
    mod.socket = null
    socket_open()
    }
@@ -37,9 +37,15 @@ var init = function() {
 var inputs = {
    file:{type:'',
       event:function(evt){
-         if (evt.detail.type == 'file') {
+         if (evt.detail.type == 'command') {
+            mod.command = evt.detail
+            mod.command.device = mod.device.value
+            mod.command.type = 'print'
+            socket_send(JSON.stringify(mod.command))
+            }
+         else if (evt.detail.type == 'file') {
             mod.job = evt.detail
-            mod.label.nodeValue = 'send file to printer'
+            mod.label.nodeValue = 'send file to device'
             mod.labelspan.style.fontWeight = 'bold'
             }
          }}}
@@ -57,8 +63,8 @@ var interface = function(div){
    // server
    //
    var a = document.createElement('a')
-      a.href = './js/printserver.js'
-      a.innerHTML = 'printerserver:'
+      a.href = './js/deviceserver.js'
+      a.innerHTML = 'deviceserver:'
       a.target = '_blank'
    div.appendChild(a)
    div.appendChild(document.createElement('br'))
@@ -102,15 +108,16 @@ var interface = function(div){
       div.appendChild(btn)
    div.appendChild(document.createElement('br'))
    //
-   // printer
+   // device
    //
-   div.appendChild(document.createTextNode('printer:'))
+   div.appendChild(document.createTextNode('device:'))
    div.appendChild(document.createElement('br'))
+   div.appendChild(document.createTextNode('/dev/'))
    var input = document.createElement('input')
       input.type = 'text'
       input.size = 10
       div.appendChild(input)
-      mod.printer = input
+      mod.device = input
    div.appendChild(document.createElement('br'))   
    var btn = document.createElement('button')
       btn.style.padding = mods.ui.padding
@@ -125,8 +132,9 @@ var interface = function(div){
          if (mod.socket == null) {
             mod.status.value = "can't send, not open"
             }
-         else if (mod.label.nodeValue == 'send file to printer') {
-            mod.job.printer = mod.printer.value
+         else if (mod.label.nodeValue == 'send file to device') {
+            mod.job.device = mod.device.value
+            mod.job.type = 'print'
             socket_send(JSON.stringify(mod.job))
             mod.label.nodeValue = 'cancel'
             }
diff --git a/modules/socket/server/print b/modules/socket/server/print
index 818110f1c4fe8977bb68554ce5557581d4bb33c7..8ba5b3c8972c910f33bb1b774b0f0902f8d96f1e 100644
--- a/modules/socket/server/print
+++ b/modules/socket/server/print
@@ -2,7 +2,7 @@
 // print server module
 //
 // Neil Gershenfeld 
-// (c) Massachusetts Institute of Technology 2016
+// (c) Massachusetts Institute of Technology 2017
 // 
 // This work may be reproduced, modified, distributed, performed, and 
 // displayed for any purpose, but must acknowledge the mods
@@ -27,7 +27,7 @@ var name = 'WebSocket print'
 var init = function() {
    mod.address.value = '127.0.0.1'
    mod.port.value = 1234
-   mod.device.value = 'usb/lp0'
+   mod.printer.value = 'laser'
    mod.socket = null
    socket_open()
    }
@@ -37,17 +37,16 @@ var init = function() {
 var inputs = {
    file:{type:'',
       event:function(evt){
-         if (evt.detail.type == 'command') {
-            mod.command = evt.detail
-            mod.command.device = mod.device.value
-            mod.command.type = 'print'
-            socket_send(JSON.stringify(mod.command))
-            }
-         else if (evt.detail.type == 'file') {
+         if (evt.detail.type == 'file') {
             mod.job = evt.detail
             mod.label.nodeValue = 'send file to printer'
             mod.labelspan.style.fontWeight = 'bold'
             }
+         else if (evt.detail.type == 'command') {
+            mod.job = evt.detail
+            mod.job.printer = mod.printer.value
+            socket_send(JSON.stringify(mod.job))
+            }
          }}}
 //
 // outputs
@@ -110,14 +109,13 @@ var interface = function(div){
    //
    // printer
    //
-   div.appendChild(document.createTextNode('printer device:'))
+   div.appendChild(document.createTextNode('printer:'))
    div.appendChild(document.createElement('br'))
-   div.appendChild(document.createTextNode('/dev/'))
    var input = document.createElement('input')
       input.type = 'text'
       input.size = 10
       div.appendChild(input)
-      mod.device = input
+      mod.printer = input
    div.appendChild(document.createElement('br'))   
    var btn = document.createElement('button')
       btn.style.padding = mods.ui.padding
@@ -133,8 +131,7 @@ var interface = function(div){
             mod.status.value = "can't send, not open"
             }
          else if (mod.label.nodeValue == 'send file to printer') {
-            mod.job.device = mod.device.value
-            mod.job.type = 'print'
+            mod.job.printer = mod.printer.value
             socket_send(JSON.stringify(mod.job))
             mod.label.nodeValue = 'cancel'
             }