simplify new replace implementation.