Fixed broken tests.
Made test harness more robust and heaps faster.