Fixed some inconsistencies in the code and bugs in doxygen comments.