Refacture and add tests for import module