Redid the table generation
Bug fix and minor output format optimization