analytic gradient now WORKING!