refactor constraint