Improve code structure and boolean game control