Pq rule

fixes #3, fixes #12 and fixes #14