(maint) Clean up table header code

Prior to this commit, my table generation code was messy and used a
count variable that wasn't needed. This commit changes that by moving
the header generation outside of the two loops, grabs the first
key,value map's keys, and generates the header before going onto the
parsing for the table data.