moved device settings to the top of the file