Added command line options for #22
Made function private
Refactored ensure_provisioning