refactor dgr