Storing improved, analyze_folder function