Refactored the usage of constraints a bit.