Don't mutate the input file.

Return a changed copy of input file instead of mutating the input file itself. Fixes #62