Adding stopping elements to the optimisation