   startFindServer lobby._id
 
 finalizeInstance = (serv, lobby, instance)->
-  lobbies.update {_id: lobby._id}, {$set: {status: 3, serverIP: serv.ip+":"+instance.port}}
+  lobbies.update {_id: lobby._id}, {$set: {status: 3, serverIP: serv.ip+":"+instance.port, instance: instance.id}}
   pendingInstances.remove {id: instance.id}
+  activeInstances.insert instance
 
 queueProc = ->
   #Find elegible servers

#versions looks:like rota=0.1,lobby=0.5
getAddonInstalls = (versions)->
  toinst = []
  currAddons = {}
  for ver in versions
    p = ver.split '='
    currAddons[p[0]] = p[1]
  console.log currAddons
  #check against server versions
  for addon in ServerAddons.find().fetch()
    curr = currAddons[addon.name]
    if !curr? || curr isnt addon.version
      toinst.push(addon.name+"="+addon.version+"="+getBundleDownloadURL(addon.bundle).split('=').join('+'))
  toinst.join ','

configureServer = (serverObj, lobby, instance)->
  console.log "configuring server "+instance.ip+":"+instance.port+" rcon pass "+instance.rconPass

    srvr.send "map "+lobby.mod+";"
    console.log "server configured"
    new Fiber(->
      finalizeInstance(serverObj, lobby, instance)
    ).run()
  ).on('end', ->
    console.log "rcon disconnected for "+instance.id
