diff --git a/openid_profile.module b/openid_profile.module
index 2a8ab15..cdd2934 100644
--- a/openid_profile.module
+++ b/openid_profile.module
@@ -119,7 +119,7 @@ function openid_profile_map($form_state) {
   $options_profile = array(
     'name' => t('Account: Username'),
     'mail' => t('Account: Email'),
-    //'picture' => t('Account: Picture'), //TODO
+    'picture' => t('Account: Picture'), //TODO
     'timezone' => t('Account: Timezone'),
     'language' => t('Account: Language'),
   );
@@ -174,14 +174,6 @@ function openid_profile_map($form_state) {
     );
   }
 
-  // Checks if a profile field is already mapped, in this case it will be removed from the selection list of avalible profilefields
-  $openid_profile_map = variable_get('openid_profile_map', array());
-  foreach ($openid_profile_map as $key => $data) {
-    if(isset($options_profile[$data])) {
-      unset($options_profile[$data]);
-    }
-  }
-
   $form['map'] = array(
     '#type' => 'fieldset',
     '#title' => t('Map profile fields to OpenID fields'),
@@ -273,7 +265,7 @@ function openid_profile_openid_provider_ax($op, $attributes, $uid = FALSE) {
       if (!empty($value)) {
         $response['openid.ax.value.'. $key] = $value;
       }
-    }
+    }    
     return $response;
   }
   if ($op == 'store') {
@@ -304,6 +296,9 @@ function openid_profile_openid_client_ax($op, $attributes, $uid = FALSE) {
     }
     return $response;
   }
+  if ($op == 'store') {
+    openid_profile_user_profile_save($attributes, $uid);
+  }
 }
 
 /**
@@ -316,7 +311,7 @@ function openid_profile_openid_client($op, $response = NULL, $account = NULL) {
   if ($op == 'get') {
     return array_keys($mapping);
   }
-  if ($op == 'update') {
+  if ($op == 'update') {   
     openid_profile_user_profile_save($response, $account->uid);
   }
 }
@@ -493,17 +488,19 @@ function _openid_profile_schema_definitions() {
  * Process variables for user-picture.tpl.php.
  * This is a copy from user.module, only modified to allow remote pictures
  */
-/*
+   
 function openid_profile_preprocess_user_picture(&$variables) {
-  $variables['picture'] = '';
+  $variables['picture'] = '';  
+  $external = FALSE;
   if (variable_get('user_pictures', 0)) {
     $account = $variables['account'];
     if (!empty($account->picture) && file_exists($account->picture)) {
-      $picture = file_create_url($account->picture);
+      $picture = $account->picture;
     }
     // Add support for external user pictures
     else if (!empty($account->picture) && valid_url($account->picture)) {
       $picture = $account->picture;
+      $external = TRUE;
     }
     else if (variable_get('user_picture_default', '')) {
       $picture = variable_get('user_picture_default', '');
@@ -511,7 +508,40 @@ function openid_profile_preprocess_user_picture(&$variables) {
 
     if (isset($picture)) {
       $alt = t("@user's picture", array('@user' => $account->name ? $account->name : variable_get('anonymous', t('Anonymous'))));
-      $variables['picture'] = theme('image', $picture, $alt, $alt, '', FALSE);
+      if (variable_get('user_picture_imagecache_profiles_default', 0) || variable_get('user_picture_imagecache_profiles', 0)) {
+        if (variable_get('user_picture_imagecache_profiles_default', 0)) {
+          $size = variable_get('user_picture_imagecache_profiles_default', 0);
+        }
+        // If on user profile page.
+        if (arg(0) == 'user' && (arg(2) == NULL || arg(2) == 'edit')) {
+          if (is_numeric(arg(1)) || (module_exists('me') && arg(1) == me_variable_get('me_alias'))) {
+            if (variable_get('user_picture_imagecache_profiles', 0)) {
+              $size = variable_get('user_picture_imagecache_profiles', 0);
+            }
+          }
+        }
+        // If viewing a comment
+        if (is_object($account) && array_key_exists('cid', get_object_vars($account))) {
+          if (variable_get('user_picture_imagecache_comments', 0)) {
+            $size = variable_get('user_picture_imagecache_comments', 0);
+          }
+        }
+        // If views set an imagecache preset
+        if (isset($account->imagecache_preset)) {
+          $size = $account->imagecache_preset;
+        }
+        $preset = is_numeric($size) ? imagecache_preset($size) : imagecache_preset_by_name($size);  
+        if ($external) { 
+          $path = openid_profile_external_pictures($picture, $preset['presetname']); 
+          $variables['picture'] = theme('image', $path, $alt, $alt, '', FALSE); 
+        }
+        else {
+          $variables['picture'] = theme('imagecache', $preset['presetname'], $picture, $alt, $alt);  
+        }  
+      }
+      else {
+        $variables['picture'] = theme('image', $picture, $alt, $alt, '', FALSE); 
+      }
       if (!empty($account->uid) && user_access('access user profiles')) {
         $attributes = array('attributes' => array('title' => t('View user profile.')), 'html' => TRUE);
         $variables['picture'] = l($variables['picture'], "user/$account->uid", $attributes);
@@ -519,8 +549,6 @@ function openid_profile_preprocess_user_picture(&$variables) {
     }
   }
 }
-*/
-
 /**
  * This module can be used in client and provider environment as well
  * so we cannot really depend on either _ax module.
@@ -562,3 +590,44 @@ return $mapping;';
   return $form;
 }*/
 
+/**
+* Getting External Pictures to Imagecache
+* 
+* @param mixed $url
+* @param mixed $preset
+*/
+function openid_profile_external_pictures($url, $preset) {
+  $hash = $url;
+  $dir = file_create_path('externals');
+  if (!file_check_directory($dir)) {
+    mkdir($dir, 0775, FALSE);
+  }
+  $hash = md5($url);
+  $cachepath = file_create_path('externals/'. $hash);
+  if (!is_file($cachepath)) {
+    $result = openid_profile_external_fetch($url, $cachepath);
+    if (!$result) {
+      //we couldn't get the file
+      return drupal_not_found();
+    }
+  }
+  return file_directory_path() .'/imagecache/'. $preset .'/externals/'. $hash; 
+}
+/**
+ * Fetch Image and save url
+ * @param $url string url to fetch
+*/
+function openid_profile_external_fetch($url, $cachepath) {
+  $result = drupal_http_request($url);
+  $code   = floor($result->code / 100) * 100;
+  $types  = array('image/jpeg', 'image/png', 'image/gif');
+  if ($result->data && $code != 400 && $code != 500 && in_array($result->Content-Type, $types)) {
+    $src = file_save_data($result->data, $cachepath, FILE_EXISTS_REPLACE);
+  }
+  else  {
+    //if we are unsuccessful then log a message in watchdog
+    watchdog('openid_profile', 'The image '. $url .' could not be retrieved');
+    return drupal_not_found();
+  }
+  return TRUE;
+}
\ No newline at end of file
