added conditional pg