rearranged some code to try to move things into the game states