pq implementation