Various minor performance tweaks