improve memory allocation && doxygen