do refactoring about the logic of launch and init subapps