Removed lambda expression in getSubstrings