The following lines regarding priority seems to be from one of the rebases, these changes undo some other changes I made before, check this against the current master and remove the changes from line 739 to 800.