Tableformatter2

Rebased and improved code