New clustering logic v.3