moved all printing to tables, and restructed a bit.