(cherry picked from commit afb3844920803a8c9c3e941482456f118b6c78ad)
cleaned up CSS, changed template to output clean XHTML 5, added unit tests for 60% of the code, found a few bugs by doing that and fixed them