       if chans[chan].length is 0
         delete chans[chan]
 
-# Create our server an export it, just for fun
-module.exports = new ChatServer()
-
-
+# Export the ChatServer class
+exports.ChatServer = ChatServer
+
+# Create our server instance
+chat_server = new ChatServer()
+
+# Create the server and connection callback
+server = net.createServer chat_server.connect
+
+# Make the server listen on the specified host and port
+host = config.get 'server.host'
+port = config.get 'server.port'
+server.listen port, host, ->
+  log.info "Listening on #{host}:#{port}"
+
+

    return unless chans[channel]?
    chans[channel] = _.without chans[channel], name
    @emit 'channel', channel, "user has left chat: #{name}"

  ###
  Handler for a channel message

      channels: {}
      users: []

  connect: (socket) =>
    log.info "New connection from #{socket.remoteAddress}"

