Fixes #13 Support missing grouped data

When data is supposed to be grouped according to the template but
is missing from the input data, the results were not being returned
correctly. This commit fixes that problem by checking to see if
the data is not there already and properly handling that case.