read through and understood DG's code in full, modified whitespace and formatting to match GalSim style
(#524)