UPDATE: Documentation updated and corrected in places.