Refactored code responsible for importing