Replaced the x^2, optimisation