Refactoring the conditions