Introduce a FinalResult, move outputFiles to it.

Also update JSON accordingly.

This could probably use some more unit tests around the IO stuff
(making sure we handle base64 in and out correctly).