some refactoring and one new importent testcase for the optimized constraint stuff