Optimised some maths