HPGe refactoring

More of the same, collapsing cut & paste into loops.