moved `Constraints` to top
added tests