     request.then successHandler, failureHandler
 
   successHandler = (response) ->
-    response.data
+    return response.data
 
   failureHandler = (response) ->
     console.error 'error getting the os list'
     return
 
-  {
+  return {
     getList: getList
     post: post
     put: put
     delete: deletea
   }
+
+#------------------------------------------------------------------------------#
+#--------------------------- Socket.io Factory --------------------------------#
+#------------------------------------------------------------------------------#
+
 app.factory 'socket', ->
   url = location.origin + '/vm'
   socket = io.connect(url)
-  socket
+  return socket
+
+#------------------------------------------------------------------------------#
+#--------------------------- Homepage controller ------------------------------#
+#------------------------------------------------------------------------------#
+
 app.controller 'HomeController', ($scope, $mdSidenav, os, socket, $rootScope, $mdDialog, $mdToast) ->
 
+  # TODO: timer directive
   timerToString = (timer) ->
     minutes = '' + Math.floor(timer / 60)
     seconds = '' + timer % 60

    $scope.$apply()
    return
  return

# ---
# generated by js2coffee 2.1.0

    return

  $scope.addOs = (newOs) ->
    os.post(newOs)
    $scope.osList.push newOs
    return

  $scope.modifyOs = (modOs) ->
    os.put(modOs)
    return

  $scope.deleteOs = (delOs) ->
    os.delete(delOs)
    $scope.osList.splice $scope.osList.indexOf(delOs), 1
    return

  $scope.noSessionsRunning = ->
    return $scope.clients.length == 0

  socket.on 'available-sessions', (data) ->
    $scope.sessions = data.sessions
