Mostly working list of changes.

Fix various bugs in processSortedTable.
Rearrange JSON for easier processing in JavaScript.
Pull some of Handlebars' templates into partials for