Rearranged tree analysis so no for each category/flag there is a specific selection