add Environment to refactor out database connection logic