refactor to include local setting