Add documentation and comments