Added function to confirm the string is a valid input