Better flow and bug fixes on prov script