PLD: refactor group dict building