refactor and improve doc