Fleshing out functions in state machine