Some improvements

Bug fix in priority sorting
Change storage_aggregation attribute to also use priorities