Add documentation and address other comments