added recognizing and ignoring spaces characters and non word characters