improvement on game.js