Added functions `G` and `DG` and made the code more usuable