run() and process() produce two output arguments

There are also other minor updates and bug fixes in this commit.