Call state as func

1. Add type: stateFn for state machine