       cb err, session._id
 
 retrieveAllOpponentSessionIDs = (sessionID, cb) ->
-  query = LevelSession.findOne({'_id': sessionID})
-  .select('matches.opponents.sessionID matches.date submitDate')
-  .lean()
+  query = LevelSession.findOne({_id: sessionID})
+    .select('matches.opponents.sessionID matches.date submitDate')
+    .lean()
   query.exec (err, session) ->
     if err? then return cb err, null
     opponentSessionIDs = (match.opponents[0].sessionID for match in session.matches when match.date > session.submitDate)

    callback 'The response to that query is required to be a JSON object.'
  else
    @clientResponseObject = responseObject

    #log.info 'Verified client response!'
    callback null, responseObject

fetchTaskLog = (responseObject, callback) ->
  query = TaskLog.findOne _id: responseObject.taskID
  query.exec (err, taskLog) =>
    return callback new Error("Couldn't find TaskLog for _id #{responseObject.taskID}!") unless taskLog
    @taskLog = taskLog
    #log.info 'Fetched task log!'
    callback err, taskLog.toObject()

checkTaskLog = (taskLog, callback) ->
  if taskLog.calculationTimeMS then return callback 'That computational task has already been performed'
  if hasTaskTimedOut taskLog.sentDate then return callback 'The task has timed out'
  #log.info 'Checked task log'
  callback null

deleteQueueMessage = (callback) ->
  scoringTaskQueue.deleteMessage @clientResponseObject.receiptHandle, (err) ->
    #log.info 'Deleted queue message'
    callback err

fetchLevelSession = (callback) ->
  findParameters =
    _id: @clientResponseObject.originalSessionID

  query = LevelSession
  .findOne(findParameters)
  .lean()
  query.exec (err, session) =>
    @levelSession = session
    #log.info 'Fetched level session'
    callback err

checkSubmissionDate = (callback) ->

  currentMatchObject.codeLanguage = matchObject.opponents[opponentsArray[0].sessionID].codeLanguage
  #currentMatchObject.simulator = @clientResponseObject.simulator  # Uncomment when actively debugging simulation mismatches
  #currentMatchObject.randomSeed = parseInt(@clientResponseObject.randomSeed or 0, 10)  # Uncomment when actively debugging simulation mismatches
  sessionUpdateObject = @levelSessionUpdates[sessionID]
  sessionUpdateObject.$push.matches = {$each: [currentMatchObject], $slice: -200}
  #log.info "Update is #{JSON.stringify(sessionUpdateObject, null, 2)}"
  LevelSession.update {_id: sessionID}, sessionUpdateObject, callback

updateUserSimulationCounts = (reqUserID, callback) ->
  incrementUserSimulationCount reqUserID, 'simulatedBy', (err) =>
