Some refactoring for AppIntegration.jsm