Improvements to calculation speed