Refactor/table rendering

Strings manipulation is faster than loads of 'DOM' manipulation on the server. Let's use strings.
See similar comment below about keeping opening and closing tags together.