code to get PQ