Some refactoring to remove usage of global variables, and make use of a Game class/object