Priority queue working