Enhanced the state machine to check for conditional transitions

The very last step is to actually use the conditional nature of each
transition to make sure they are allowed at the given moment of the
event firing.