Index: wp-content/themes/classic/functions.php
===================================================================
--- wp-content/themes/classic/functions.php	(revision 12390)
+++ wp-content/themes/classic/functions.php	(working copy)
@@ -7,11 +7,6 @@
 automatic_feed_links();
 
 if ( function_exists('register_sidebar') )
-	register_sidebar(array(
-		'before_widget' => '<li id="%1$s" class="widget %2$s">',
-		'after_widget' => '</li>',
-		'before_title' => '',
-		'after_title' => '',
-	));
+	register_sidebar();
 
 ?>
Index: wp-content/themes/default/functions.php
===================================================================
--- wp-content/themes/default/functions.php	(revision 12390)
+++ wp-content/themes/default/functions.php	(working copy)
@@ -9,12 +9,7 @@
 automatic_feed_links();
 
 if ( function_exists('register_sidebar') ) {
-	register_sidebar(array(
-		'before_widget' => '<li id="%1$s" class="widget %2$s">',
-		'after_widget' => '</li>',
-		'before_title' => '<h2 class="widgettitle">',
-		'after_title' => '</h2>',
-	));
+	register_sidebar();
 }
 
 /** @ignore */
Index: wp-includes/bookmark-template.php
===================================================================
--- wp-includes/bookmark-template.php	(revision 12390)
+++ wp-includes/bookmark-template.php	(working copy)
@@ -251,4 +251,56 @@
 	echo $output;
 }
 
+/**
+ * 
+ * @param $args
+ * @return unknown_type
+ */
+function wp_list_bookmarks_widget($args = '') {
+	$defaults = array(
+		'orderby' => 'name', 'order' => 'ASC',
+		'limit' => -1, 'category' => '', 'exclude_category' => '',
+		'category_name' => '', 'hide_invisible' => 1,
+		'show_updated' => 0, 'echo' => 1,
+		'categorize' => 1, 'title_li' => __('Bookmarks'),
+		'title_before' => '<h2>', 'title_after' => '</h2>',
+		'category_orderby' => 'name', 'category_order' => 'ASC',
+		'class' => 'linkcat', 'category_before' => '<li id="%id" class="%class">',
+		'category_after' => '</li>'
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	$output = '';
+
+	if ( $categorize ) {
+		$cats = get_terms('link_category', array('name__like' => $category_name, 'include' => $category, 'exclude' => $exclude_category, 'orderby' => $category_orderby, 'order' => $category_order, 'hierarchical' => 0));
+
+		foreach ( (array) $cats as $cat ) {
+			$params = array_merge($r, array('category' => $cat->term_id));
+			$bookmarks = get_bookmarks($params);
+			if ( empty($bookmarks) )
+				continue;
+			
+			$bookmarks_output[] = array( 
+				'title' => apply_filters( "link_category", $cat->name ),
+				'output' => _walk_bookmarks($bookmarks, $r)
+			);
+			
+		}
+		
+	} else {
+		$bookmarks = get_bookmarks($r);
+		if ( !empty($bookmarks) ) {
+			$bookmarks_output[] = array( 
+				'title' => apply_filters( "link_category", $cat->name ), 
+				'output' => _walk_bookmarks($bookmarks, $r)
+			);
+		}
+	}
+	
+	return $bookmarks_output;
+}
+
 ?>
Index: wp-includes/default-widgets.php
===================================================================
--- wp-includes/default-widgets.php	(revision 12390)
+++ wp-includes/default-widgets.php	(working copy)
@@ -24,24 +24,30 @@
 
 		$title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title']);
 		$sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
+		$walker = empty( $instance['walker'] ) ? '' : $instance['walker'];
 		$exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];
 
 		if ( $sortby == 'menu_order' )
 			$sortby = 'menu_order, post_title';
-
-		$out = wp_list_pages( apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) );
-
-		if ( !empty( $out ) ) {
-			echo $before_widget;
-			if ( $title)
-				echo $before_title . $title . $after_title;
-		?>
-		<ul>
-			<?php echo $out; ?>
-		</ul>
-		<?php
-			echo $after_widget;
-		}
+		
+		if (  !empty( $walker ) )
+			$page_walker = new $walker;
+			
+		$pages_array = array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude, 'walker' => $page_walker);
+		$output = wp_list_pages( apply_filters('widget_pages_args', $pages_array ) );
+		
+		$widget_design = apply_filters( 'widget_design', new Widget_Basic, $args);
+		$widget_array = array(
+			'title'			=> apply_filters('widget_title', $title, $args),
+			'before_output'	=> "<ul>",
+			'output'		=> $output,
+			'after_output'	=> "</ul>",
+			'style'			=> "li"
+		);
+		$widget_args = array(array_merge($args, $widget_array));
+		
+		echo call_user_func_array( array(&$widget_design, 'display'), $widget_args );	
+		
 	}
 
 	function update( $new_instance, $old_instance ) {
@@ -52,7 +58,8 @@
 		} else {
 			$instance['sortby'] = 'menu_order';
 		}
