Change replace logic.