Misc performance improvements