Added constraint checking