Added error checking for punctuation