Moved function and event initialization to the ExtensionManager.