prepare for gradients