moved controller to outer scope to include settings