Added several state machine functions