refactored game implementation