Updated clustering and fixed small bugs