Abstract building up the tables with counts