Moved main JS

Moved main Javascript for the game into a separate file.