Basic game logic using gamestates; Renamed some functions and put all states into separate source files