Fixes test replaceFiresUpdatedEvent and some refactorings

Closes #3536

- Also includes refactoring of replace method and operation.