Speed up clustering

This significantly speeds up the clustering. Otherwise it's not usable with a markers count > 10k.