Added some checks for empty strings.