Used String#empty?, NilClass#nil? to check for empty string and nil objects