refactor code
refactor code
add global_variable and doxygen and refactor code