Generic PG Implementation

Changes required to be able to have more than one PG implementation.