Factorize code DHT related.