Fixed lattice_complex() and lattice()
Minor adjustments for debugging
Remove some debug code
Gradient calculation (without adaptive recursion yet)