Use std::borrow::Cow instead of temporary parameter hack.