Added more general optimisation method.