Added new benchmarking code. Fixed bugs.