Clustering algorithm now working

- corrected all crashes and algorithms bugs
- works on-line without a problem