adding functional endMinimizer function