     return keys
 
 
-.factory 'games', ($http, $q, $location, loggedUser, currentGame, gameConverter, gameHistory, gameTime, undo) ->
+.factory 'games', ($http, $q, $location, loggedUser, currentGame, gameConverter, gameHistory, gameTime, undo, overlay) ->
 
   saveInfo = ->
     $http.post('/games', currentGame.info)

      currentGame.version = gameConverter.convertGameVersionFromEmbeddedJson(version.data[0])
      currentGame.updateLocalVersion()
      currentGame.creator = creator.data.username
    onError = (error) -> console.log("Error loading game", error) # TODO: notify the user of the error
    $q.all([getVersion, getCreator]).then(updateCurrentGame, onError)

  loadFromId: (gameId) ->
    $http.get("/games/#{gameId}")

  load: (game) ->
    # Clear the current game data
    # TODO: have each service detect this event rather than hard coding it here?
    overlay.makeNotification()
    currentGame.reset()
    gameHistory.reset()
    gameTime.reset()
    undo.reset()
