Adding initial draft of state machine pattern.