cleaned up the gradient descent code a lot - lots of design changes, but somehow grad descent seems to run a bit slow... will revert and re-run to benchmakr