refactored HPGE some more