Updated statemachine with new protection function calls