diff --git a/js/plugin.js b/js/plugin.js
index 01c8149..12b60f7 100644
--- a/js/plugin.js
+++ b/js/plugin.js
@@ -1,43 +1,28 @@
 CKEDITOR.plugins.add( 'geshi',
 {
-	requires : [ 'styles', 'button' ],
+  requires: [ 'styles', 'button' ],
 
-	init : function( editor )
-	{
-		// All buttons use the same code to register. So, to avoid
-		// duplications, let's use this tool function.
-		var addButtonCommand = function( buttonName, buttonLabel, commandName, styleDefiniton )
-		{
-			var style = new CKEDITOR.style( styleDefiniton );
+  init : function( editor ) {
+    // All buttons use the same code to register. So, to avoid
+    // duplications, let's use this tool function.
+    var addButtonCommand = function( buttonName, buttonLabel, commandName, styleDefiniton ) {
+      var style = new CKEDITOR.style( styleDefiniton );
 
-			editor.attachStyleStateChange( style, function( state )
-				{
-					editor.getCommand( commandName ).setState( state );
-				});
+      editor.attachStyleStateChange( style, function( state ) {
+        editor.getCommand( commandName ).setState( state );
+      });
 
-			editor.addCommand( commandName, new CKEDITOR.styleCommand( style ) );
+      editor.addCommand( commandName, new CKEDITOR.styleCommand( style ));
 
-			editor.ui.addButton( buttonName,
-				{
-					label : buttonLabel,
-					command : commandName
-				});
-		};
+      editor.ui.addButton( buttonName, {
+        label : buttonLabel,
+        command : commandName
+      });
+    };
 
-		var config = editor.config;
-//		var lang = editor.lang;
-
-		addButtonCommand( 'Geshi-code'		, 'code'		, 'Geshi-code'	, config.coreStyles_code );
-		addButtonCommand( 'Geshi-php'		, 'php'			, 'Geshi-php'		, config.coreStyles_php );
-		addButtonCommand( 'Geshi-bash'		, 'bash'		, 'Geshi-bash'	, config.coreStyles_bash );
-		addButtonCommand( 'Geshi-html'		, 'html'		, 'Geshi-html'		, config.coreStyles_html );
-		addButtonCommand( 'Geshi-css'		, 'css'			, 'Geshi-css'	, config.coreStyles_css );
-	}
+    // add buttons for all active geshi filters
+    for (var filter in Drupal.settings.wysiwygGeshi) {
+      addButtonCommand(filter, Drupal.settings.wysiwygGeshi[filter].label, filter, Drupal.settings.wysiwygGeshi[filter].settings);
+    }
+  }
 });
-
-// Basic Inline Styles.
-CKEDITOR.config.coreStyles_code			= { element : 'pre' };
-CKEDITOR.config.coreStyles_php			= { element : 'pre', attributes : { 'language' : 'php' } };
-CKEDITOR.config.coreStyles_bash			= { element : 'pre', attributes : { 'language' : 'bash' } };
-CKEDITOR.config.coreStyles_html			= { element : 'pre', attributes : { 'language' : 'html4strict' } };
-CKEDITOR.config.coreStyles_css			= { element : 'pre', attributes : { 'language' : 'css' } };
diff --git a/wysiwyg_geshi.info b/wysiwyg_geshi.info
index d229d00..9b2ff69 100644
--- a/wysiwyg_geshi.info
+++ b/wysiwyg_geshi.info
@@ -1,7 +1,6 @@
-name = "WYSIWYG - GeSHi bridge"
-description = "Bridge between the WYSIWYG module and the GeSHi Filter for syntax highlighting module."
-core = 6.x
-package = Views
+name = WYSIWYG - GeSHi bridge
+description = Bridge between the WYSIWYG module and the GeSHi Filter syntax highlighting module.
+core = 7.x
+package = Filters
 dependencies[] = wysiwyg
 dependencies[] = geshifilter
-package = Filters
\ No newline at end of file
diff --git a/wysiwyg_geshi.module b/wysiwyg_geshi.module
index 7dc0f48..d0abdaa 100644
--- a/wysiwyg_geshi.module
+++ b/wysiwyg_geshi.module
@@ -1,30 +1,92 @@
 <?php
