start refactor project as state machine