moved main func out. minor changes on importer