Moved game code to app.js and including collision detection.