refactor export and import flow