These issues are just a consequence of the bigger problem that I mentioned that should be addressed first and foremost:
The simplest would be an enum based State Machine.
Try to first understand what State Machines are, this link from @tibaverus explains it really well, see if you can draw inspiration from it for your own implementation: