Cleaned up some formatting.
Refactored some code, particularly around refresh.
Moved table structure into the HTML file.
Modified refresh to also refresh the header.