Constraints refactoring and more tests
cleaning