diff --git a/public_html/sites/all/modules/contrib/style_settings/style_settings.module b/public_html/sites/all/modules/contrib/style_settings/style_settings.module
index 996c3f6..2afe3f4 100644
--- a/public_html/sites/all/modules/contrib/style_settings/style_settings.module
+++ b/public_html/sites/all/modules/contrib/style_settings/style_settings.module
@@ -6,27 +6,45 @@
 function style_settings_preprocess_page(&$variables) {
   $css = array();
 
+  // When something like _drupal_flush_css_js() changes the 'css_js_query_string', 
+  // we will use this as a directive to bypass the caching of the rewritten paths.
+  $css_js_query_string_changed = variable_get('css_js_query_string', '0') != variable_get('style_settings_last_css_js_query_string', '0');
+  
   // Replace all theme stylesheets by the rewritten ones.
   foreach ($variables['css']['all']['theme'] as $old_path => $preprocess) {
-		$css[style_settings_rewrite($old_path)] = $preprocess;
+		$css[style_settings_rewrite($old_path, $css_js_query_string_changed)] = $preprocess;
 	} 
 	  
 	$variables['css']['all']['theme'] = $css;
 	$variables['styles'] = drupal_get_css($variables['css']);
+	
+  if ($css_js_query_string_changed) {
+	variable_set('style_settings_last_css_js_query_string', variable_get('css_js_query_string', '0'));
+  }	
 }
 
 /**
  * Rewrite a style sheet and return the path to the rewritten one.
  */
-function style_settings_rewrite($old_path) {
+function style_settings_rewrite($old_path, $reset = FALSE) {
 	global $theme_key, $conf;
 
+	// Caching hashed 'new paths' as it is expensive to calculate these values.
+	$cid = 'style_settings:'. $old_path;
+	$new_path_cached = cache_get($cid);
+	$new_path = isset($new_path_cached->data) ? $new_path_cached->data : FALSE; 
+	
 	$change = (string) @filectime($old_path);
 	$remote = empty($change);	
-	$settings = theme_get_settings($theme_key);
-	$checksum	= md5(serialize($settings).serialize($conf).$change);
-	$new_path	= file_directory_path().'/style/'.$checksum.'.'.basename($old_path);
-
+	
+	if (!$new_path || $reset) {
+    	$settings = theme_get_settings($theme_key);
+    	$checksum	= md5(serialize($settings).serialize($conf).$change);
+    	$new_path	= file_directory_path().'/style/'.$checksum.'.'.basename($old_path);
+    	
+    	cache_set($cid, $new_path);
+	}
+	
 	if ($remote || !file_exists($new_path)) {
 		file_check_directory(dirname($new_path), FILE_CREATE_DIRECTORY);
 		
