Finish get archive code, small main program refactoring