diff --git a/plugins/video.inc b/plugins/video.inc
index 4038e43..fe912ab 100644
--- a/plugins/video.inc
+++ b/plugins/video.inc
@@ -16,9 +16,9 @@ fbsmp_include_library('ffmpeg.inc', 'ffmpeg');
  * Implementation of hook_fbsmp_admin_settings_form().
  */
 function fbsmp_video_fbsmp_admin_settings_form(&$form_state) {
-  if (!module_exists('swftools')) {
+  if (!module_exists('flowplayer')) {
     drupal_set_message(
-      t('You must install <a href="!swftools">SWFTools</a> module to display the <i>FLV</i> or <i>F4V</i> videos.', array('!swftools' => 'http://drupal.org/project/swftools')),
+      t('You must install <a href="!flowplayer">Flow Player</a> module to display the <i>FLV</i> or <i>F4V</i> videos.', array('!flowplayer' => 'http://drupal.org/project/flowplayer')),
       'error'
     );
   }
@@ -274,7 +274,7 @@ function fbsmp_video_fbsmp_admin_settings_form_validate(&$form, &$form_state) {
   //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().
   foreach (array('file_path', 'thumbnails_path') as $var) {
-    if (strpos($form_values[$var], file_directory_path()) === 0) {
+    if (strpos($form_values[$var], file_default_scheme() . ':/') === 0) {
       form_set_error($var, 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[$var], '@files_directory' => file_directory_path())));
     }
   }
@@ -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,9 +1022,15 @@ 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 = '';
+  // @todo What to do with the Thumbnail ? Should i have to remove it?
   $othervars = array();
   if (!empty($thumbnail_url)) {
     $othervars = array(
@@ -1002,18 +1038,19 @@ function theme_fbsmp_video_play_flv($video_url, $thumbnail_url = '', $settings =
     );
   }
 
-  if (module_exists(swftools)) {
-    $options = array(
-      'params' => array(
-        'width' => $settings['player_width'],
-        'height' => $settings['player_height'],
-        'allowfullscreen' => TRUE,
-        'wmode' => 'transparent'
+  if (module_exists('flowplayer')) {
+    $config = array(
+      'clip' => array(
+        'url' => $video_url,
+        'autoPlay' => $settings['autoplay'], // Turn autoplay off
       ),
-      'othervars' => $othervars,
     );
-    $output = swf($video_url, $options);
-  }
+    $attributes = array('style' => 
+        'width:' . $settings['player_width'] . 'px;' . 
+        'height:' . $settings['player_width'] . 'px;'
+    );
+    $output = theme('flowplayer',  array('config' => $config,'id' => md5($video_url), 'attributes' => $attributes));
+   }
 
   return $output;
 }
@@ -1022,7 +1059,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 +1083,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 +1106,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 +1132,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'] . '">';