-
+		
+		$instance['walker'] = strip_tags( $new_instance['walker'] );
 		$instance['exclude'] = strip_tags( $new_instance['exclude'] );
 
 		return $instance;
@@ -60,8 +67,9 @@
 
 	function form( $instance ) {
 		//Defaults
-		$instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '') );
+		$instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'walker' => '', 'exclude' => '') );
 		$title = esc_attr( $instance['title'] );
+		$walker = esc_attr( $instance['walker'] );
 		$exclude = esc_attr( $instance['exclude'] );
 	?>
 		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
@@ -74,6 +82,9 @@
 			</select>
 		</p>
 		<p>
+			<label for="<?php echo $this->get_field_id('walker'); ?>"><?php _e( 'Walker:' ); ?></label> <input type="text" value="<?php echo $walker; ?>" name="<?php echo $this->get_field_name('walker'); ?>" id="<?php echo $this->get_field_id('walker'); ?>" class="widefat" />
+			<br />
+			<small><?php _e( 'Customer Walker' ); ?></small>
 			<label for="<?php echo $this->get_field_id('exclude'); ?>"><?php _e( 'Exclude:' ); ?></label> <input type="text" value="<?php echo $exclude; ?>" name="<?php echo $this->get_field_name('exclude'); ?>" id="<?php echo $this->get_field_id('exclude'); ?>" class="widefat" />
 			<br />
 			<small><?php _e( 'Page IDs, separated by commas.' ); ?></small>
@@ -109,15 +120,24 @@
 			echo $before_widget . $before_title. __('All Links') . $after_title . $after_widget;
 			return;
 		}
