Refactor internal strucutre of drg