Refactoring contstrain method