-// wysiwyg_geshi.module
+/**
+ * @file
+ * Bridge between the WYSIWYG module and the GeSHi Filter syntax highlighting
+ * module.
+ */
+
+/* --- HOOKS ---------------------------------------------------------------- */
+
+/**
+ * Implements hook_wysiwyg_plugin().
+ */
 function wysiwyg_geshi_wysiwyg_plugin($editor, $version) {
-  switch ($editor) {
-    case 'ckeditor':
-        drupal_add_css(drupal_get_path('module', 'wysiwyg_geshi') .'/ckeditor/wysiwyg_geshi_ckeditor.css');
-        return array(
-          'geshi' => array(
-            'url' => 'http://drupal.org/project/wysiwyg-geshi',
-            'path' => drupal_get_path('module', 'wysiwyg_geshi') . '/ckeditor/plugin.js',
-            'buttons' => array(
-              'Geshi-code' => t('Geshi-code'),
-              'Geshi-php' => t('Geshi-php'),
-              'Geshi-bash' => t('Geshi-bash'),
-              'Geshi-html' => t('Geshi-html'),
-              'Geshi-css' => t('Geshi-css'),
-            ),
-            'options' => array(
-               'coreStyles_code' => array('element' => 'pre'),
-               'coreStyles_php' => array('element' => 'pre', 'attributes' => array('language' => 'php')),
-               'coreStyles_bash' => array('element' => 'pre', 'attributes' => array('language' => 'bash')),
-               'coreStyles_html' => array('element' => 'pre', 'attributes' => array('language' => 'html4strict')),
-               'coreStyles_css' => array('element' => 'pre', 'attributes' => array('language' => 'css')),
-            ),
-            'load' => TRUE,
+  if ('ckeditor' == $editor) {
+    module_load_include('inc', 'geshifilter');
+    $languages = _geshifilter_get_available_languages();
+
+    $buttons = _wysiwyg_geshi_get_buttons($languages);
+    $settings = _wysiwyg_geshi_get_settings($languages);
+
+    $css = _wysiwyg_geshi_get_css(array_keys($buttons));
+
+    drupal_add_css($css, 'inline');
+    drupal_add_js(array('wysiwygGeshi' => $settings), 'setting');
+
+    return array(
+      'geshi' => array(
+        'path' => drupal_get_path('module', 'wysiwyg_geshi') . '/js',
+        'buttons' => $buttons,
+        'load' => TRUE,
+      ),
+    );
+  }
+}
+
+/* --- UTILITY -------------------------------------------------------------- */
+
+/**
+ * Returns wysiwyg buttons based on the enabled GeSHi filters.
+ */
+function _wysiwyg_geshi_get_buttons($languages) {
+  $buttons = array();
+
+  foreach ($languages as $index => $language) {
+    if (variable_get('geshifilter_language_enabled_' . $index, FALSE)) {
+      $buttons['Geshi-' . $index] = 'Geshi: ' . $language['fullname'];
+    }
+  }
+
+  return $buttons;
+}
+
+/**
+ * Returns wysiwyg settings based on the enabled GeSHi filters.
+ */
+function _wysiwyg_geshi_get_settings($languages) {
+  $settings = array();
+
+  foreach ($languages as $index => $language) {
+    if (variable_get('geshifilter_language_enabled_' . $index, FALSE)) {
+      $settings['Geshi-' . $index] = array(
+        'label' => $index,
+        'settings' => array(
+          'element' => 'pre',
+          'attributes' => array(
+            'language' => $index,
           ),
-        );
-      break;
+        ),
+      );
+    }
+  }
+
+  return $settings;
+}
+
+/**
+ * Returns wysiwyg css based on the enabled GeSHi filters.
+ */
+function _wysiwyg_geshi_get_css($keys) {
+  $css = '';
+
+  $icons = $labels = array();
+  foreach ($keys as $key) {
+    $icons[] = '.cke_skin_kama .cke_button_' . $key . ' span.cke_icon';
+    $labels[] = '.cke_skin_kama .cke_button_' . $key . ' span.cke_label';
   }
-}
\ No newline at end of file
+
+  $css .= implode(', ', $icons) . '{display: none !important;}';
+  $css .= implode(', ', $labels) . '{display: inline;}';
+
+  return $css;
+}
