adding FSM for initialize and write