made constraint creation more generalized, still need to do some more testing, refactoring, and commenting