First pass clean up from merge. Changes from this branch were manually patched into inmem-per-run-db branch.