Add replace method, initially aimed at testing.