diff --git a/config-templates/config.php b/config-templates/config.php
index 7fbb9b5fba7258999f3ffbec9aa0e20ebeb01442..a0ddc3ab1d0f835e4f645a00a434d0533df4f038 100644
--- a/config-templates/config.php
+++ b/config-templates/config.php
@@ -22,7 +22,7 @@ $config = array (
 	 * See the user manual for more details.
 	 */
 	'baseurlpath'           => 'simplesaml/',
-	'templatedir'           => 'templates/default/',
+	'templatedir'           => 'templates/',
 	'metadatadir'           => 'metadata/',
 	'attributenamemapdir'   => 'attributemap/',
 	'certdir'               => 'cert/',
diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index 9e8fd50caa159c6593bd761a68c26d480b40769e..a475f0b1279110ef4394506cc31238b318ddbcb3 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -26,6 +26,10 @@ class SimpleSAML_XHTML_Template {
 		
 		$this->data['baseurlpath'] = $this->configuration->getBaseURL();
 		
+		if (isset($_GET['language'])) {
+			$this->setLanguage($_GET['language']);
+		}
+		
 		if (!empty($languagefile)) $this->includeLanguageFile($languagefile);
 	}
 	
@@ -41,11 +45,7 @@ class SimpleSAML_XHTML_Template {
 		// Language is set in object
 		if (isset($this->language)) {
 			return $this->language;
-		
-		// Language is provided in query string
-		} else if (isset($_GET['language'])) {
-			$this->setLanguage($_GET['language']);
-		
+
 		// Language is provided in a stored COOKIE
 		} else if (isset($_COOKIE['language'])) {
 			$this->language = $_COOKIE['language'];
@@ -75,11 +75,29 @@ class SimpleSAML_XHTML_Template {
 	
 	private function includeAtTemplateBase($file) {
 		$data = $this->data;
-		$filebase = $this->configuration->getPathValue('templatedir');
-		include($filebase . $file);
+		$filename = $this->configuration->getPathValue('templatedir') . $this->configuration->getValue('template.use') . '/' . $file;
+		
+		if (!file_exists($filename)) {
+			SimpleSAML_Logger::error($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $file . 
+				'] at [' . $filename . '] - Now trying at base');
+			
+			$filename = $this->configuration->getPathValue('templatedir') . $this->configuration->getValue('template.base') . '/' . $file;
+			
+			if (!file_exists($filename)) {
+				SimpleSAML_Logger::error($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $file . 
+					'] at [' . $filename . ']');
+				throw new Exception('Could not load template file [' . $file . ']');
+			}
+			
+		}
+		
+		include($filename);
 	}
 
 	private function includeAtLanguageBase($file) {
+	
+		throw new Exception('Deprecated method call includeAtLanguageBase()');
+	/*
 		$data = $this->data;
 		$filebase = $this->configuration->getPathValue('templatedir') . $this->getLanguage() . '/' ;
 		
@@ -94,6 +112,7 @@ class SimpleSAML_XHTML_Template {
 			}
 		}
 		include($filebase . $file);
+		*/
 	}
 	
 	
@@ -191,14 +210,14 @@ class SimpleSAML_XHTML_Template {
 		
 
 		$filename  = $this->configuration->getPathValue('templatedir') . 
-			$this->configuration->getPathValue('template.use') . '/' . $this->template;
+			$this->configuration->getValue('template.use') . '/' . $this->template;
 
 
 		if (!file_exists($filename)) {
 			SimpleSAML_Logger::warning($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $this->template . '] at [' . $filename . '] - now trying the base template');
 			
 			$filename = $this->configuration->getPathValue('templatedir') . 
-				$this->configuration->getPathValue('template.base') . '/' . $this->template;
+				$this->configuration->getValue('template.base') . '/' . $this->template;
 			
 
 			if (!file_exists($filename)) {
diff --git a/templates/default/includes/header.php b/templates/default/includes/header.php
index cfff2a881fe86cd50b278047fb2e273b372033a6..c10c90d99417779e4c432d7af5d286635c1de70f 100644
--- a/templates/default/includes/header.php
+++ b/templates/default/includes/header.php
@@ -35,7 +35,8 @@ $langnames = array(
 	'no'	=>	'Norsk',
 	'en'	=>	'English',
 	'de'	=>	'Deutch',
-	'dk'	=>	'Dansk'
+	'dk'	=>	'Dansk',
+	'es'	=>	'Spanish',
 );
 
 if (empty($_POST) ) {