wrap state machine setup in class method