Removed duplicated code in TKStateMachine