diff --git a/popcorn.classactivator.js b/popcorn.classactivator.js
new file mode 100644
index 0000000..98d51e4
--- /dev/null
+++ b/popcorn.classactivator.js
@@ -0,0 +1,39 @@
+(function(Popcorn) {
+  Popcorn.plugin("classactivator", (function() {
+    return {
+      manifest : {
+        about : {
+          name : "classactivator",
+          version : "1.0.0",
+          author : "Kristoffer Wiklund",
+          website : "http://www.websystem.se"
+        },
+        options : {
+          start : {
+            elem : "input",
+            type : "text",
+            label : "In"
+          },
+          end : {
+            elem : "input",
+            type : "text",
+            label : "Out"
+          },
+          target : "id-selector",
+          classname : "classname",
+        }
+      },
+      _setup : function(options) {
+        options._container = Popcorn.dom.find(options.target);
+      },
+      start : function(event, options) {
+        options._container.className = options._container.className + " " + options.classname;
+      },
+      end : function(event, options) {
+        var regex = new RegExp("\\b" + options.classname + "\\b");
+        options._container.className = options._container.className.replace(regex, '').trim();
+
+      },
+    };
+  })());
+})(Popcorn);
diff --git a/popcornplayer.js b/popcornplayer.js
index 3139ef5..32cb5a2 100644
--- a/popcornplayer.js
+++ b/popcornplayer.js
@@ -1,25 +1,33 @@
-(function ($) {
+(function($) {
 
   /**
    * Launch player, insert speakers and convert chapter links
    */
   Drupal.behaviors.popcornPlayer = {
-    attach: function(context, settings) {
+    attach : function(context, settings) {
       $.each(settings.popcornPlayer || {}, function(index, options) {
         //console.log(options.speakers);
         //alert(options.id);
         // process all media youtube cue field
         $('#media-popcornjs-' + options.id, context).once('popcornPlayer', function() {
-          // initialize popcorn 
+          // initialize popcorn
           var video = $(this);
           var popcorn = Popcorn.smart('#media-popcornjs-' + options.id, options.url);
           options.popcorn = popcorn;
-          eval(options.speakers);
+          for (var i in options.classactivator) {
+            var c = options.classactivator[i];
+            popcorn.classactivator({
+              start : c.start,
+              end : c.end,
+              target : c.target,
+              classname : c.classname,
+            });
+          }
           popcorn.play();
         });
 
         // attach chapter to popcorn
-        $('[data-popcorn-chapter-source*="'+ options.id + '"]', context).once('popcornPlayer', function() {
+        $('[data-popcorn-chapter-source*="' + options.id + '"]', context).once('popcornPlayer', function() {
           var chapter = $(this);
           // jump to the cue point on click
           chapter.on('click', function(e) {
@@ -31,10 +39,11 @@
             p.currentTime(start).play();
           });
         });
-        
-        
       });
+
+      // Adding script for scrollbar customization with enscroll
+      //$('.scrollbox').enscroll({});
     }
-  }
+  };
 
 })(jQuery);
diff --git a/popcornplayer.module b/popcornplayer.module
old mode 100755
new mode 100644
index 5856c05..fc4650a
--- a/popcornplayer.module
+++ b/popcornplayer.module
@@ -7,99 +7,47 @@ define('POPCORNPLAYER_COLORBOX_YPADDING', 63);
  * Implements hook_get_player()
  */
 function popcornplayer_get_player($params) {
-  global $base_url;
-  //@TODO: This is Agengenda specific... needs to be an alter
-  if (isset($params['variables']['#entity']->field_cm_agenda_live[LANGUAGE_NONE][0]['fid'])) {
-    $fid = $params['variables']['#entity']->field_cm_agenda_live[LANGUAGE_NONE][0]['fid'];
-  } else {
-    $fid = NULL;
-  }
-  //dsm($params['node']['mediafiles']['media']['media'][0]->file->fid);
-  //dsm($params['node']['mediafiles']['media']['media'][0]->mimetype);
+  $params['popcornplugin']['classactivator'] = array();
 
   // Add the core media player files.
   popcornplayer_add_core_files($params);
 
+  // @TODO: Module_invoke_all will run array_merge_recursive
   $player_params = module_invoke_all('popcornplayer_params', $params);
 
   // @TODO: Only varilables we are likely to need are autoplay, height, width
-
-  $params = array_merge($params, $player_params);
-  $player_params['node'] = &$params['node'];
+  //$params = array_merge($params, $player_params);
 
   // Allow other modules to alter the params.
-  drupal_alter('popcornplayer_params', $params, $player_params);
+  drupal_alter('popcornplayer_params', $params);
 
   // Get the id.
   $id = $params['id'];
+  $height = isset($params['height']) ? $params['height'] : '300px';
+  $width = isset($params['width']) ? $params['width'] : '360px';
 
-  $height = isset($player_params['height']) ? $player_params['height'] : '300px';
-  $width = isset($player_params['width']) ? $player_params['width'] : '360px';
-
-  //@TODO: This doesn't belong here... moving to block like chapters
-  if ($fid) {
-		$speakers = popcornplayer_get_speaker_events($fid);
-		$speaker_popcorn = NULL;
-		foreach ($speakers as $speaker) {
-
-			// we have to loop this way because speaker events aren't being given
-			// end times so we end them when the next evetn starts
-			if (isset($previous_start)) {
-				$end = $speaker->field_media_event_start[LANGUAGE_NONE][0]['value'];
-
-				// not sure why there are ever negative numbers, but these don't work
-				// so ignore them
-				if ($previous_start > 0) {
-				$speaker_popcorn .= "
-						 popcorn.footnote({
-							 start: " . $previous_start ." ,
-							 end: " . $end . ",
-							 text: '" . $previous_title . "',
-							 target: 'cm-agenda-events-speaker'
-						 });";
-				}
-			}
-
-			$previous_start = $speaker->field_media_event_start[LANGUAGE_NONE][0]['value'];
-			$previous_title = $speaker->field_media_event_title[LANGUAGE_NONE][0]['value'];
-		}
-  }
   $media = (isset($params['node']['mediafiles']['media']['media'][0])) ? $params['node']['mediafiles']['media']['media'][0] : NULL;
-
-  if (isset($media->path)) {
+  if (!empty($media->path)) {
     // video types we know Popcorn supports
     if ($media->mimetype == 'video/youtube' || $media->mimetype == 'video/solidtango' || $media->mimetype == 'video/vimeo') {
-
-			  $output = '<div id="media-popcornjs-' . $fid . '" class="clearfix">
-            <div class="field-show-vod">
-           </div>
-          </div>';
-
-
-
-				$settings = array(
-          'popcornPlayer' => array(array(
-          'id' => $fid,
-          'url' => $media->path . "&controls=1",
-          'speakers' => $speaker_popcorn,
-        )),
-        );
-        drupal_add_js($settings, 'setting');
-
-				$path = drupal_get_path('module', 'popcornplayer') . '/popcornplayer.js';
-        drupal_add_js($path);
-
-        // $js = 'jQuery(document).ready(function () { var popcorn = Popcorn(\'#media-popcornjs-' . $fid . '\'); alert("test!"); ' . $speaker_popcorn . ' });';
-//  				drupal_add_js($js,
-//            array('type' => 'inline', 'scope' => 'footer', 'weight' => 5)
-//         );
-      } else {
-
+      $fid = $media->file->fid;
+      $output = '<div id="media-popcornjs-' . $fid . '" class="clearfix"></div>';
+      $settings = array('popcornPlayer' => array( array(
+            'id' => $fid,
+            'url' => $media->path . "&controls=1",
+            'classactivator' => $params['popcornplugin']['classactivator'],
+          )), );
+      drupal_add_js($settings, 'setting');
+      drupal_add_js(drupal_get_path('module', 'popcornplayer') . '/popcornplayer.js');
+      drupal_add_js(drupal_get_path('module', 'popcornplayer') . '/popcorn.classactivator.js');
+    }
+    else {
       drupal_set_message('This video type is not supported by the Popcorn player', 'warning');
-      }
-  } else {
-  // this is just the demo
-   $js = "// ensure the web page (DOM) has loaded
+    }
+  }
+  else {
+    // this is just the demo
+    $js = "// ensure the web page (DOM) has loaded
          document.addEventListener('DOMContentLoaded', function () {
          // Create a popcorn instance by calling the Youtube player plugin
          var popcorn = Popcorn.smart(
@@ -116,11 +64,10 @@ function popcornplayer_get_player($params) {
          popcorn.play();
       }, false);";
 
+    drupal_add_js($js, 'inline');
 
-      drupal_add_js($js, 'inline');
-
-      //$output = ' <div id="video" style="width: ' . $width . '; height: ' . $height . ';" ></div>
-      $output = '<div id="media-popcornjs-sample"></div>
+    //$output = ' <div id="video" style="width: ' . $width . '; height: ' . $height . ';" ></div>
+    $output = '<div id="media-popcornjs-sample"></div>
       <div id="footnotediv"></div>';
   }
 
@@ -184,12 +131,10 @@ function popcornplayer_get_settings_output($type, $settings) {
   $js = 'Drupal.settings.' . $type . ' = Drupal.settings.' . $type . ' || {};';
   $js .= 'jQuery.extend(Drupal.settings.' . $type . ', ' . drupal_json_encode($settings) . ');';
   return theme('html_tag', array('element' => array(
-    '#tag' => 'script',
-    '#value' => $js,
-    '#attributes' => array(
-      'type' => 'text/javascript',
-    ),
-  )));
+      '#tag' => 'script',
+      '#value' => $js,
+      '#attributes' => array('type' => 'text/javascript', ),
+    )));
 }
 
 /**
@@ -218,7 +163,7 @@ function popcornplayer_media_colorbox_preprocess(&$variables) {
   }
 
   $file_id = $variables['file_id'];
-  if($file_id!=NULL){
+  if ($file_id != NULL) {
     $file = file_load($file_id);
     $view = file_view_file($file, $settings['colorbox_view_mode'], $variables['langcode']);
 
@@ -229,12 +174,12 @@ function popcornplayer_media_colorbox_preprocess(&$variables) {
       $preset = '';
       $displays = file_displays($file->type, $settings['colorbox_view_mode']);
       foreach ($displays as $formatter_type => $display) {
-       if (!empty($display['status'])) {
-         if (!empty($display['settings']['preset'])) {
-           $preset = $display['settings']['preset'];
-         }
-         break;
-       }
+        if (!empty($display['status'])) {
+          if (!empty($display['settings']['preset'])) {
+            $preset = $display['settings']['preset'];
+          }
+          break;
+        }
       }
 
       // If no preset is defined, then get the first one.
@@ -300,9 +245,9 @@ function popcornplayer_add_connection($params, $type) {
 
       // Add the connection setting.
       $output .= popcornplayer_get_settings_output('mediafront_connect', array($params['id'] => array(
-        'type' => $type,
-        'connect' => $connnection
-      )));
+          'type' => $type,
+          'connect' => $connnection
+        )));
     }
   }
 
@@ -323,12 +268,11 @@ function popcornplayer_library() {
     'minplayer' => array(
       'title' => 'minPlayer',
       'version' => '0.1',
-      'js' => array(
-        $path . '/minplayer/bin/minplayer.compressed.js' => $options
-      ),
-      'dependencies' => array(
-        array('system', 'ui.slider'),
-      )
+      'js' => array($path . '/minplayer/bin/minplayer.compressed.js' => $options),
+      'dependencies' => array( array(
+          'system',
+          'ui.slider'
+        ), )
     ),
     'minplayer_debug' => array(
       'title' => 'minPlayer (Debug Mode)',
@@ -352,9 +296,10 @@ function popcornplayer_library() {
         $path . '/minplayer/src/minplayer.players.dailymotion.js' => $options,
         $path . '/minplayer/src/minplayer.controller.js' => $options
       ),
-      'dependencies' => array(
-        array('system', 'ui.slider')
-      )
+      'dependencies' => array( array(
+          'system',
+          'ui.slider'
+        ))
     ),
     'popcornplayer' => array(
       'title' => 'OSM Player',
@@ -363,9 +308,10 @@ function popcornplayer_library() {
         drupal_get_path('module', 'popcornplayer') . '/popcornplayer_drupal.js' => $options,
         $path . '/bin/popcornplayer.compressed.js' => $options
       ),
-      'dependencies' => array(
-        array('system', 'ui.slider')
-      )
+      'dependencies' => array( array(
+          'system',
+          'ui.slider'
+        ))
     ),
     'popcornplayer_debug' => array(
       'title' => 'OSM Player (Debug Mode)',
@@ -383,9 +329,10 @@ function popcornplayer_library() {
         $path . '/src/popcornplayer.pager.js' => $options,
         $path . '/src/popcornplayer.teaser.js' => $options
       ),
-      'dependencies' => array(
-        array('popcornplayer', 'minplayer_debug')
-      )
+      'dependencies' => array( array(
+          'popcornplayer',
+          'minplayer_debug'
+        ))
     )
   );
 
@@ -399,18 +346,20 @@ function popcornplayer_library() {
       'version' => '0.1',
       'js' => $info['js'],
       'css' => $info['css'],
-      'dependencies' => array(
-        array('popcornplayer', 'popcornplayer')
-      )
+      'dependencies' => array( array(
+          'popcornplayer',
+          'popcornplayer'
+        ))
     );
     $libraries['popcornplayer_' . $template . '_debug'] = array(
       'title' => 'OSM Player (' . $template . '): Debug',
       'version' => '0.1',
       'js' => $info['js'],
       'css' => $info['css'],
-      'dependencies' => array(
-        array('popcornplayer', 'popcornplayer_debug')
-      )
+      'dependencies' => array( array(
+          'popcornplayer',
+          'popcornplayer_debug'
+        ))
     );
   }
 
@@ -436,8 +385,6 @@ function popcornplayer_player_info() {
   return $info;
 }
 
-
-
 /**
  * Implements hook_popcornplayer_params().
  */
@@ -571,7 +518,11 @@ function popcornplayer_player_settings_form($preset) {
   $form['presentation']['wmode'] = array(
     '#title' => t('Flash Window Mode'),
     '#type' => 'select',
-    '#options' => array('none' => 'none', 'transparent' => 'transparent', 'window' => 'window'),
+    '#options' => array(
+      'none' => 'none',
+      'transparent' => 'transparent',
+      'window' => 'window'
+    ),
     '#default_value' => $preset['settings']['wmode'],
     '#description' => t('Selects which window mode you would like for the OSM Flash player to operate under (denoted by the <b>wmode</b> parameter in the object code)
          <ul>
@@ -638,7 +589,13 @@ function popcornplayer_player_settings_form($preset) {
   $form['playlist_settings']['scrollSettings']['scrollMode'] = array(
     '#type' => 'select',
     '#title' => t('Scroll Mode'),
-    '#options' => array('auto' => 'Auto Scroll', 'mouse' => 'Mouse Scroll', 'hover' => 'Hover Scroll', 'span' => 'Span Scroll', 'none' => 'No Scroll'),
+    '#options' => array(
+      'auto' => 'Auto Scroll',
+      'mouse' => 'Mouse Scroll',
+      'hover' => 'Hover Scroll',
+      'span' => 'Span Scroll',
+      'none' => 'No Scroll'
+    ),
     '#description' => t('Specify how you would like the playlist to scroll.
       <ul>
         <li><strong>Auto Scroll</strong> - <em>Make the playlist scroll follow the mouse movements</em></li>
@@ -678,7 +635,10 @@ function popcornplayer_player_settings_form($preset) {
   $form['playlist_settings']['displaySettings']['vertical'] = array(
     '#type' => 'select',
     '#title' => t('Playlist Orientation'),
-    '#options' => array(false => 'Horizontal', true => 'Vertical'),
+    '#options' => array(
+      false => 'Horizontal',
+      true => 'Vertical'
+    ),
     '#description' => t('Selecting this will orient the playist either vertical or horizontal.  Note - This will only work if your template supports it.'),
     '#default_value' => $preset['settings']['vertical']
   );
@@ -783,9 +743,7 @@ function popcornplayer_player_settings_form($preset) {
     }
   }
   else {
-    $form['plugins']['no_plugins'] = array(
-      '#markup' => 'No plugins found.'
-    );
+    $form['plugins']['no_plugins'] = array('#markup' => 'No plugins found.');
   }
 
   $form['misc'] = array(
@@ -815,7 +773,12 @@ function popcornplayer_player_settings_form($preset) {
 function theme_popcornplayer_plugin_table($variables) {
   $info = popcornplayer_get_info();
   $rows = array();
-  $header = array('', 'Title', 'Description', 'Preview');
+  $header = array(
+    '',
+    'Title',
+    'Description',
+    'Preview'
+  );
   $element = $variables['element'];
   $js = '';
   foreach ($info['plugins'] as $name => $plugin) {
@@ -892,13 +855,16 @@ function popcornplayer_popcornplayer_info() {
 function popcornplayer_get_themes($base_path) {
   $themes = array();
   $path = getcwd() . '/' . $base_path . '/*';
-  foreach(glob($path, GLOB_ONLYDIR) as $dir) {
+  foreach (glob($path, GLOB_ONLYDIR) as $dir) {
     $name = basename($dir);
     $theme_path = $base_path . '/' . $name;
     foreach (glob($dir . '/*.css') as $css) {
       $themes[$name] = array(
         'url' => $theme_path . '/' . basename($css),
-        'options' => array('type' => 'file', 'group' => CSS_DEFAULT)
+        'options' => array(
+          'type' => 'file',
+          'group' => CSS_DEFAULT
+        )
       );
       break;
     }
@@ -954,12 +920,10 @@ function popcornplayer_get_resources($path, $base_path) {
 
   // The files for the resources.
   if ($dirs = glob($path, GLOB_ONLYDIR)) {
-    foreach($dirs as $dir) {
+    foreach ($dirs as $dir) {
       $name = basename($dir);
       $template_path = $base_path . '/' . $name;
-      $resources[$name] = array(
-        'path' => $template_path,
-      );
+      $resources[$name] = array('path' => $template_path, );
 
       // Get all the images.
       $images = array();
@@ -1006,12 +970,12 @@ function popcornplayer_get_resources($path, $base_path) {
  */
 function popcornplayer_block_info() {
   $blocks['chapters'] = array(
-    'info'       => t('Popcorn Player: Chapters'),
-    'status'     => FALSE,
-    'region'     => 'sidebar_second',
-    'weight'     => -99,
+    'info' => t('Popcorn Player: Chapters'),
+    'status' => FALSE,
+    'region' => 'sidebar_second',
+    'weight' => -99,
     'visibility' => 1,
-    'pages'      => '',
+    'pages' => '',
   );
 
   return $blocks;
@@ -1023,7 +987,7 @@ function popcornplayer_block_info() {
  */
 function popcornplayer_block_view($delta = '') {
   switch ($delta) {
-    case 'chapters':
+    case 'chapters' :
       $block['subject'] = t('Popcorn Player: Chapters');
       $block['content'] = popcornplayer_contents($delta);
       break;
@@ -1036,16 +1000,18 @@ function popcornplayer_block_view($delta = '') {
  */
 function popcornplayer_contents($which_block) {
   switch ($which_block) {
-    case 'chapters':
-
+    case 'chapters' :
       $node = node_load(arg(1));
       $fid = $node->field_cm_agenda_live[LANGUAGE_NONE][0]['fid'];
       //where are we getting the fid? frm live?
       // loading the node from the arg seems to be easiest,
       $events = popcornplayer_get_chapter_events($fid);
+      $speakers = popcornplayer_get_speaker_events($fid);
 
-      return theme('chapters', array('events' => $events));
-
+      return theme('chapters', array(
+        'events' => $events,
+        'speakers' => $speakers
+      ));
   }
 }
 
@@ -1072,19 +1038,20 @@ function popcornplayer_theme() {
   foreach ($info['templates'] as $template => $info) {
     $themes['popcornplayer_' . $template] = array(
       'template' => 'popcornplayer_' . $template,
-      'variables' => array('params' => NULL, 'templates' => NULL),
+      'variables' => array(
+        'params' => NULL,
+        'templates' => NULL
+      ),
       'path' => $info['path']
     );
   }
 
-  $themes['popcornplayer_plugin_table'] = array(
-    'render element' => 'element'
-  );
+  $themes['popcornplayer_plugin_table'] = array('render element' => 'element');
 
   $themes['chapters'] = array(
-      'template' => 'templates/chapters',
-      'variables' => array('events' => NULL),
-    );
+    'template' => 'templates/chapters',
+    'variables' => array('events' => NULL),
+  );
 
   return $themes;
 }
diff --git a/popcornplayer_drupal.js b/popcornplayer_drupal.js
deleted file mode 100644
index 2d5d4f4..0000000
--- a/popcornplayer_drupal.js
+++ /dev/null
@@ -1,38 +0,0 @@
-(function($) {
-  var plugins = {};
-  Drupal.behaviors.mediafront = {
-    attach: function(context) {
-      // Iterate through each mediafront player settings.
-      if (Drupal.settings.hasOwnProperty('mediafront')) {
-        $.each(Drupal.settings.mediafront, function(id, settings) {
-          $("#" + id + ":not(.mediafront-processed)").each(function() {
-            if (typeof plugins[settings.preset] !== 'object') {
-              plugins[settings.preset] = {};
-            }
-            plugins[settings.preset][settings.id] = $(this).addClass('mediafront-processed').osmplayer(settings);
-          });
-        });
-      }
-
-      // Now setup the mediafront connections.
-      if (Drupal.settings.hasOwnProperty('mediafront_connect')) {
-        $.each(Drupal.settings.mediafront_connect, function(plugin_id, settings) {
-          if (!settings.connected) {
-            settings.connected = true;
-            minplayer.get(plugin_id, settings.type, function(plugin) {
-              $.each(settings.connect, function(preset, preset) {
-                if (plugins[preset]) {
-                  $.each(plugins[preset], function(player_id, player) {
-                    minplayer.get(player_id, "player", function(player) {
-                      player.addPlugin(settings.type, plugin);
-                    });
-                  });
-                }
-              });
-            });
-          }
-        });
-      }
-    }
-  };
-})(jQuery);
\ No newline at end of file