-
-		$before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);
-		wp_list_bookmarks(apply_filters('widget_links_args', array(
-			'title_before' => $before_title, 'title_after' => $after_title,
-			'category_before' => $before_widget, 'category_after' => $after_widget,
+		
+		$links_data = wp_list_bookmarks_widget(apply_filters('widget_links_args', array(
+			'title_before' => '', 'title_after' => '', 'category_before' => '', 'category_after' => '',
 			'show_images' => $show_images, 'show_description' => $show_description,
 			'show_name' => $show_name, 'show_rating' => $show_rating,
 			'category' => $category, 'class' => 'linkcat widget'
 		)));
+		$widget_design = apply_filters( 'widget_design', new Widget_Basic, $args);
+		$widget_default_array = array('style' => 'li', 'before_output' => '<ul class="xoxo blogroll">', 'after_output' => '</ul>');
+		
+		foreach ($links_data as $links) {
+			$widget_array[] = array_merge($links, $widget_default_array);
+		}
+		
+		foreach ($widget_array as $widget_display) {
+			echo call_user_func_array( array(&$widget_design, 'display'), array(array_merge($args, $widget_display)) );
+		}
+		
 	}
 
 	function update( $new_instance, $old_instance ) {
@@ -178,16 +198,18 @@
 
 	function widget( $args, $instance ) {
 		extract($args);
-		$title = apply_filters('widget_title', $instance['title']);
+		$title = apply_filters( 'widget_title', $instance['title'], $args);
 
-		echo $before_widget;
-		if ( $title )
-			echo $before_title . $title . $after_title;
+		$widget_design = apply_filters( 'widget_design', new Widget_Search, $args);
+		$widget_array = array(
+			'title'			=> $title,
+			'output'		=> get_search_form(false),
+			'style'			=> "none"
+		);
+		$widget_args = array(array_merge($args, $widget_array));
+		
+		echo call_user_func_array( array(&$widget_design, 'display'), $widget_args );
 
-		// Use current theme search form if it exists
-		get_search_form();
-
-		echo $after_widget;
 	}
 
 	function form( $instance ) {
@@ -213,7 +235,9 @@
  * @since 2.8.0
  */
 class WP_Widget_Archives extends WP_Widget {
-
+	
+	// @todo Add other options, day(s), month, 
+	
 	function WP_Widget_Archives() {
 		$widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your blog&#8217;s posts') );
 		$this->WP_Widget('archives', __('Archives'), $widget_ops);
@@ -223,25 +247,26 @@
 		extract($args);
 		$c = $instance['count'] ? '1' : '0';
 		$d = $instance['dropdown'] ? '1' : '0';
-		$title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title']);
-
-		echo $before_widget;
-		if ( $title )
-			echo $before_title . $title . $after_title;
-
+		$title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title'], $args);
+		
 		if ( $d ) {
-?>
-		<select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo esc_attr(__('Select Month')); ?></option> <?php wp_get_archives(apply_filters('widget_archives_dropdown_args', array('type' => 'monthly', 'format' => 'option', 'show_post_count' => $c))); ?> </select>
-<?php
+			$output = "<select name=\"archive-dropdown\" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=\"\">". esc_attr(__('Select Month')) . "</option>" . wp_get_archives(apply_filters('widget_archives_dropdown_args', array('echo' => 0, 'type' => 'monthly', 'format' => 'option', 'show_post_count' => $c))) . "</select>";
 		} else {
-?>
-		<ul>
-		<?php wp_get_archives(apply_filters('widget_archives_args', array('type' => 'monthly', 'show_post_count' => $c))); ?>
-		</ul>
-<?php
+			$output = wp_get_archives(apply_filters('widget_archives_args', array('echo' => 0, 'type' => 'monthly', 'show_post_count' => $c)));
 		}
-
-		echo $after_widget;
+		
+		$widget_design = apply_filters( 'widget_design', new Widget_Basic, $args);
+		$widget_array = array(
+			'title'			=> $title,
+			'before_output'	=> "<ul>",
+			'output'		=> $output,
+			'after_output'	=> "</ul>",
+			'style'			=> "li"
+		);
+		$widget_args = array(array_merge($args, $widget_array));
+		
+		echo call_user_func_array( array(&$widget_design, 'display'), $widget_args );
+		
 	}
 
 	function update( $new_instance, $old_instance ) {
@@ -286,22 +311,19 @@
 
 	function widget( $args, $instance ) {
 		extract($args);
-		$title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title']);
-
-		echo $before_widget;
-		if ( $title )
-			echo $before_title . $title . $after_title;
-?>
-			<ul>
-			<?php wp_register(); ?>
-			<li><?php wp_loginout(); ?></li>
-			<li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo esc_attr(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
-			<li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php echo esc_attr(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
-			<li><a href="http://wordpress.org/" title="<?php echo esc_attr(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org</a></li>
-			<?php wp_meta(); ?>
-			</ul>
-<?php
-		echo $after_widget;
+		$title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title'], $args);
+		
+		$widget_design = apply_filters( 'widget_design', new Widget_Basic, $args);
+		$widget_array = array(
+			'title'			=> $title,
+			'before_output'	=> "<ul>",
+			'output'		=> "<li>" . wp_register('', '', false) . "</li><li>" . wp_loginout('', false) . "</li><li><a href='". get_bloginfo('rss2_url') . "' title='". __('Syndicate this site using RSS 2.0') . "'>" . __('Entries <abbr title="Really Simple Syndication">RSS</abbr>') . "</a></li><li><a href='" . get_bloginfo('comments_rss2_url') . "' title='" . __('The latest comments to all posts in RSS') . "'>" . __('Comments <abbr title="Really Simple Syndication">RSS</abbr>') . "</a></li><li><a href='http://wordpress.org/' title='" . __('Powered by WordPress, state-of-the-art semantic personal publishing platform.') . "'>WordPress.org</a></li>" . wp_meta(),
+			'after_output'	=> "</ul>",
+		);
+		$widget_args = array(array_merge($args, $widget_array));
+		
+		echo call_user_func_array( array(&$widget_design, 'display'), $widget_args );
+		
 	}
 
 	function update( $new_instance, $old_instance ) {
@@ -334,14 +356,20 @@
 
 	function widget( $args, $instance ) {
 		extract($args);
-		$title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
-		echo $before_widget;
-		if ( $title )
-			echo $before_title . $title . $after_title;
-		echo '<div id="calendar_wrap">';
-		get_calendar();
-		echo '</div>';
-		echo $after_widget;
+		$title = apply_filters('widget_title', empty($instance['title']) ? __('Calendar') : $instance['title'], $args);
+		
+		$widget_design = apply_filters( 'widget_design', new Widget_Basic, $args);
+		$widget_array = array(
+			'title'			=> $title,
+			'before_output'	=> "<div id='calendar_wrap'>",
+			'output'		=> get_calendar(true, false),
+			'after_output'	=> "</div>",
+			'style'			=> "none"
+		);
+		$widget_args = array(array_merge($args, $widget_array));
+		
+		echo call_user_func_array( array(&$widget_design, 'display'), $widget_args );
+
 	}
 
 	function update( $new_instance, $old_instance ) {
@@ -378,11 +406,19 @@
 		extract($args);
 		$title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance );
 		$text = apply_filters( 'widget_text', $instance['text'], $instance );
-		echo $before_widget;
-		if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
-			<div class="textwidget"><?php echo $instance['filter'] ? wpautop($text) : $text; ?></div>
-		<?php
-		echo $after_widget;
+		
+		$widget_design = apply_filters( 'widget_design', new Widget_Basic, $args);
+		$widget_array = array(
+			'title'			=> $title,
+			'before_output'	=> "<div class='textwidget'>",
+			'output'		=> $instance['filter'] ? wpautop($text) : $text,
+			'after_output'	=> "</div>",
+			'style'			=> "none"
+		);
+		$widget_args = array(array_merge($args, $widget_array));
+		
+		echo call_user_func_array( array(&$widget_design, 'display'), $widget_args );
+
 	}
 
 	function update( $new_instance, $old_instance ) {
@@ -426,47 +462,50 @@
 	function widget( $args, $instance ) {
 		extract( $args );
 
-		$title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title']);
+		$title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $args);
 		$c = $instance['count'] ? '1' : '0';
 		$h = $instance['hierarchical'] ? '1' : '0';
 		$d = $instance['dropdown'] ? '1' : '0';
+		$walker = empty( $instance['walker'] ) ? '' : $instance['walker'];
+		
+		if (  !empty( $walker ) )
+			$cat_walker = new $walker;
+		
+		$cat_args = array('echo' => 0, 'orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h, 'walker' => $cat_walker);
 
-		echo $before_widget;
-		if ( $title )
-			echo $before_title . $title . $after_title;
-
-		$cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);
-
 		if ( $d ) {
 			$cat_args['show_option_none'] = __('Select Category');
-			wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args));
-?>
+			$widget_opt_array = array('style' => "none");
+			$output .= wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args));
+			$output .= "<script type='text/javascript'>
+			/* <![CDATA[ */
+				var dropdown = document.getElementById(\"cat\");
+				function onCatChange() {
+					if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
+						location.href = \"" . get_option('home') . "/?cat=\"+dropdown.options[dropdown.selectedIndex].value;
+					}
+				}
+				dropdown.onchange = onCatChange;
+			/* ]]> */
+			</script>";
 
-<script type='text/javascript'>
-/* <![CDATA[ */
-	var dropdown = document.getElementById("cat");
-	function onCatChange() {
-		if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
-			location.href = "<?php echo get_option('home'); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
-		}
-	}
-	dropdown.onchange = onCatChange;
-/* ]]> */
-</script>
-
-<?php
 		} else {
-?>
-		<ul>
-<?php
-		$cat_args['title_li'] = '';
-		wp_list_categories(apply_filters('widget_categories_args', $cat_args));
-?>
-		</ul>
-<?php
+				
+			$cat_args['title_li'] = '';
+			$widget_opt_array = array('before_output' => "<ul>", 'after_output' => "</ul>", 'style' => "li");
+			$output = wp_list_categories(apply_filters('widget_categories_args', $cat_args));
+			
 		}
 
-		echo $after_widget;
+		$widget_design = apply_filters( 'widget_design', new Widget_Basic, $args);
+		$widget_array = array(
+			'title'			=> $title,
+			'output'		=> $output
+		);
+		$widget_args = array(array_merge($args, array_merge($widget_array, $widget_opt_array)));
+		
+		echo call_user_func_array( array(&$widget_design, 'display'), $widget_args );
+		
 	}
 
 	function update( $new_instance, $old_instance ) {
@@ -475,17 +514,19 @@
 		$instance['count'] = $new_instance['count'] ? 1 : 0;
 		$instance['hierarchical'] = $new_instance['hierarchical'] ? 1 : 0;
 		$instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0;
+		$instance['walker'] = strip_tags( $new_instance['walker'] );
 
 		return $instance;
 	}
 
 	function form( $instance ) {
 		//Defaults
-		$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
+		$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'walker' => '') );
 		$title = esc_attr( $instance['title'] );
 		$count = isset($instance['count']) ? (bool) $instance['count'] :false;
 		$hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;
 		$dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false;
+		$walker = esc_attr( $instance['walker'] );
 ?>
 		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?></label>
 		<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
@@ -497,7 +538,12 @@
 		<label for="<?php echo $this->get_field_id('count'); ?>"><?php _e( 'Show post counts' ); ?></label><br />
 
 		<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hierarchical'); ?>" name="<?php echo $this->get_field_name('hierarchical'); ?>"<?php checked( $hierarchical ); ?> />
-		<label for="<?php echo $this->get_field_id('hierarchical'); ?>"><?php _e( 'Show hierarchy' ); ?></label></p>
+		<label for="<?php echo $this->get_field_id('hierarchical'); ?>"><?php _e( 'Show hierarchy' ); ?></label>
+		
+		<br /><br />
+		<label for="<?php echo $this->get_field_id('walker'); ?>"><?php _e( 'Walker:' ); ?></label> <input type="text" value="<?php echo $walker; ?>" name="<?php echo $this->get_field_name('walker'); ?>" id="<?php echo $this->get_field_id('walker'); ?>" class="widefat" />
+		<br />
+		<small><?php _e( 'Customer Walker' ); ?></small></p>
 <?php
 	}
 
@@ -534,7 +580,7 @@
 		ob_start();
 		extract($args);
 
-		$title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title']);
+		$title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $args);
 		if ( !$number = (int) $instance['number'] )
 			$number = 10;
 		else if ( $number < 1 )
