Added priority sort, with associated priority ID