Re-factored some nonsense, added gradients, your mom.