cleaned up nonlinear constraint so doesn't need indices