       # it. Therefore, we end recording at the beginning and begin recording
       # right away.
       serial_state = snapshot.val()
-      window.serial_state = serial_state
       # console.log(serial_state)
       # LED status indicator
       flashLED()
       updateModel(serial_state)
 
-connectToServer()
-window.ledTimeoutId = null;
-flashLED = () ->
-  # Cancel the previous timeout.
-  window.clearTimeout(window.ledTimeoutId)
-  $('#led').show()
-  # If we don't get more data soon, hide the LED.
-  window.ledTimeoutId = setTimeout(()->
-    $('#led').hide()
-  , 200) # TODO: Make this a function of the update frequency. TODO: Have the server tell the client the update frequency.
-
-# TODO: make this a function
-# # http://threejs.org/docs/#Reference/Extras.Geometries/CylinderGeometry
-# rayx = new THREE.Mesh(new THREE.CylinderGeometry(.01, .01, .1, 24, 1, false),
-#  new THREE.MeshNormalMaterial())
-# c.scene.add(rayx)
+# Closure for LED Timeout
+do ->
+  ledTimeoutId = null;
+  LIVE.flashLED = () ->
+    # Cancel the previous timeout.
+    window.clearTimeout(ledTimeoutId)
+    $('#led').show()
+    # If we don't get more data soon, hide the LED.
+    ledTimeoutId = setTimeout( ()->
+      $('#led').hide()
+    , 200) # TODO: Make this a function of the update frequency. TODO: Have the server tell the client the update frequency.
+
+# A class to display FT sensors in the GUI
 class FT_Sensor
   constructor: (@name) ->
     # TODO: Use cylinder to make it thicker?

    # Deprecated for now by server-side timeouts watching state.time.
    # Might still be needed to reestablish client connections at some point?
    # $('#fix-button').on 'click', () ->
    #   connectToServer()
    #   console.log('Resetting hubo-ach...')
    #   socket.emit('reset-ach',{jawn: true})

    $(document).on 'webkitfullscreenchange', () ->
      setTimeout(adaptCanvasSize, 500)

    # Update the rendering to reflect any changes to Hubo.
    c.render()
  , progress = (step, total, node) ->
    $("#load").html "Loading " + step + "/" + total
  )

    socket.on 'reconnect', () -> console.log('reconnect')
    socket.on 'reconnecting', () -> console.log('reconnecting')
    socket.on 'reconnect_failed', () -> console.log('reconnect_failed')
  else
    #
    # Init Firebase
    #
    serial_stateRef = new Firebase('http://hubo-firebase.firebaseIO.com/serial_state')
    # Create the Firebase update
    serial_stateRef.on 'value', (snapshot) ->
      # NOTE: With the stats library, we are timing the interval
