Factor the optimization strategy together.