adding FSM for writes processing