Added tests checking table formatting
Refactored table formatting

This fixes a number of problems with the old implementation, which
used gsub on result to fix up formatting.
Merge pull request #71 from mpeterv/improve-table-formatting

Improve table formatting