added algorithm for thinning backups