Do delta and gradient calculation in same method

Results in a longer method, but good to see how these pieces fit together
move methods around
Enable marshal dump and load