refactored code to separate meta import logic into smaller chuncks so it can be tested and errors irradicated.