refactored the whole state machine, again, so it's more readable

Cleaned up the comment section