Refactored condition in a prettier way