moved up assignment of settings variable