refactor file storage