FindAndReplace exercises, some refactoring