Simplified the replacing method.