Add flattenContext