Added doxygen and more comments.