Refactor for better Synapse/Provenance integration.