refactored code to use the new way to get the DB. much better for DB credentials.