Update game.js

Code refactoring.