Working into the fmincgNn port