Separate methods into their own functions

On the server side we used to have one `game.js` on server. Now it's getting bigger.
Such growth makes it harder to add new features in the future. It also makes it difficult to test.

I break them apart so that we keep the velocity of development.