update docs and refactor