Issue #407: Refactor condition into separate method for better readability