First pass at test case for inter-app dependencies on import.
Refactoring code to localize context to places where its needed.