Implemented routines for generating tables.  Fixed variable names to be more consistent.