diff --git a/lightbox2.formatter.inc b/lightbox2.formatter.inc
index f0bee9f..603f645 100644
--- a/lightbox2.formatter.inc
+++ b/lightbox2.formatter.inc
@@ -27,6 +27,7 @@ function theme_lightbox2_image($variables) {
   $image_style = $variables['image_style'];
   $node_id = $variables['node_id'];
   $field_name = $variables['field_name'];
+  $caption = $variables['caption'];
 
   if (!$variables["lightbox_style"]) {
     $path['path'] = file_create_url($item['uri']);
@@ -66,7 +67,26 @@ function theme_lightbox2_image($variables) {
   $rel .= ']';
 
   // Title Start
-  $rel .= '[' . $item['title'];
+  $rel .= '[';
+  
+  switch($caption) {
+    case 'hidden':
+        break;
+    case 'filename':
+        $rel .= $item['filename'];
+        break;
+    case 'title':
+        $rel .= $item['title'];
+        break;
+    default:
+        $caption_display = array(
+            'label' => 'hidden',
+            );
+        $entity = entity_load('file', array($item['fid']));
+        $entity = $entity[$item['fid']];
+        $rel.=drupal_render(field_view_field('file', $entity, $caption, $caption_display));
+        break;
+  }
 
   // Download Link
   if (user_access('download original image')) {
diff --git a/lightbox2.module b/lightbox2.module
index 4bfc6d9..2d00383 100644
--- a/lightbox2.module
+++ b/lightbox2.module
@@ -786,7 +786,7 @@ function lightbox2_add_files() {
     }
     //drupal_add_js($path .'/js/prototype.js', array( 'scope' => $js_location, 'cache' => false ) );
     //drupal_add_js($path .'/js/scriptaculous.js', array( 'scope' => $js_location, 'cache' => false ) );
-    drupal_add_js($path . '/js/lightbox.js', array( 'scope' => $js_location));
+    drupal_add_js($path . '/js/lightbox.js', array( 'scope' => $js_location , 'cache' => FALSE) );
 
   }
   // Lightbox Lite.
@@ -797,6 +797,102 @@ function lightbox2_add_files() {
   }
 }
 
+function lightbox2_image_styles() {
+  $image_styles=array('0'=>'original');
+  $tmp=image_styles();
+  foreach($tmp as $style) {
+    $image_styles[$style['name']] = $style['name'];
+  }
+  return $image_styles;
+}
+function lightbox2_image_fields() {
+    $fields = array(
+        'hidden' => t('Hidden'),
+	   'title' => t('File title'),
+	   'filename' => t('Filename'),
+	   );
+    foreach(field_info_instances("file", "image") as $field) {
+        $fields[$field['field_name']] = $field['label'];
+    }
+    return $fields;
+}
+function lightbox2_lightbox_types() {
+    return array(
+      'lightbox' => t('Single lightbox'),
+      'lightshow' => t('Lightshow'),
+    );
+}
+/**
+ * Implements hook_field_formatter_settings_form().
+ */
+function lightbox2_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) { 
+  $display = $instance['display'][$view_mode];
+  $settings = $display['settings'];
+
+  $form = array();
+
+  $form['type'] = array(
+    '#title' => t('Lightbox type'),
+    '#type' => 'select',
+    '#options' => array(
+    	lightbox2_lightbox_types(),
+    ),
+    '#default_value' => $settings['type'],
+  );
+  $form['image_style'] = array(
+    '#title' => t('Image style'),
+    '#description' => t('The thumbnail to display as a link for the lightbox.'),
+    '#type' => 'select',
+    '#options' => lightbox2_image_styles(),
+    '#default_value' => $settings['image_style'],
+  );
+  $form['lightbox_style'] = array(
+    '#title' => t('Lightbox style'),
+    '#description' => t('The image style to show inside the lightbox.'),
+    '#type' => 'select',
+    '#options' => lightbox2_image_styles(),
+    '#default_value' => $settings['lightbox_style'],
+  );
+
+  $form['caption'] = array(
+    '#title' => t('Caption field'),
+    '#description' => t('The field to use as a caption.'),
+    '#type' => 'select',
+    '#options' => lightbox2_image_fields(),
+    '#default_value' => $settings['caption'],
+  );
+
+  return $form;
+}
+/**
+ * Implements hook_field_formatter_settings_summary().
+ */
+function lightbox2_field_formatter_settings_summary($field, $instance, $view_mode) {
+  $display = $instance['display'][$view_mode];
+  $settings = $display['settings'];
+
+  $image_styles = lightbox2_image_styles();
+  $fields = lightbox2_image_fields();
+  $types = lightbox2_lightbox_types();
+
+  $summary = '';
+
+  if(isset($settings['caption']) && isset($settings['type']) && isset($settings['image_style']) && isset($settings['lightbox_style'])) {
+    $summary .= '<strong>'.t('Caption field') . '</strong>: ' . $fields[$settings['caption']] . '<br/>';
+    $summary .= '<strong>'.t('Display') . '</strong>: ' ;
+    $summary .= $types[$settings['type']];
+    $summary .= ': ';
+    $summary .= $image_styles[$settings['image_style']];
+    $summary .= ' => ';
+    $summary .= $image_styles[$settings['lightbox_style']];
+  } else {
+    $summary = 'Title - Lightbox: original => original';
+  }
+
+
+  return $summary;
+}
+
 /**
  * Implementation of hook_field_formatter_info().
  *
@@ -807,22 +903,16 @@ function lightbox2_add_files() {
 function lightbox2_field_formatter_info() {
   $formatters = array();
   if (module_exists('image')) {
-    $image = $lightbox = image_styles();
-    $types = array('lightbox', 'lightshow');
-    foreach ($types as $type) {
-      foreach ($image as $image_key => $image_value ) {
-        $formatters['lightbox2__' . $type . '__' . $image_key . '__original'] = array(
-          'label' => 'Lightbox2: ' . $type . ': ' . $image_key . '->original',
-          'field types' => array('image'),
-        );
-        foreach ($lightbox as $lightbox_key => $lightbox_value ) {
-          $formatters['lightbox2__' . $type . '__' . $image_key . "__" . $lightbox_key] = array(
-            'label' => 'Lightbox2: ' . $type . ': ' . $image_key . '->' . $lightbox_key,
-            'field types' => array('image'),
-          );
-        }
-      }
-    }
+    $formatters['lightbox2'] = array(
+      'label' => 'Lightbox2',
+      'field types' => array('image'),
+      'settings' => array(
+          'type' => 'lightbox',
+          'image_style' => 'original',
+          'lightbox_style' => 'original',
+          'caption' => 'hidden',
+      ),
+    );
   }
   return $formatters;
   /*
@@ -946,10 +1036,11 @@ function lightbox2_field_formatter_info() {
  */
 function lightbox2_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
   $element = array();
-  $pieces = explode('__', $display['type']);
-  $lightbox_type = $pieces[1];
-  $image_style = $pieces[2];
-  $lightbox_style = $pieces[3];
+
+  $settings = $display["settings"];
+  $lightbox_type = $settings['type'];
+  $image_style = $settings['image_style'];
+  $lightbox_style = $settings['lightbox_style'];
 
   if ($image_style == 'original') {
     $image_style = NULL;
@@ -960,8 +1051,8 @@ function lightbox2_field_formatter_view($entity_type, $entity, $field, $instance
 
   if ($entity_type == 'node') {
     $node_id = $entity->nid;
-  } 
-  else {
+  }
+else {
     $node_id = 0;
   }
 
@@ -979,6 +1070,7 @@ function lightbox2_field_formatter_view($entity_type, $entity, $field, $instance
       '#path' => $uri,
       '#node_id' => $node_id,
       '#field_name' => $field['field_name'],
+      '#caption' => $settings['caption'],
     );
   }
   return ($element);
@@ -1029,6 +1121,7 @@ function lightbox2_theme($existing, $type, $theme, $path) {
       'lightbox_style' => NULL,
       'node_id' => NULL,
       'field_name' => NULL,
+      'caption' => NULL,
      ),
     //'variables' => array(),
   );
