Added doxygen comments.
Also removed unused function.