@@ -543,22 +589,33 @@
 			$number = 15;
 
 		$r = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1));
+		
 		if ($r->have_posts()) :
-?>
-		<?php echo $before_widget; ?>
-		<?php if ( $title ) echo $before_title . $title . $after_title; ?>
-		<ul>
-		<?php  while ($r->have_posts()) : $r->the_post(); ?>
-		<li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?> </a></li>
-		<?php endwhile; ?>
-		</ul>
-		<?php echo $after_widget; ?>
-<?php
+		
+			while ($r->have_posts()) {
+				$r->the_post();
+				$posts_output .= "<li><a href='" . get_permalink() . "' title='" . esc_attr(get_the_title() ? get_the_title() : get_the_ID()) . "'>" .  ( ( get_the_title() ) ? get_the_title() : the_ID() ) . "</a></li>";
+			}
+			
 			wp_reset_query();  // Restore global post data stomped by the_post().
+		
 		endif;
 
+		$widget_design = apply_filters( 'widget_design', new Widget_Recent_Posts, $args);
+		$widget_array = array(
+			'title'			=> $title,
+			'before_output'	=> "<ul>",
+			'output'		=> $posts_output,
+			'after_output'	=> "</ul>",
+			'style'			=> "li"
+		);
+		$widget_args = array(array_merge($args, $widget_array));
+		
+		echo call_user_func_array( array(&$widget_design, 'display'), $widget_args );
+		
 		$cache[$args['widget_id']] = ob_get_flush();
 		wp_cache_add('widget_recent_posts', $cache, 'widget');
