Slight changes to mlg_clustering.c to increase speed and stability.