Make a new $environment for every replace call.
Use the cache.