Some valgrind fixes

Plus work on html docs.. they still don't look good not like anyone will
read them