refactor game structure