Added check for empty names