Add 2 function for state machine