Added implementation of PSPG
Rebase fixes.