improved the plugin, fixed javascript bugs