diff --git a/modules/core/lib/Auth/Process/LanguageAdaptor.php b/modules/core/lib/Auth/Process/LanguageAdaptor.php
index 38d77ed5720897cc1c357e51971388885357840b..922be05845529c14698982fc0e47eae76e5a101e 100644
--- a/modules/core/lib/Auth/Process/LanguageAdaptor.php
+++ b/modules/core/lib/Auth/Process/LanguageAdaptor.php
@@ -2,7 +2,7 @@
 
 /**
  * Filter to set and get language settings from attributes.
- * 
+ *
  * @author Andreas Ă…kre Solberg, UNINETT AS.
  * @package simpleSAMLphp
  * @version $Id$
@@ -40,48 +40,31 @@ class sspmod_core_Auth_Process_LanguageAdaptor extends SimpleSAML_Auth_Processin
 		assert('array_key_exists("Attributes", $request)');
 
 		$attributes =& $request['Attributes'];
-		
+
 		$attrlang = NULL;
-		if (array_key_exists($this->langattr, $attributes)) 
+		if (array_key_exists($this->langattr, $attributes))
 			$attrlang = $attributes[$this->langattr][0];
-		
+
 		$config = SimpleSAML_Configuration::getInstance();
 		$t = new SimpleSAML_XHTML_Template($config, 'frontpage');
 		$lang = $t->getLanguage(FALSE, FALSE);
 
 
-		if (isset($attrlang)) 
+		if (isset($attrlang))
 			SimpleSAML_Logger::debug('LanguageAdaptor: Language in attribute was set [' . $attrlang . ']');
 		if (isset($lang))
 			SimpleSAML_Logger::debug('LanguageAdaptor: Language in session   was set [' . $lang . ']');
 
-		
-		if (isset($attrlang)) {
-
-			if (!isset($lang)) {
-				$t->setLanguage($attrlang);
-				$_GET['language'] = $attrlang;
-			} else {
-				// Language was set in both attributes and session.
-				
-				if ($lang !== $attrlang) {
-					// Different language set in attributes and session.
-
-				}
-			}
-			
-		} else {
-			
-			if (isset($lang)) {
-				$request['Attributes'][$this->langattr] = array($lang);
-			} else {
-				// Language was neighter set in attributes or in session
-			}
-			
+
+		if (isset($attrlang) && !isset($lang)) {
+			/* Language set in attribute but not in cookie - update cookie. */
+			$t->setLanguage($attrlang);
+			$_GET['language'] = $attrlang;
+		} elseif (!isset($attrlang) && isset($lang)) {
+			/* Language set in cookie, but not in attribute. Update attribute. */
+			$request['Attributes'][$this->langattr] = array($lang);
 		}
 
 	}
 
 }
-
-?>
\ No newline at end of file