+		
 	}
 
 	function update( $new_instance, $old_instance ) {
@@ -625,7 +682,7 @@
 		global $wpdb, $comments, $comment;
 
 		extract($args, EXTR_SKIP);
-		$title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Comments') : $instance['title']);
+		$title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Comments') : $instance['title'], $args);
 		if ( !$number = (int) $instance['number'] )
 			$number = 5;
 		else if ( $number < 1 )
@@ -639,15 +696,23 @@
 		}
 
 		$comments = array_slice( (array) $comments, 0, $number );
-?>
-		<?php echo $before_widget; ?>
-			<?php if ( $title ) echo $before_title . $title . $after_title; ?>
-			<ul id="recentcomments"><?php
-			if ( $comments ) : foreach ( (array) $comments as $comment) :
-			echo  '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
-			endforeach; endif;?></ul>
-		<?php echo $after_widget; ?>
-<?php
+		
+		if ( $comments ) : foreach ( (array) $comments as $comment) :
+			$comments_output .=  '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
+		endforeach; endif;
+		
+		$widget_design = apply_filters( 'widget_design', new Widget_Basic, $args);
+		$widget_array = array(
+			'title'			=> $title,
+			'before_output'	=> "<ul id='recentcomments'>",
+			'output'		=> $comments_output,
+			'after_output'	=> "</ul>",
+			'style'			=> "li"
+		);
+		$widget_args = array(array_merge($args, $widget_array));
+		
+		echo call_user_func_array( array(&$widget_design, 'display'), $widget_args );
+		
 	}
 
 	function update( $new_instance, $old_instance ) {
@@ -720,18 +785,26 @@
 
 		if ( empty($title) )
 			$title = empty($desc) ? __('Unknown Feed') : $desc;
-
-		$title = apply_filters('widget_title', $title );
+		
+		$title = apply_filters('widget_title', $title, $args );
 		$url = esc_url(strip_tags($url));
 		$icon = includes_url('images/rss.png');
 		if ( $title )
 			$title = "<a class='rsswidget' href='$url' title='" . esc_attr(__('Syndicate this content')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>";
-
-		echo $before_widget;
-		if ( $title )
-			echo $before_title . $title . $after_title;
-		wp_widget_rss_output( $rss, $instance );
-		echo $after_widget;
+		
+		$widget_design = apply_filters( 'widget_design', new Widget_Basic, $args);
+		$widget_func_array = array_merge($instance, array('echo' => 0));
+		$widget_array = array(
+			'title'			=> $title,
+			'before_output'	=> "<ul>",
+			'output'		=> wp_widget_rss_output( $rss, $widget_func_array ),
+			'after_output'	=> "</ul>",
+			'style'			=> "li"
+		);
+		$widget_args = array(array_merge($args, $widget_array));
+		
+		echo call_user_func_array( array(&$widget_design, 'display'), $widget_args );
+		
 		$rss->__destruct(); 
 		unset($rss);
 	}
@@ -760,6 +833,9 @@
  * @param array $args Widget arguments.
  */
 function wp_widget_rss_output( $rss, $args = array() ) {
+	
+	$rss_items = '';
+	
 	if ( is_string( $rss ) ) {
 		$rss = fetch_feed($rss);
 	} elseif ( is_array($rss) && isset($rss['url']) ) {
@@ -771,11 +847,11 @@
 
 	if ( is_wp_error($rss) ) {
 		if ( is_admin() || current_user_can('manage_options') )
-			echo '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
+			$rss_items .= '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
 		return;
 	}
 
-	$default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0 );
+	$default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'echo' => 1 );
 	$args = wp_parse_args( $args, $default_args );
 	extract( $args, EXTR_SKIP );
 
@@ -787,13 +863,12 @@
 	$show_date     = (int) $show_date;
 
 	if ( !$rss->get_item_quantity() ) {
-		echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>';
+		$rss_items .= '<li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li>';
 		$rss->__destruct(); 
 		unset($rss);
 		return;
 	}
 
-	echo '<ul>';
 	foreach ( $rss->get_items(0, $items) as $item ) {
 		$link = $item->get_link();
 		while ( stristr($link, 'http') != $link )
@@ -835,12 +910,17 @@
 		}
 
 		if ( $link == '' ) {
-			echo "<li>$title{$date}{$summary}{$author}</li>";
+			$rss_items .= "<li>$title{$date}{$summary}{$author}</li>";
 		} else {
-			echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";
+			$rss_items .= "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";
 		}
 	}
