refactor export/import (decrease complexity)