Made dg not a shared pointer