Supply derivative
More refactoring for #71
Clean up
Refactoring for #71