merge steve's performance tweaks