many comments for docs and refactor