the four-step optimisation algorithm.