free search string fix + refactor