Janitorial. Refactor to support passing in settings.