For output, changed output from a reference to a copy.