add more doxygen comments. reorder some methods