refactor the sub-app selector