Clustering the computation if the directory contains more than 500 files. Fixes #1