good maths optimisation done in this.