added replace functionality