scraper working with pg db, need to refactor queries