Move to a more functional style for constraints.

Replaces multiple return with `if` branches and removes expressions of the form `if (<bool>) { return <bool> }` in favor of just calculating the right Boolean value to begin with.