refactor code
add some documant