diff --git a/defparams.pl b/defparams.pl
index 23d7c41c61d385ba225cdc5f8eceffc4fe672bd9..da8cf2afa4e61217dc102ab89bbf7251dbf8d057 100644
--- a/defparams.pl
+++ b/defparams.pl
@@ -17,6 +17,7 @@
 # Netscape Communications Corporation. All Rights Reserved.
 # 
 # Contributor(s): Terry Weissman <terry@mozilla.org>
+#                 Dawn Endico <endico@mozilla.org>
 
 
 # This file defines all the parameters that we have a GUI to edit within
@@ -276,6 +277,12 @@ DefParam("nummilestones",
          10,
          \&check_numeric);
 
+DefParam("curmilestone",
+         "If using Target Milestone, Which milestone are we working toward right now?",
+         "t",
+         1,
+         \&check_numeric);
+
 DefParam("useqacontact",
 	 "Do you wish to use the QA Contact field?",
 	 "b",
diff --git a/reports.cgi b/reports.cgi
index b773ec2694d0a77a183130fa097c3a4f240b81ed..a8de9f8044bb482b69324b60b26200b702a85af8 100755
--- a/reports.cgi
+++ b/reports.cgi
@@ -19,10 +19,11 @@
 #
 # Contributor(s): Harrison Page <harrison@netscape.com>,
 # Terry Weissman <terry@mozilla.org>,
-# Bryce Nesbitt <bryce@nextbus.COM>
-#	Added -All- report, change "nobanner" to "banner" (it is strange to have a
-#	list with 2 positive and 1 negative choice), default links on, add show
-#	sql comment.
+# Dawn Endico <endico@mozilla.org>
+# Bryce Nesbitt <bryce@nextbus.COM>,
+#    Added -All- report, change "nobanner" to "banner" (it is strange to have a
+#    list with 2 positive and 1 negative choice), default links on, add show
+#    sql comment.
 
 use diagnostics;
 use strict;
@@ -36,6 +37,7 @@ use vars @::legal_product;
 my $dir = "data/mining";
 my $week = 60 * 60 * 24 * 7;
 my @status = qw (NEW ASSIGNED REOPENED);
+my %bugsperperson;
 
 # while this looks odd/redundant, it allows us to name
 # functions differently than the value passed in
@@ -43,6 +45,7 @@ my @status = qw (NEW ASSIGNED REOPENED);
 my %reports = 
 	( 
 	"most_doomed" => \&most_doomed,
+	"most_doomed_for_milestone" => \&most_doomed_for_milestone,
 	"show_chart" => \&show_chart,
 	);
 
@@ -130,6 +133,7 @@ $product_popup
 <td align=center>
 <select name="output">
 <option value="most_doomed">Bug Counts
+<option value="most_doomed_for_milestone">Most Doomed
 $charts
 </select>
 <tr>
@@ -506,3 +510,117 @@ FIN
 	}
 
 
+sub most_doomed_for_milestone
+	{
+	my $when = localtime (time);
+        my $ms = "M" . Param("curmilestone");
+        my $quip = "Summary";
+
+	print "<center>\n<h1>";
+        if( $::FORM{'product'} ne "-All-" ) {
+            print "Most Doomed for $ms ($::FORM{'product'})";
+        } else {
+            print "Most Doomed for $ms";
+            }
+        print "</h1>\n$when<p>\n";
+
+	#########################
+	# start painting report #
+	#########################
+
+	if ($::FORM{'quip'})
+                {
+                if (open (COMMENTS, "<data/comments"))
+                        {
+                        my @cdata;
+                        while (<COMMENTS>)
+                                {
+                                push @cdata, $_;
+                                }
+                        close COMMENTS;
+                        $quip = "<i>" . $cdata[int(rand($#cdata + 1))] . "</i>";                        }
+                }
+
+
+        # Build up $query string
+	my $query;
+	$query = "select distinct assigned_to from bugs where target_milestone=\"$ms\"";
+	if( $::FORM{'product'} ne "-All-" ) {
+		$query .= "and    bugs.product='$::FORM{'product'}'";
+	}
+	$query .= <<FIN;
+and 	 
+	( 
+	bugs.bug_status = 'NEW' or 
+	bugs.bug_status = 'ASSIGNED' or 
+	bugs.bug_status = 'REOPENED'
+	)
+FIN
+# End build up $query string
+
+        SendSQL ($query);
+        my @people = ();
+        while (my ($person) = FetchSQLData())
+            {
+            push @people, $person;
+            }
+
+        #############################
+        # suck contents of database # 
+        #############################
+        my $person = "";
+        my $bugtotal = 0;
+        foreach $person (@people)
+                {
+                SendSQL ("select count(bug_id) from bugs,profiles where target_milestone=\"$ms\" and userid=assigned_to and userid=\"$person\";");
+	        my $bugcount = FetchSQLData();
+                $bugsperperson{$person} = $bugcount;
+                $bugtotal += $bugcount;
+                }
+
+#       sort people by the number of bugs they have assigned to this milestone
+        sub bybugs {
+                $bugsperperson{$a} <=> $bugsperperson{$b}
+                }
+        @people = sort bybugs @people;
+        my $totalpeople = @people;
+                
+        print "<TABLE>\n";
+        print "<TR><TD COLSPAN=2>\n";
+        print "$totalpeople engineers have $bugtotal $ms bugs and features.\n";
+        print "</TD></TR>\n";
+
+        while (@people)
+                {
+                $person = pop @people;
+                print "<TR><TD>\n";
+                SendSQL("select login_name from profiles where userid=$person;");
+                my $login_name= FetchSQLData();
+                print("<A HREF=\"buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&target_milestone=M9&assigned_to=$login_name\">\n");
+                print("$bugsperperson{$person}  bugs and features");
+                print("</A>");
+                print(" for \n");
+                print("<A HREF=\"mailto:$login_name\">");
+                print("$login_name");
+                print("</A>\n");
+                print("</TD><TD>\n");
+
+                $person = pop @people;
+                if ($person) {
+                    SendSQL("select login_name from profiles where userid=$person;");
+                    my $login_name= FetchSQLData();
+                    print("<A HREF=\"buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&target_milestone=M9&assigned_to=$login_name\">\n");
+                    print("$bugsperperson{$person}  bugs and features");
+                    print("</A>");
+                    print(" for \n");
+                    print("<A HREF=\"mailto:$login_name\">");
+                    print("$login_name");
+                    print("</A>\n");
+                    print("</TD></TR>\n\n");
+                    }
+                }
+        print "</TABLE>\n";
+
+        }
+
+