 app.get '/D.css', (req, res) -> res.header('Content-Type', 'text/css').send css
 
 app.use '/', router
-server = app.listen 3000, -> console.info 'HTTP server listening on :3000'
+server = app.listen 3000, -> log 'HTTP server listening on :3000'
 
 io.listen(server).on 'connection', (socket) ->
-  console.info 'browser connected'
-  client = net.connect {host: '127.0.0.1', port: 4502}, -> console.info 'interpreter connected'
+  log 'browser connected'
+  client = net.connect {host: '127.0.0.1', port: 4502}, -> log 'interpreter connected'
 
   toInterpreter = (s) ->
-    console.info 'to interpreter: ' + JSON.stringify(s)[..1000]
+    log 'to interpreter: ' + JSON.stringify(s)[..1000]
     console.assert /[\x01-\x7f]*/.test s
     b = Buffer s.length + 8
     b.writeInt32BE b.length, 0
     b.write 'RIDE' + s, 4
     client.write b
 
-  toBrowser = (m...) -> console.info 'to browser: ' + JSON.stringify(m)[..1000]; socket.emit m...
+  toBrowser = (m...) -> log 'to browser: ' + JSON.stringify(m)[..1000]; socket.emit m...
 
   q = Buffer 0 # a buffer for data received from the server
   client.on 'data', (data) ->
     q = Buffer.concat [q, data]
     while q.length >= 4 and (n = q.readInt32BE 0) <= q.length
       m = '' + q[8...n]; q = q[n..]
-      console.info 'from interpreter: ' + JSON.stringify(m)[..1000]
+      log 'from interpreter: ' + JSON.stringify(m)[..1000]
       if !/^(?:SupportedProtocols|UsingProtocol)=1$/.test m # ignore these
         switch (/^<(\w+)>/.exec m)?[1] or ''
           when 'ReplyIdentify', 'ReplyConnect', 'ReplyNotAtInputPrompt', 'ReplyEdit', 'ReplySaveChanges' then ; # ignore

  toInterpreter '<?xml version="1.0" encoding="utf-8"?><Command><cmd>Identify</cmd><id>0</id><args><Identify><Sender><Process>RIDE.EXE</Process><Proxy>0</Proxy></Sender></Identify></args></Command>'
  toInterpreter '<?xml version="1.0" encoding="utf-8"?><Command><cmd>Connect</cmd><id>0</id><args><Connect><Token /></Connect></args></Command>'

  client.on 'end', -> console.info 'interpreter disconnected'; socket.emit 'end'
  socket.on 'disconnect', -> console.info 'browser disconnected'; client.end()

          when 'ReplyOpenWindow'    then toBrowser 'open', b64d(getTag 'name', m), b64d(getTag 'text', m), +getTag 'token', m
          when 'ReplyFocusWindow'   then toBrowser 'focus', +getTag 'win', m
          when 'ReplyCloseWindow'   then toBrowser 'close', +getTag 'win', m
          else log 'unrecognised'
    return

  onevent = socket.onevent
  socket.onevent = (packet) ->
    log 'from browser: ' + JSON.stringify(packet.data)[..1000]
    onevent.apply socket, [packet]

  socket.on 'exec', (s) ->
