         #console.log requestObject
         switch requestObject.msg
           when 'feedback'
-            @processFeedback(requestObject)
+            content = @processFeedback(requestObject)
           when 'impression'
-            @processImpression(requestObject)
+            content = @processImpression(requestObject)
           when 'error'
-            @processError(requestObject)
+            content = @processError(requestObject)
           else
-            console.log 'lol?'
-        @respond response, 200, 'text/plain', 'Hi'
+            content = @processUnknown(requestObject)
+        @respond response, content
 
 
   @processFeedback: (requestObject) ->


  @makeRecommendation: (requestObject) ->
    console.log "Let's recommend something"

  @processError: (requestObject) ->
    console.log 'Just received an error'

  # helper function that responds to the client
  @respond: (res, code, contentType, data) ->
      res.writeHead code,
          'Content-Type': contentType
          'Content-Length': data.length
      res.write data
      res.end()

  @start: ->


  @processImpression: (requestObject) ->
    @saveItem(requestObject.item) if requestObject.item.recommendable
    recommendations = @makeRecommendation(requestObject) if requestObject.config.recommend
    content = 
      code: 200
      data: recommendations
      
  @saveItem: (item) ->
    console.log 'Save the item. Recommendable items now are:'
    @recommendables.add item
