functional double DB-scan code, errors corrected lots of prints