refactor store_file