Minor performance tweaks to calculation engine