some doc and refactor