add doxygen documentation and make the API consistent