Added debug code to template