Refactor game.js.