Added more checks for empty strings.