Priority queue finished. TODO: update priority.