reorganizing and clustering data