cleaning and consolidating and deleting now unused functions changed threshold to 1 from 10 for bkgd database counts