partially implements PGM saving system.