refactor priority queue API and its impl