Implemented qp/2, qp/3

Needs tests.