Wrote constraints function.