refactor and doc update