Moved game logic into its own script file.