End of game + refactoring