refactored end game