completed app refactoring to enable support for multi sub-applications