Misc perf improvements