refactor sub-app selector 2