initial cleanup and refactoring for the importer overhaul