Begun adding framework for state machine