add before and after state setting handlers and transition methods to state machine
removed unnecessary imports
Merge pull request #1 from mashkovmax/master

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