moving game code to index.js