Refactor gamestate