Updated for self-refferential constraints