A few minor optimization tweaks