Performance and style tweaks to clustering, tile sorting