Refactor the importer to be more self contained.