Some optimisation and temp benchmarking code.