Moved constraint generation into a separate trait.