diff --git a/wayf_dk_login.admin.inc b/wayf_dk_login.admin.inc
index a35c680..4cf0508 100644
--- a/wayf_dk_login.admin.inc
+++ b/wayf_dk_login.admin.inc
@@ -114,14 +114,17 @@ function wayf_dk_login__settings_form() {
   );
 
   // Get languages from the feed.
-  $list  = variable_get('wayf_dk_login_organizations_list', array());
-  $items = array_keys(reset($list));
   $options = array();
-  foreach ($items as $item) {
-    if ($item == 'schacHomeOrganization') {
-      continue;
+  $list  = variable_get('wayf_dk_login_organizations_list', array());
+  if (!empty($list)) {
+    $items = array_keys(reset($list));
+    $options = array();
+    foreach ($items as $item) {
+      if ($item == 'schacHomeOrganization') {
+        continue;
+      }
+      $options[$item] = $item;
     }
-    $options[$item] = $item;
   }
 
   $form['sp']['wayf_dk_login_organizations_name_language'] = array(
@@ -192,7 +195,7 @@ function wayf_dk_login__settings_form() {
 
   // Retrieve relevant data for the organization list form.
   $list = variable_get('wayf_dk_login_organizations_list', array());
-  $language = variable_get('wayf_dk_login_organizations_name_language', 0);
+  $language = variable_get('wayf_dk_login_organizations_name_language', 'da');
   $options = array();
   foreach ($list as $key => $value) {
     $options[$value['schacHomeOrganization']] = $value[$language];
@@ -235,11 +238,10 @@ function wayf_dk_login__settings_form() {
 /**
  * Function wayf_dk_login__wayf_attributes returns list of WAYF attributes.
  *
- * @return [array]
+ * @return array
  *   list of singular attributes
  */
 function wayf_dk_login__wayf_attributes() {
-
   $attributes = array(
     '' => 'Not mapped',
     'urn:oid:2.5.4.4'  => t('Last name'),
@@ -250,7 +252,6 @@ function wayf_dk_login__wayf_attributes() {
   );
 
   return $attributes;
-
 }
 
 /**
diff --git a/wayf_dk_login.install b/wayf_dk_login.install
index c73e7c8..0aabfef 100644
--- a/wayf_dk_login.install
+++ b/wayf_dk_login.install
@@ -1,15 +1,21 @@
 <?php
-
 /**
  * @file
- * Install/uninstall functions.
+ * Handle module installation processes and update functions.
  */
 
 /**
+ * Implements hook_install().
+ */
+function wayf_dk_login_install() {
+  // Try to get default organizations list.
+  wayf_dk_login_organizations_list();
+}
+
+/**
  * Implements hook_uninstall().
  */
 function wayf_dk_login_uninstall() {
-
   $variables = array(
     'wayf_dk_login_mode',
     'wayf_dk_login_field_mapping',
@@ -27,12 +33,13 @@ function wayf_dk_login_uninstall() {
     'wayf_dk_login_sp_endpoint',
     'wayf_dk_login_sp_entityid',
     'wayf_dk_login_sp_key',
+    'wayf_dk_login_user_autocreate',
+    'wayf_dk_login_user_localscope',
   );
 
   foreach ($variables as $variable) {
     variable_del($variable);
   }
-
 }
 
 /**
diff --git a/wayf_dk_login.module b/wayf_dk_login.module
index 8e81ce5..52a7909 100644
--- a/wayf_dk_login.module
+++ b/wayf_dk_login.module
@@ -62,6 +62,7 @@ function wayf_dk_login_permission() {
  * Implements hook_menu().
  */
 function wayf_dk_login_menu() {
+  $items = array();
 
   $items['admin/config/people/wayf'] = array(
     'title' => 'WAYF.dk settings',
@@ -246,7 +247,6 @@ function wayf_dk_login__map_fields($attributes, &$userinfo) {
  *   returns array with icons file names
  */
 function wayf_dk_login__icons() {
-
   return array(
     'UK_01.png',
     'UK_02.png',
@@ -272,7 +272,6 @@ function wayf_dk_login__icons() {
  *   width/height attributes
  */
 function wayf_dk_login__icon_size($icon) {
-
   switch ($icon) {
     case 'UK_01G.png':
       return (object) array('width' => 83, 'height' => 34);
@@ -307,7 +306,6 @@ function wayf_dk_login__icon_size($icon) {
     case 'wayf_logo.png':
       return (object) array('width' => 125, 'height' => 65);
   }
-
 }
 
 /**
@@ -352,6 +350,7 @@ function wayf_dk_login_form_user_login_alter(&$form, &$form_state) {
  */
 function wayf_dk_login__get_ipd_metadata($mode) {
 
+  $metadata_url = '';
   switch ($mode) {
     case 'test':
       $metadata_url = 'https://testbridge.wayf.dk/saml2/idp/metadata.php';
@@ -392,7 +391,7 @@ function wayf_dk_login__get_ipd_metadata($mode) {
     // Get certificate data.
     $cert = $xml->xpath("$idpssodescriptor/md:KeyDescriptor[@use='signing']/ds:KeyInfo/ds:X509Data/ds:X509Certificate");
 
-    // Set information form the metadate.
+    // Set information form the meta-date.
     $info = (object) array(
       'cert' => (string) $cert[0],
       'sso' => (string) $sso[0]['Location'],
@@ -406,9 +405,16 @@ function wayf_dk_login__get_ipd_metadata($mode) {
 /**
  * Implements hook_cron().
  *
- * Imports a list of WAYF organizations.
+ * Updates the organization list on cron runs.
  */
 function wayf_dk_login_cron() {
+  wayf_dk_login_organizations_list();
+}
+
+/**
+ * Import organizations from the WAYF service.
+ */
+function wayf_dk_login_organizations_list() {
   $feed_url = variable_get('wayf_dk_login_organizations_list_url', WAYF_DK_LOGIN_ORGANIZATIONS_LIST_URL);
   $content = file_get_contents($feed_url);
   $data = json_decode($content, TRUE);
