Fixed tests
Removed duplicated code in TKStateMachine