Refactoring fsm decorator