Complete documentation and refactor code.