working with a real priority queue now instead of linked list