refactor of game connection