Starting to unload functions into states

This will help section off parts of the game, making it easier to edit
code and debug issues.