game.js modified

Refactored game.js