Various refactoring and enable app activation.