sub process_change_registration {
  my $post_data_ref=$_[0];

  my ($leader, $follower, $coup, $i, @master, $master_ref,
      $abbrev, @dance_array, $retval, $s, $filename, $dance);

  # Read in their registration changes and update the database.

  ($leader, $follower)=Competitor::assemble_competitors($post_data_ref);
  $coup=Couple->new($leader, $follower);

  if ($$post_data_ref{"removeCouple"}==1) {
    Database::removeCouple($coup);
    print Constants::get(HTML_MSG46)."<p>\n";
    Database::do_stats;
    if ($mailto!=-1 && Constants::get(SENDMAIL)) {
      Mail::SendUpdateConfirmation(\@mail);
    }
    return;
  }

#  Database::openDBLogfile(Constants::get(DATABASE));
  Database::addCoupleToSchools($coup);
  
  $master_ref=Constants::get(MASTER);
  for ($i=0;$i<=$#$master_ref;$i++) {
    $abbrev=$$master_ref[$i]->getAbbrev();
    $retval=$$post_data_ref{$abbrev};
    push(@dance_array, $retval);
    if ($retval==1) { # add 'em
      Database::addCoupleToDance($$master_ref[$i], $coup);
    } elsif ($retval==-1) { # drop 'em
      Database::removeCoupleFromDance($$master_ref[$i], $coup);
    }	
  }

  $|=1;
  
  select(STDOUT);
  # ok, all is well

  print "<HTML><HEAD><TITLE> ".Constants::get(HTML_MSG8).
    " </TITLE></HEAD>";
  print Constants::get(BODY_TAG);
  print "<h1> ".Constants::get(HTML_MSG8)." </h1>\n";
  print Constants::get(HTML_MSG9)."<p>\n";
  print "<center><table width=100%>\n";
  print "<tr><th colspan=2> ".Constants::get(HTML_MSG3)." </th>\n";
  print "<th colspan=2> ".Constants::get(HTML_MSG4)." </th>\n";
  print "<tr><td align=right> ".Constants::get(HTML_MSG5)." </td>\n";
  print "<td> ".$leader->getName()." </td>\n";
  print "<td align=right> ".Constants::get(HTML_MSG5)." </td>\n";
  print "<td> ".$follower->getName()." </td></tr>\n";
  print "<tr><td align=right> ".Constants::get(HTML_MSG6)." </td>\n";
  if ($leader->doesEmailExist()) {
    print "<td> ".$leader->getEmail()." </td>\n\n";
  } else {
    print "<td> ".Constants::get(HTML_MSG18)." </td>\n\n";
  }
  print "<td align=right> ".Constants::get(HTML_MSG6)." </td>\n";
  if ($follower->doesEmailExist()) {
    print "<td> ".$follower->getEmail()." </td></tr>\n\n";
  } else {
    print "<td> ".Constants::get(HTML_MSG18)." </td>\n\n";
  }
  print "<tr><td align=right> ".Constants::get(HTML_MSG7)." </td>\n";
#  print "<td> ".$leader->getSchool()." </td>\n\n";
  $_=$leader->getSchool();
  if ($_==-1) {
    print "<td> <i>".Constants::get(HTML_MSG29)."</i> </td>\n\n";
  } else {
    print "<td> $_ </td>\n\n";
  }
  print "<td align=right> ".Constants::get(HTML_MSG7)." </td>\n";
#  print "<td> ".$follower->getSchool()." </td></tr>\n\n";
  $_=$follower->getSchool();
  if ($_==-1) {
    print "<td> <i>".Constants::get(HTML_MSG29)."</i> </td>\n\n";
  } else {
    print "<td> $_ </td>\n\n";
  }
  print "</table></center>\n";
  print "<p>\n";
  print "<ul>\n";

  push(@mail, $leader);
  push(@mail, $follower);
  for ($i=0;$i<=$#dance_array;$i++) {
    if ($dance_array[$i]>0) {
      $dancename=$$master_ref[$i]->getFullName();
      print "<li> ".$dancename."\n";
      push(@mail, $dancename);
    }
  }
  print "</ul><p>\n";

  General::log("doing stats");
  if (Database::do_stats) {
    $_="<a href=\"".Constants::get(STATS)."\">".
      Constants::get(HTML_MSG23)."</a>\n";
    my $foo=Constants::get(STATS_DIR);
    my $bar=Constants::get(STATS_DIR_HREF);
    s@$foo@$bar@;
    print $_;
  } else {
    print Constants::get(HTML_MSG24);
  }

  General::PrintHTMLTail();
  General::log("mailto=$mailto, sizeof(mail)=$#mail");
  if ($mailto!=-1 && Constants::get(SENDMAIL)) {
    Mail::SendUpdateConfirmation(\@mail);
  }
}

1;
