Stop overwriting params

Because params is global, modifying it in place clobbers it for
everything else using it on the page. We should use a local copy instead.