Add documentation and improvements