Implemented initial replace functionality.