updated to make StateHandler class better. However - currently unstable with 3 state unlock.