Updated sorting function to prioritize sub-analysis before analysis.