Refactoring of find/replace code and recursive resolution added