Added a check for empty name