Added magnitude scaling factor, and ordered operations on pga correctly