[WIP] Refactoring import code