 
     # Create the mongoose model.
     mongoose.model 'Camera', Camera
-    CameraModel = mongoose.model 'Camera'
+    app.CameraModel = mongoose.model 'Camera'
+    # app.CameraModel = CameraModel
 
     # Connect to mongodb.
     mongoose.connect 'mongodb://localhost/cams'
 
     # Count those cameras!
-    CameraModel.count {}, (err, @count) =>
+    app.CameraModel.count {}, (err, @count) =>
         # mongoose.disconnect()
         render 'default'
 
 # Socket.io connections
 at connection: ->
-    send 'welcome', text: 'Hello!'
+    send 'message', text: 'Hello!'
 
 # Default client-side code to include.
 client ->

# Very simple error handling.
msg error: -> send 'error', @message

msg currentPosition: ->
    send 'currentPosition', position: @position

# Default view
view ->

        socket.on 'message', (raw) ->
            msg = JSON.parse raw
            console.log msg
            if msg.message
                $('div[data-role="content"]')
                    .append $('<p>').text "#{msg.message.text}"
            if msg.currentPosition
                $('div[data-role="content"]')
                    .append $('<p>').text """It looks like you're at
(#{msg.currentPosition.position.coords.latitude}, #{msg.currentPosition.position.coords.longitude}), give or take #{msg.currentPosition.position.coords.accuracy} feet and that there's at least #{msg.currentPosition.cameras.length} cameras nearby."""
                list = $('<ol>')
                for camera in msg.currentPosition.cameras
                    list.append $('<li>')
                        .append($('<h3>').text camera.name)
                        .append($('<img>').attr 'src', camera.url)
                $('div[data-role="content"]').append list

        socket.connect()

