fixed bug. Added simple clustering