diff --git a/plugins/slideshare.inc b/plugins/slideshare.inc
index c802627..25fa96e 100644
--- a/plugins/slideshare.inc
+++ b/plugins/slideshare.inc
@@ -139,7 +139,7 @@ function fbsmp_slideshare_fbsmp_admin_settings_form_validate(&$form, &$form_stat
 
   //Do not allow the file path to be the same as the file_directory_path().
   //This causes all sorts of problems with things like file_create_url().
-  if (strpos($form_values['file_path'], file_directory_path()) === 0) {
+  if (strpos($form_values['file_path'], file_default_scheme() . ':/' ) === 0) {
     form_set_error('file_path', t('The file path (@file_path) cannot start with the system files directory (@files_directory), as this may cause conflicts when building file URLs.', array('@file_path' => $form_values['file_path'], '@files_directory' => file_directory_path())));
   }
 }
@@ -273,7 +273,7 @@ function fbsmp_slideshare_fbsmp_subtheme() {
 function fbsmp_slideshare_fbsmp_themed_attachment($attachment) {
   $settings = fbsmp_load_plugin_settings('slideshare');
   // TODO Please change this theme call to use an associative array for the $variables parameter.
-  return theme('fbsmp_slideshare_attachment', $attachment, $settings);
+  return theme('fbsmp_slideshare_attachment', array('attachment' => $attachment, 'settings' => $settings));
 }
 
 /**
@@ -294,9 +294,9 @@ function fbsmp_slideshare_fbsmp_themed_attachment($attachment) {
  * @return
  *   Return the HTML code to embed for the slideshow.
  */
-function theme_fbsmp_slideshare_attachment($attachment, $settings = array()) {
+function theme_fbsmp_slideshare_attachment($variables) {
   // TODO: Should this theme fbsmp_slideshare_attachment be declared in hook_theme()?
-  $slideshow = fbsmp_slideshare_get_slideshow($attachment->data['slideshare_id'], $settings);
+  $slideshow = fbsmp_slideshare_get_slideshow($variables['attachment']->data['slideshare_id'], $variables['settings']);
   if ($slideshow && $slideshow['status'] == FBSMP_SLIDESHARE_CONVERSION_COMPLETE && $slideshow['embed']) {
     return $slideshow['embed'];
   }
@@ -363,8 +363,8 @@ function fbsmp_slideshare_widget_upload_validators($settings) {
   }
 
   $validators = array(
-    '_fbsmp_file_validate_size' => array($max_filesize),
-    '_fbsmp_file_validate_extensions' => array($settings['file_extensions']),
+    'file_validate_size' => array($max_filesize),
+    'file_validate_extensions' => array($settings['file_extensions']),
   );
 
   return $validators;
diff --git a/plugins/video.inc b/plugins/video.inc
index 4038e43..1e2bfaa 100644
--- a/plugins/video.inc
+++ b/plugins/video.inc
@@ -523,7 +523,12 @@ function fbsmp_video_fbsmp_delete($status) {
   $attachment_data = $status->attachment->data;
   _fbsmp_file_delete(_fbsmp_file_load($attachment_data['fid']));
 
-  $video = db_fetch_object(db_query("SELECT fv.* FROM {fbsmp_videos} fv WHERE fid = :fid", array(':fid' => $attachment_data['fid'])));
+  $video =  db_select('fbsmp_videos' , 'fv')
+                ->fields('fv')
+                ->condition('fid', $attachment->data['fid'])
+                ->execute()
+                ->fetchObject();
+ 
   if ($video) {
     _fbsmp_file_delete(_fbsmp_file_load($video->cid));
   }
@@ -745,8 +750,8 @@ function fbsmp_video_widget_upload_validators($settings) {
   }
 
   $validators = array(
-    '_fbsmp_file_validate_size' => array($max_filesize),
-    '_fbsmp_file_validate_extensions' => array($settings['file_extensions'])
+    'file_validate_size' => array($max_filesize),
+    'file_validate_extensions' => array($settings['file_extensions'])
   );
 
   return $validators;
@@ -794,8 +799,8 @@ function fbsmp_video_fbsmp_themed_attachment($attachment) {
         $thumbnail_url = file_create_url($thumbnail_file['filepath']);
       }
     }
-    // TODO Please change this theme call to use an associative array for the $variables parameter.
-    return theme('fbsmp_video_attachment', $file, $thumbnail_url, $attachment_data['title'], $attachment_data['description'], $settings);
+    
+    return theme('fbsmp_video_attachment', array('file' => $file, 'thumbnail_url' => $thumbnail_url, 'settings' => $settings));
   }
   return '';
 }
@@ -814,14 +819,19 @@ function fbsmp_video_fbsmp_themed_attachment($attachment) {
  *   An array containing the file information including the video download url.
  */
 function fbsmp_video_load_displayed_video($attachment, $settings = array()) {
-  $query = "SELECT fv.* from {fbsmp_videos} as fv WHERE fid = %d";
-  $fv_object = db_fetch_object(db_query("SELECT fv.* from {fbsmp_videos} as fv WHERE fid = :fid", array(':fid' => $attachment->data['fid'])));
+  
+  $fv_object =  db_select('fbsmp_videos' , 'fv')
+                ->fields('fv')
+                ->condition('fid', $attachment->data['fid'])
+                ->execute()
+                ->fetchObject();
+  
   if ($fv_object) {
     $cid = ($fv_object->status == FBSMP_VIDEO_CONVERSION_NONE || ($fv_object->status != FBSMP_VIDEO_CONVERSION_COMPLETE && $settings['show_original_video'])) ? $fv_object->fid : ($fv_object->status == FBSMP_VIDEO_CONVERSION_COMPLETE ? $fv_object->cid : 0);
 
     $file = (array) _fbsmp_file_load($cid);
-    if (is_file($file['filepath'])) {
-      $file['url'] = file_create_url($file['filepath']);
+    if (is_file($file['uri'])) {
+      $file['url'] = file_create_url($file['uri']);
     }
     else {
       $file = array();
@@ -850,17 +860,22 @@ function fbsmp_video_load_displayed_video($attachment, $settings = array()) {
  * @return
  *   HTML code which can be embedded into the status.
  */
-function theme_fbsmp_video_attachment($file, $thumbnail_url = '', $title = '', $description = '', $settings = array()) {
+function theme_fbsmp_video_attachment($variables) {
   // TODO: Should this theme fbsmp_video_attachment be declared in hook_theme()?
   $output = '';
+  $file = $variables['file'];
+  $settings = $variables['settings'];
+  $thumbnail_url = $variables['thumbnail_url'];
+  
   if (!empty($file)) {
     $video_extension = pathinfo($file['filename'], PATHINFO_EXTENSION);
     $extensions = fbsmp_video_web_video_extensions();
+    
     if (key_exists($video_extension, $extensions)) {
       $settings['player_width'] = !empty($settings['player_width']) ? $settings['player_width'] : 435;
       $settings['player_height'] = !empty($settings['player_height']) ? $settings['player_height'] : 350;
       // TODO Please change this theme call to use an associative array for the $variables parameter.
-      $output .= theme($extensions[$video_extension], $file['url'], $thumbnail_url, $settings);
+      $output .= theme($extensions[$video_extension], array('video_url' => $file['url'], 'thumbnail_url' => $thumbnail_url, 'settings' => $settings));
     }
   }
 
@@ -919,7 +934,7 @@ function fbsmp_video_fbsmp_subtheme() {
   }
 
   $themes['fbsmp_video_attachment'] = array(
-    'arguments' => array('file' => NULL, 'thumbnail_url' => NULL, 'title' => NULL, 'description' => NULL, 'settings' => NULL),
+    'arguments' => array('file' => NULL, 'thumbnail_url' => NULL, 'settings' => NULL),
     'file' => 'plugins/video.inc',
   );
   return $themes;
@@ -929,7 +944,12 @@ function fbsmp_video_fbsmp_subtheme() {
  * @todo Please document this function.
  * @see http://drupal.org/node/1354
  */
-function theme_fbsmp_video_play_quicktime($video_url, $thumbnail_url = '', $settings = array()) {
+function theme_fbsmp_video_play_quicktime($variables) {
+
+  $video_url = $variables['video_url'];
+  $thumbnail_url = $variables['thumbnail_url'];
+  $settings = $variables['settings'];
+  
   // TODO: Should this theme fbsmp_video_play_quicktime be declared in hook_theme()?
   $autoplay = $settings['autoplay'] ? 'true' : 'false';
 
@@ -957,7 +977,12 @@ function theme_fbsmp_video_play_quicktime($video_url, $thumbnail_url = '', $sett
  * @todo Please document this function.
  * @see http://drupal.org/node/1354
  */
-function theme_fbsmp_video_play_divx($video_url, $thumbnail_url = '', $settings = array()) {
+function theme_fbsmp_video_play_divx($variables) {
+  // @todo to change this something neat
+  $video_url = $variables['video_url'];
+  $thumbnail_url = $variables['thumbnail_url'];
+  $settings = $variables['settings'];
+  
   // TODO: Should this theme fbsmp_video_play_divx be declared in hook_theme()?
   $output  = '';
   $output .= '<object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="' . $settings['player_width'] . '" height="' . $settings['player_height'] . '" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">';
@@ -975,7 +1000,12 @@ function theme_fbsmp_video_play_divx($video_url, $thumbnail_url = '', $settings
  * @todo Please document this function.
  * @see http://drupal.org/node/1354
  */
-function theme_fbsmp_video_play_dcr($video_url, $thumbnail_url = '', $settings = array()) {
+function theme_fbsmp_video_play_dcr($variables) {
+  // @todo to change this something neat
+  $video_url = $variables['video_url'];
+  $thumbnail_url = $variables['thumbnail_url'];
+  $settings = $variables['settings'];
+  
   // TODO: Should this theme fbsmp_video_play_dcr be declared in hook_theme()?
   $output  = '';
   $output .= '<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" type="application/x-director" width="' . $settings['player_width'] . '" height="' . $settings['player_height'] . '" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=10,0,0,0">';
@@ -992,7 +1022,12 @@ function theme_fbsmp_video_play_dcr($video_url, $thumbnail_url = '', $settings =
  * @todo Please document this function.
  * @see http://drupal.org/node/1354
  */
-function theme_fbsmp_video_play_flv($video_url, $thumbnail_url = '', $settings = array()) {
+function theme_fbsmp_video_play_flv($variables) {
+  // @todo to change this something neat
+  $video_url = $variables['video_url'];
+  $thumbnail_url = $variables['thumbnail_url'];
+  $settings = $variables['settings'];
+  
   // TODO: Should this theme fbsmp_video_play_flv be declared in hook_theme()?
   $output = '';
   $othervars = array();
@@ -1002,7 +1037,7 @@ function theme_fbsmp_video_play_flv($video_url, $thumbnail_url = '', $settings =
     );
   }
 
-  if (module_exists(swftools)) {
+  if (module_exists('swftools')) {
     $options = array(
       'params' => array(
         'width' => $settings['player_width'],
@@ -1022,7 +1057,12 @@ function theme_fbsmp_video_play_flv($video_url, $thumbnail_url = '', $settings =
  * @todo Please document this function.
  * @see http://drupal.org/node/1354
  */
-function theme_fbsmp_video_play_flash($video_url, $thumbnail_url = '', $settings = array()) {
+function theme_fbsmp_video_play_flash($variables) {
+  // @todo to change this something neat
+  $video_url = $variables['video_url'];
+  $thumbnail_url = $variables['thumbnail_url'];
+  $settings = $variables['settings'];
+  
   // TODO: Should this theme fbsmp_video_play_flash be declared in hook_theme()?
   $output = '';
   $output .= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' . $settings['player_width'] . '" height="' . $settings['player_height'] . '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">';
@@ -1041,7 +1081,11 @@ function theme_fbsmp_video_play_flash($video_url, $thumbnail_url = '', $settings
  * @todo Please document this function.
  * @see http://drupal.org/node/1354
  */
-function theme_fbsmp_video_play_windowsmedia($video_url, $thumbnail_url = '', $settings = array()) {
+function theme_fbsmp_video_play_windowsmedia($variables) {
+   // @todo to change this something neat
+  $video_url = $variables['video_url'];
+  $thumbnail_url = $variables['thumbnail_url'];
+  $settings = $variables['settings'];
   // TODO: Should this theme fbsmp_video_play_windowsmedia be declared in hook_theme()?
   $output = '';
   $output .= '<object type="video/x-ms-wmv" data="' . $video_url . '" width="' . $settings['player_width'] . '" height="' . $settings['player_height'] . '">';
@@ -1060,7 +1104,11 @@ function theme_fbsmp_video_play_windowsmedia($video_url, $thumbnail_url = '', $s
  * @todo Please document this function.
  * @see http://drupal.org/node/1354
  */
-function theme_fbsmp_video_play_theora($video_url, $thumbnail_url = '', $settings = array()) {
+function theme_fbsmp_video_play_theora($variables) {
+   // @todo to change this something neat
+  $video_url = $variables['video_url'];
+  $thumbnail_url = $variables['thumbnail_url'];
+  $settings = $variables['settings'];
   // TODO: Should this theme fbsmp_video_play_theora be declared in hook_theme()?
   $output = '';
   $output .= '<applet=code="com.fluendo.player.Cortado.class" archive="' . $settigs['theora_player'] . '" width="' . $settings['player_width'] . '" height="' . $settings['player_height'] . '">';
@@ -1082,7 +1130,11 @@ function theme_fbsmp_video_play_theora($video_url, $thumbnail_url = '', $setting
  * @todo Please document this function.
  * @see http://drupal.org/node/1354
  */
-function theme_fbsmp_video_play_realmedia($video_url, $thumbnail_url = '', $settings = array()) {
+function theme_fbsmp_video_play_realmedia($variables) {
+   // @todo to change this something neat
+  $video_url = $variables['video_url'];
+  $thumbnail_url = $variables['thumbnail_url'];
+  $settings = $variables['settings'];
   // TODO: Should this theme fbsmp_video_play_realmedia be declared in hook_theme()?
   $output  = '';
   $output .= '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="' . $settings['player_width'] . '" height="' . $settings['player_height'] . '">';
