Adding clustering based on distance code.

Mainly useful for hanklet clustering.