Sort by type & optional libs.