refactored game