Reinstate join to priority table

And do proper sorting based on the urgency column