Replaced empty string checking with a procedure