   else if room.top? and room.top.socket?
     room.top.socket.emit event, data
 
+pruneRooms = ->
+  for i in [(rooms.length - 1)..0]
+    if rooms[i]? and not (rooms[i].top? or rooms[i].bottom?)
+      rooms.splice i, 1
 
 # Setup Template Engine
 app.set 'views', __dirname + '/views'

  response.render 'home',
    "config": config
    "home": true

app.get '/:token', (request, response) ->
  token = request.params.token

            room.bottom = null
          else
            rooms.splice i, 1
      pruneRooms()

  console.log "Listening on #{config.host}:#{config.port}"
fs.readFile __dirname + '/config.json', 'utf8', start