Refactor Set#flatten_merge

Make not to do unnecessary recursive search.