refactored code and added test case for testing import organization