added repo switching function and updated saving function