-	echo '</ul>';
+	
+	if ( $echo )
+		echo $rss_items;
+	else
+		return $rss_items;
+	
 	$rss->__destruct(); 
 	unset($rss);
 }
@@ -974,15 +1054,20 @@
 
 	function widget( $args, $instance ) {
 		extract($args);
-		$title = apply_filters('widget_title', empty($instance['title']) ? __('Tags') : $instance['title']);
+		$title = apply_filters('widget_title', empty($instance['title']) ? __('Tags') : $instance['title'], $args);
 
-		echo $before_widget;
-		if ( $title )
-			echo $before_title . $title . $after_title;
-		echo '<div>';
-		wp_tag_cloud(apply_filters('widget_tag_cloud_args', array()));
-		echo "</div>\n";
-		echo $after_widget;
+		$widget_design = apply_filters( 'widget_design', new Widget_Basic, $args);
+		$widget_array = array(
+			'title'			=> $title,
+			'before_output'	=> "<div>",
+			'output'		=> wp_tag_cloud(apply_filters('widget_tag_cloud_args', array('echo' => 0))),
+			'after_output'	=> "</div>",
+			'style'			=> "none"
+		);
+		$widget_args = array(array_merge($args, $widget_array));
+		
+		echo call_user_func_array( array(&$widget_design, 'display'), $widget_args );
+		
 	}
 
 	function update( $new_instance, $old_instance ) {
@@ -998,6 +1083,91 @@
 	}
 }
 
+class Walker_Widget {
+	
+	function start_widget($args, &$output) 	{}
+	
+	function end_widget($args, &$output) 		{}
+	
+	function title_widget($args, &$output) 	{}
+	
+	function content_widget($args, &$output) 	{}
+
+	function display( $args = array() ) {
+		$output = '';
+		call_user_func_array( array(&$this, 'start_widget'),	array($args, &$output) );
+		call_user_func_array( array(&$this, 'title_widget'),	array($args, &$output) );
+		call_user_func_array( array(&$this, 'content_widget'),	array($args, &$output) );
+		call_user_func_array( array(&$this, 'end_widget'), 		array($args, &$output) );
+		return $output;
+	}
+	
+}
+
+class Widget_Basic extends Walker_Widget {
+	
+	function start_widget($args, &$output) {
+		$output .= sprintf( __("<li id='%s' class='widget %s'>"), $args['widget_id'], $args['classname'] );	
+	}
+	
+	function title_widget($args, &$output) {
+		$output .= "<h2>" . $args['title'] . "</h2>";
+	}
+		
+	function content_widget($args, &$output) {
+		$output .= $args['before_output'] . $args['output'] . $args['after_output'];
+	}
+	
+	function end_widget($args, &$output) {
+		$output .= "</li>";
+	}
+	
+}
+
+class Widget_Tag_Cloud extends Walker_Widget {
+	
+	function title_widget($args, &$output) {
+		$output .= "<h2>" . $args['title'] . "</h2>";
+	}
+		
+	function content_widget($args, &$output) {
+		$output .= $args['before_output'] . $args['output'] . $args['after_output'];
+	}
+	
+}
+
+class Widget_Search extends Walker_Widget {
+
+	function title_widget($args, &$output) {
+		$output .= $args['title'];
+	}
+		
+	function content_widget($args, &$output) {
+		$output .= $args['output'];
+	}
+	
+}
+
+class Widget_Recent_Posts extends Walker_Widget {
+	
+	function start_widget($args, &$output) {
+		$output .= sprintf( __("<li id='%s' class='widget %s'>"), $args['widget_id'], $args['classname'] );
+	}
+	
+	function title_widget($args, &$output) {
+		$output .= "<h2>" . $args['title'] . "</h2>";
+	}
+		
+	function content_widget($args, &$output) {
+		$output .= $args['before_output'] . $args['output'] . $args['after_output'];
+	}
+	
+	function end_widget($args, &$output) {
+		$output .= "</li>";
+	}
+	
+}
+
 /**
  * Register all of the default WordPress widgets on startup.
  *
Index: wp-includes/general-template.php
===================================================================
--- wp-includes/general-template.php	(revision 12390)
+++ wp-includes/general-template.php	(working copy)
@@ -112,7 +112,7 @@
  *
  * @since 2.7.0
  */
