Refactoring, add Constrain function

Fixes #33
Fixes #32