changed where the connection to the db is called