-function get_search_form() {
+function get_search_form($echo = true) {
 	do_action( 'get_search_form' );
 
 	$search_form_template = locate_template(array('searchform.php'));
@@ -128,7 +128,10 @@
 	</div>
 	</form>';
 
-	echo apply_filters('get_search_form', $form);
+	if ( $echo )
+		echo apply_filters('get_search_form', $form);
+	else
+		return apply_filters('get_search_form', $form);
 }
 
 /**
@@ -141,14 +144,18 @@
  * @uses apply_filters() Calls 'loginout' hook on HTML link content.
  *
  * @param string $redirect Optional path to redirect to on login/logout.
+ * @param boolean $echo Default to echo and not return the link.
  */
-function wp_loginout($redirect = '') {
+function wp_loginout($redirect = '', $echo = true) {
 	if ( ! is_user_logged_in() )
 		$link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
 	else
 		$link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
-
-	echo apply_filters('loginout', $link);
+	
+	if ( $echo )
+		echo apply_filters('loginout', $link);
+	else
+		return apply_filters('loginout', $link);
 }
 
 /**
@@ -228,8 +235,9 @@
  *
  * @param string $before Text to output before the link (defaults to <li>).
  * @param string $after Text to output after the link (defaults to </li>).
+ * @param boolean $echo Default to echo and not return the link.
  */
-function wp_register( $before = '<li>', $after = '</li>' ) {
+function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {
 
 	if ( ! is_user_logged_in() ) {
 		if ( get_option('users_can_register') )
@@ -239,8 +247,11 @@
 	} else {
 		$link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
 	}
-
-	echo apply_filters('register', $link);
+	
+	if ( $echo )
+		echo apply_filters('register', $link);
+	else
+		return apply_filters('register', $link);
 }
 
 /**
@@ -952,8 +963,9 @@
  * @since 1.0.0
  *
  * @param bool $initial Optional, default is true. Use initial calendar names.
+ * @param bool $echo Optional, default is true. Set to false for return.
  */
-function get_calendar($initial = true) {
+function get_calendar($initial = true, $echo = true) {
 	global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
 
 	$cache = array();
@@ -1024,7 +1036,7 @@
 
 	/* translators: Calendar caption: 1: month name, 2: 4-digit year */
 	$calendar_caption = _x('%1$s %2$s', 'calendar caption');
-	echo '<table id="wp-calendar" summary="' . esc_attr__('Calendar') . '">
+	$calendar_output .= '<table id="wp-calendar" summary="' . esc_attr__('Calendar') . '">
 	<caption>' . sprintf($calendar_caption, $wp_locale->get_month($thismonth), date('Y', $unixmonth)) . '</caption>
 	<thead>
 	<tr>';
@@ -1038,10 +1050,10 @@
 	foreach ( $myweek as $wd ) {
 		$day_name = (true == $initial) ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
 		$wd = esc_attr($wd);
-		echo "\n\t\t<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">$day_name</th>";
+		$calendar_output .= "\n\t\t<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">$day_name</th>";
 	}
 
-	echo '
+	$calendar_output .= '
 	</tr>
 	</thead>
 
@@ -1049,24 +1061,24 @@
 	<tr>';
 
 	if ( $previous ) {
-		echo "\n\t\t".'<td abbr="' . $wp_locale->get_month($previous->month) . '" colspan="3" id="prev"><a href="' .
+		$calendar_output .= "\n\t\t".'<td abbr="' . $wp_locale->get_month($previous->month) . '" colspan="3" id="prev"><a href="' .
 		get_month_link($previous->year, $previous->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($previous->month),
 			date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year))) . '">&laquo; ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>';
 	} else {
-		echo "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
+		$calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
 	}
 
-	echo "\n\t\t".'<td class="pad">&nbsp;</td>';
+	$calendar_output .= "\n\t\t".'<td class="pad">&nbsp;</td>';
 
 	if ( $next ) {
-		echo "\n\t\t".'<td abbr="' . $wp_locale->get_month($next->month) . '" colspan="3" id="next"><a href="' .
+		$calendar_output .= "\n\t\t".'<td abbr="' . $wp_locale->get_month($next->month) . '" colspan="3" id="next"><a href="' .
 		get_month_link($next->year, $next->month) . '" title="' . esc_attr( sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($next->month) ,
 			date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year))) ) . '">' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' &raquo;</a></td>';
 	} else {
-		echo "\n\t\t".'<td colspan="3" id="next" class="pad">&nbsp;</td>';
+		$calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad">&nbsp;</td>';
 	}
 
