Moved non-empty condition to top