Added game logic with JS object.