Add generic Do function to the fsm