clean up the script so it's ready to submit
handles unmatched words
remove debug