Remove unused function
Function for draining the priority queue
Implement simple serialization loop with correct priorities