Added some doxygen documentation and minor code cleanups