Code for workign with the Next Gen API