A tiny state machine mixin.