Optimizing write process