some syntactic changes so we can have arbitrary p, q