pgenerator functions