Conditional transitions

This set of commits allows state transitions to be conditional on factors outside of the state machine.

Fixes #12