refactoring menu and game