added code for string matching function