-	echo '
+	$calendar_output .= '
 	</tr>
 	</tfoot>
 
@@ -1118,24 +1130,24 @@
 	// See how much we should pad in the beginning
 	$pad = calendar_week_mod(date('w', $unixmonth)-$week_begins);
 	if ( 0 != $pad )
-		echo "\n\t\t".'<td colspan="'. esc_attr($pad) .'" class="pad">&nbsp;</td>';
+		$calendar_output .= "\n\t\t".'<td colspan="'. esc_attr($pad) .'" class="pad">&nbsp;</td>';
 
 	$daysinmonth = intval(date('t', $unixmonth));
 	for ( $day = 1; $day <= $daysinmonth; ++$day ) {
 		if ( isset($newrow) && $newrow )
-			echo "\n\t</tr>\n\t<tr>\n\t\t";
+			$calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t";
 		$newrow = false;
 
 		if ( $day == gmdate('j', (time() + (get_option('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_option('gmt_offset') * 3600)) && $thisyear == gmdate('Y', time()+(get_option('gmt_offset') * 3600)) )
-			echo '<td id="today">';
+			$calendar_output .= '<td id="today">';
 		else
-			echo '<td>';
+			$calendar_output .= '<td>';
 
 		if ( in_array($day, $daywithpost) ) // any posts today?
-				echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"" . esc_attr($ak_titles_for_day[$day]) . "\">$day</a>";
+				$calendar_output .= '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"" . esc_attr($ak_titles_for_day[$day]) . "\">$day</a>";
 		else
-			echo $day;
-		echo '</td>';
+			$calendar_output .= $day;
+		$calendar_output .= '</td>';
 
 		if ( 6 == calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins) )
 			$newrow = true;
@@ -1143,15 +1155,20 @@
 
 	$pad = 7 - calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins);
 	if ( $pad != 0 && $pad != 7 )
-		echo "\n\t\t".'<td class="pad" colspan="'. esc_attr($pad) .'">&nbsp;</td>';
+		$calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr($pad) .'">&nbsp;</td>';
 
-	echo "\n\t</tr>\n\t</tbody>\n\t</table>";
+	$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
 
 	$output = ob_get_contents();
 	ob_end_clean();
-	echo $output;
 	$cache[ $key ] = $output;
 	wp_cache_set( 'get_calendar', $cache, 'calendar' );
+
+	if ( $echo )
+		echo $calendar_output;
+	else
+		return $calendar_output;
+
 }
 
 /**
Index: wp-includes/widgets.php
===================================================================
--- wp-includes/widgets.php	(revision 12390)
+++ wp-includes/widgets.php	(working copy)
@@ -519,12 +519,6 @@
  * name - The name of the sidebar, which presumably the title which will be
  *     displayed.
  * id - The unique identifier by which the sidebar will be called by.
- * before_widget - The content that will prepended to the widgets when they are
- *     displayed.
- * after_widget - The content that will be appended to the widgets when they are
- *     displayed.
- * before_title - The content that will be prepended to the title when displayed.
- * after_title - the content that will be appended to the title when displayed.
  *
  * <em>Content</em> is assumed to be HTML and should be formatted as such, but
  * doesn't have to be.
@@ -548,11 +542,7 @@
 	$defaults = array(
 		'name' => sprintf(__('Sidebar %d'), $i ),
 		'id' => "sidebar-$i",
-		'description' => '',
-		'before_widget' => '<li id="%1$s" class="widget %2$s">',
-		'after_widget' => "</li>\n",
-		'before_title' => '<h2 class="widgettitle">',
-		'after_title' => "</h2>\n",
+		'description' => ''
 	);
 
 	$sidebar = array_merge($defaults, (array) $args);
@@ -873,7 +863,7 @@
 				$classname_ .= '_' . get_class($cn);
 		}
 		$classname_ = ltrim($classname_, '_');
-		$params[0]['before_widget'] = sprintf($params[0]['before_widget'], $id, $classname_);
+		$params[0]['classname'] = $classname_;
 
 		$params = apply_filters( 'dynamic_sidebar_params', $params );
 
@@ -1291,11 +1281,9 @@
 	$widget_obj = $wp_widget_factory->widgets[$widget];
 	if ( !is_a($widget_obj, 'WP_Widget') )
 		return;
-
-	$before_widget = sprintf('<div class="widget %s">', $widget_obj->widget_options['classname']);
-	$default_args = array('before_widget' => $before_widget, 'after_widget' => "</div>", 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>');
-
-	$args = wp_parse_args($args, $default_args);
+	
+	echo "when do we run?";
+		
 	$instance = wp_parse_args($instance);
 
 	$widget_obj->_set(-1);
