added a string validation function