added replace funtion