add tolerance to HI algorithm