Working through derivative of vi
Fix for scaling in dv
optimisations and fix for parallel case
Fix for new numpy