refactor server game