added optimization of NLL wrt X.