add before and after state setting handlers and transition methods to state machine