more bugfixes
gradient computation complete. expanded tests. solves #8
improved memory footprint