pgm 10.7 - build dynamic output buffer as per King's hints