Index: wp-includes/theme.php
===================================================================
--- wp-includes/theme.php	(revision 15184)
+++ wp-includes/theme.php	(working copy)
@@ -1535,57 +1535,34 @@
 function _custom_background_cb() {
 	$background = get_background_image();
 	$color = get_background_color();
-	if ( !$background && !$color )
+	if ( ! $background && ! $color )
 		return;
 
-	switch ( get_theme_mod('background_repeat', 'repeat') ) {
-		case 'no-repeat':
-			$repeat = 'background-repeat: no-repeat;';
-			break;
-		case 'repeat-x':
-			$repeat = 'background-repeat: repeat-x;';
-			break;
-		case 'repeat-y':
-			$repeat = 'background-repeat: repeat-y;';
-			break;
-		default:
-			$repeat = 'background-repeat: repeat;';
-	}
+	$style = $color ? "background-color: #$color;" : '';
 
-	switch ( get_theme_mod('background_position_x', 'left') ) {
-		case 'center':
-			$position = 'background-position: top center;';
-			break;
-		case 'right':
-			$position = 'background-position: top right;';
-			break;
-		default:
-			$position = 'background-position: top left;';
-	}
+	if ( $background ) {
+		$image = " background-image: url('$background');";
 
-	if ( 'scroll' == get_theme_mod('background_attachment', 'fixed') )
-		$attachment = 'background-attachment: scroll;';
-	else
-		$attachment = 'background-attachment: fixed;';
+		$repeat = get_theme_mod( 'background_repeat', 'repeat' );
+		if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )
+			$repeat = 'repeat';
+		$repeat = " background-repeat: $repeat;";
+	
+		$position = get_theme_mod( 'background_position_x', 'left' );
+		if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
+			$position = 'left';
+		$position = " background-position: top $position;";
+	
+		$attachment = get_theme_mod( 'background_attachment', 'scroll' );
+		if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
+			$attachment = 'scroll';
+		$attachment = " background-attachment: $attachment;";
 
-	if ( !empty($background ) )
-		$image = "background-image: url('$background');";
-	else
-		$image = '';
-
-	if ( !empty($color) )
-		$color = "background-color: #$color;";
-	else
-		$color = '';
+		$style .= $image . $repeat . $position . $attachment;
+	}
 ?>
 <style type="text/css">
-body {
-	<?php echo $image; ?>
-	<?php echo $color; ?>
-	<?php echo $repeat; ?>
-	<?php echo $position; ?>
-	<?php echo $attachment; ?>
-}
+body { <?php echo trim( $style ); ?> }
 </style>
 <?php
 }
Index: wp-content/themes/twentyten/functions.php
===================================================================
--- wp-content/themes/twentyten/functions.php	(revision 15184)
+++ wp-content/themes/twentyten/functions.php	(working copy)
@@ -190,35 +190,71 @@
 <style type="text/css">
 /* Shows the same border as on front end */
 #headimg {
-	border-bottom: 1px solid #000000;
-	border-top: 4px solid #000000;
+	border-bottom: 1px solid #000;
+	border-top: 4px solid #000;
 }
-
-/* If NO_HEADER_TEXT is false, you can style here the header text preview */
-#headimg #name {
-}
-
-#headimg #desc {
-}
+/* If NO_HEADER_TEXT is false, you would style the text with these selectors:
+	#headimg #name { }
+	#headimg #desc { }
+*/
 </style>
 <?php
 }
 endif;
 
-if ( ! function_exists( 'twentyten_the_page_number' ) ) :
 /**
- * Prints the page number currently being browsed, with a vertical bar before it.
+ * Makes some changes to the <title> tag, by filtering the output of wp_title().
  *
- * Used in Twenty Ten's header.php to add the page number to the <title> HTML tag.
+ * If we have a site description and we're viewing the home page or a blog posts
+ * page (when using a static front page), then we will add the site description.
  *
+ * If we're viewing a search result, then we're going to recreate the title entirely.
+ * We're going to add page numbers to all titles as well, to the middle of a search
+ * result title and the end of all other titles.
+ *
+ * The site title also gets added to all titles.
+ *
  * @since Twenty Ten 1.0
+ *
+ * @param string $title Title generated by wp_title()
+ * @param string $separator The separator passed to wp_title(). Twenty Ten uses a
+ * 	vertical bar, "|", as a separator in header.php.
+ * @return string The new title, ready for the <title> tag.
  */
