Moved settings and appcache update outside.