Grad step optimization

removing redundant computations to improve performance