adding logic for substrings and matching