add state machine with silly example code