Added hash(chain); function