changed cleaning to update database after every dataset instead of at end of cleaning