Improvement to pgm