refactored game class