Just some queue sorting stuff.