Fix priorities.

 * Add a priority datastructure.
 * Reorder priorities in an order that makes sense.