Write directly to the data array instead of temp buffer