memory overhaul: rewrote a number of functions to use pointers instead
of stack memory, which was somewhat introduced when I had to make
default constructors for cxxtests. Runs in much less time. Used
xcode-instruments to investigate memory issues.