refactoring for image importer