-function twentyten_the_page_number() {
-	global $paged; // Contains page number.
-	if ( $paged >= 2 )
-		echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), $paged );
+function twentyten_filter_wp_title( $title, $separator ) {
+	// The $paged global variable contains the page number of a listing of posts.
+	// The $page global variable contains the page number of a single post that is paged.
+	// We'll display whichever one applies, if we're not looking at the first page.
+	global $paged, $page;
+
+	if ( is_search() ) {
+		// If we're a search, let's start over:
+		$title = sprintf( __( 'Search results for %s', 'twentyten' ), '"' . get_search_query() . '"' );
+		// Add a page number if we're on page 2 or more:
+		if ( $paged >= 2 )
+			$title .= " $separator " . sprintf( __( 'Page %s', 'twentyten' ), $paged );
+		// Add the site name to the end:
+		$title .= " $separator " . get_bloginfo( 'name', 'display' );
+		// We're done. Let's send the new title back to wp_title():
+		return $title;
+	}
+
+	// Otherwise, let's start by adding the site name to the end:
+	$title .= get_bloginfo( 'name', 'display' );
+
+	// If we have a site description and we're on the home/front page, add the description:
+	$site_description = get_bloginfo( 'description', 'display' );
+	if ( $site_description && ( is_home() || is_front_page() ) )
+		$title .= " $separator " . $site_description;
+
+	// Add a page number if necessary:
+	if ( $paged >= 2 || $page >= 2 )
+		$title .= " $separator " . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );
+
+	// Return the new title to wp_title():
+	return $title;
 }
-endif;
+add_filter( 'wp_title', 'twentyten_filter_wp_title', 10, 2 );
 
 /**
  * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
Index: wp-content/themes/twentyten/header.php
===================================================================
--- wp-content/themes/twentyten/header.php	(revision 15184)
+++ wp-content/themes/twentyten/header.php	(working copy)
@@ -11,31 +11,19 @@
 ?><!DOCTYPE html>
 <html <?php language_attributes(); ?>>
 <head>
-	<meta charset="<?php bloginfo( 'charset' ); ?>" />
-	<title>
-	<?php // Returns the title based on what is being viewed
-		if ( is_single() ) { // single posts
-			single_post_title(); echo ' | '; bloginfo( 'name' );
-		// The home page or, if using a static front page, the blog posts page.
-		} elseif ( is_home() || is_front_page() ) {
-			bloginfo( 'name' );
-			if( get_bloginfo( 'description' ) )
-				echo ' | ' ; bloginfo( 'description' );
-			twentyten_the_page_number();
-		} elseif ( is_page() ) { // WordPress Pages
-			single_post_title( '' ); echo ' | '; bloginfo( 'name' );
-		} elseif ( is_search() ) { // Search results
-			printf( __( 'Search results for %s', 'twentyten' ), '"'.get_search_query().'"' ); twentyten_the_page_number(); echo ' | '; bloginfo( 'name' );
-		} elseif ( is_404() ) {  // 404 (Not Found)
-			_e( 'Not Found', 'twentyten' ); echo ' | '; bloginfo( 'name' );
-		} else { // Otherwise:
-			wp_title( '' ); echo ' | '; bloginfo( 'name' ); twentyten_the_page_number();
-		}
-	?>
-	</title>
-	<link rel="profile" href="http://gmpg.org/xfn/11" />
-	<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
-	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
+<meta charset="<?php bloginfo( 'charset' ); ?>" />
+<title><?php
+	/*
+	 * Print the <title> tag based on what is being viewed.
+	 * We filter the output of wp_title() a bit -- see
+	 * twentyten_filter_wp_title() in functions.php.
+	 */
+	wp_title( '|', true, 'right' );
+
+	?></title>
+<link rel="profile" href="http://gmpg.org/xfn/11" />
+<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
+<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
 <?php
 	/* We add some JavaScript to pages with the comment form
 	 * to support sites with threaded comments (when in use).
@@ -48,7 +36,6 @@
 	 * generally use this hook to add elements to <head> such
 	 * as styles, scripts, and meta tags.
 	 */
-
 	wp_head();
 ?>
 </head>
Index: wp-admin/custom-background.php
===================================================================
--- wp-admin/custom-background.php	(revision 15184)
+++ wp-admin/custom-background.php	(working copy)
@@ -281,11 +281,11 @@
 <th scope="row"><?php _e( 'Attachment' ); ?></th>
 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Attachment' ); ?></span></legend>
 <label>
-<input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', 'fixed')); ?> />
+<input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', 'scroll')); ?> />
 <?php _e('Scroll') ?>
 </label>
 <label>
-<input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', 'fixed')); ?> />
+<input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', 'scroll')); ?> />
 <?php _e('Fixed') ?>
 </label>
 </fieldset></td>
