Add versions of CFG functions working on a typeclassed environment