Added modifications to support substring search