More work on profiling / optimisation
Misc fixes, mostly issues found via profiling, or tuning profiler