Added doxygen comments plus minor cleanup