refactoring endgames