docs and minor refactor