fixed control flow adding correct derivatives. FFTs are now the main problem, will attempt pyfftw to reduce time and optimize.