Major reimplementation of table_data construction

Replaced very complex table data creation logic with much more intuitive
object-orientated approach
Fixed serious bug when appling unmatched tag column tags
all_selected checkboxes now work for all columns in all situations
Steps towards PEP8 compliance
Lots of doc comments added