Minor improvements to gradient_descent_hack