Cleanup and bugfix of dft module