Less lines in function

The internal function replace/1 was supposed to show that is is
possible to write a large function with one line of code. But it did not.
Replaced with a much smaller version that does not need to be built by code.