from Max Baak:: the cleanup function now return the number of rejected points.