Optimize writing stage