refactor code, docs