Updated to support more substrings