Added replace logic.