Updated the grouping templates

Updated the grouping templates to not use the current context "ctx" to
set the grouping object.