Improvements for empty strings logic