Added handling of cases where field values are empty or contains only white spaces.