diff --git openid_client_ax.module openid_client_ax.module
index 4862590..091fd17 100644
--- openid_client_ax.module
+++ openid_client_ax.module
@@ -42,25 +42,40 @@ function openid_client_ax_openid($op, $request = array()) {
   // add our information to the request if op is request and we are enabled
   if ($op == 'request') {
     $request = array();
-    $request[sprintf('openid.ns.%s', variable_get('openid_client_ax_alias', 'ax'))] = 'http://openid.net/srv/ax/1.0';
-    $request[sprintf('openid.%s.mode', variable_get('openid_client_ax_alias', 'ax'))] = 'fetch_request';
+    $ax = variable_get('openid_client_ax_alias', 'ax');
+    $request[sprintf('openid.ns.%s', $ax)] = 'http://openid.net/srv/ax/1.0';
+    $request[sprintf('openid.%s.mode', $ax)] = 'fetch_request';
     $short_names = $attributes = array();
     $attributes = module_invoke_all('openid_client', 'get');
     foreach ($attributes as $attrib_url) {
-      if (strstr($attrib_url, 'axschema.org') !== FALSE) {
-        $parts = explode('/', $attrib_url);
-        $short_names[] = $parts[count($parts) - 1];
-        $request[sprintf('openid.%s.type.'. $parts[count($parts) - 1], variable_get('openid_client_ax_alias', 'ax'))] = $attrib_url;
-      }
+      //if (strstr($attrib_url, 'axschema.org') !== FALSE) {
+      $attrib_name = openid_client_ax_attribute_name($attrib_url);
+      $short_names[] = $attrib_name;
+      $request[sprintf('openid.%s.type.%s', $ax, $attrib_name)] = $attrib_url;
+      //}
     }
     if (count($short_names) > 0) {
-      $request[sprintf('openid.%s.if_available', variable_get('openid_client_ax_alias', 'ax'))] = implode(",", $short_names);
+      $request[sprintf('openid.%s.if_available', $ax)] = implode(",", $short_names);
     }
     return $request;
   }
 }
 
 /**
+ * Creates attribute name from URL
+ *
+ * @param string $url
+ *   Uri of the attribute
+ * @return string
+ *   Short name of the attribute
+ */
+function openid_client_ax_attribute_name($uri) {
+  $parts = array_filter(explode('/', str_replace('http://', '', $uri)), 'strlen');
+  array_shift($parts);
+  return implode('_', $parts);
+}
+
+/**
  * Settings function for the module
  */
 function openid_client_ax_admin_settings() {
 