code for generating provenance