Better exp algorithm from divVerent