diff --git a/CRM/Admin/Form/Setting/Mail.php b/CRM/Admin/Form/Setting/Mail.php
index 6440da05c933ce6621778f3432b3f6918510b0da..82f9f26c19967784ffd22530e264efb38be7e216 100644
--- a/CRM/Admin/Form/Setting/Mail.php
+++ b/CRM/Admin/Form/Setting/Mail.php
@@ -57,8 +57,30 @@ class CRM_Admin_Form_Setting_Mail extends CRM_Admin_Form_Setting {
     // redirect to Administer Section After hitting either Save or Cancel button.
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
+    
+    $this->addFormRule(array('CRM_Admin_Form_Setting_Mail', 'formRule'));
+    $this->addRule('mailerBatchLimit', ts('Must be an integer'), 'integer');
+    $this->addRule('mailThrottleTime', ts('Must be an integer'), 'integer');
+    $this->addRule('mailerJobSize', ts('Must be an integer'), 'integer');
+    $this->addRule('mailerJobsMax', ts('Must be an integer'), 'integer');            
 
     parent::buildQuickForm($check);
   }
+  
+  static function formRule($fields) {
+    $errors = array();
+
+    if (CRM_Utils_Array::value('mailerJobSize', $fields) > 0) {
+      if (CRM_Utils_Array::value('mailerJobSize', $fields) < 1000) {
+        $errors['mailerJobSize'] = ts('The job size must be at least 1000 or set to 0 (unlimited).');
+      }
+      elseif (CRM_Utils_Array::value('mailerJobSize', $fields) <
+        CRM_Utils_Array::value('mailerBatchLimit', $fields)) {
+        $errors['mailerJobSize'] = ts('A job size smaller than the batch limit will negate the effect of the batch limit.');
+      }
+    }
+    
+    return empty($errors) ? TRUE : $errors;
+  }
 }
 
diff --git a/CRM/Admin/Form/WordReplacements.php b/CRM/Admin/Form/WordReplacements.php
index fc6938895ff4f241378a0cd37d46a240a5c7c44a..9ab0e22cd24c7115c8459d36f6627672c15906fd 100644
--- a/CRM/Admin/Form/WordReplacements.php
+++ b/CRM/Admin/Form/WordReplacements.php
@@ -256,8 +256,10 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form {
     $wordReplacementSettings = CRM_Core_BAO_Domain::edit($params, $id);
 
     if ($wordReplacementSettings) {
-      //reset navigation
+      // Reset navigation
       CRM_Core_BAO_Navigation::resetNavigation();
+      // Clear js string cache
+      CRM_Core_Resources::singleton()->flushStrings();
 
       CRM_Core_Session::setStatus("", ts("Settings Saved"), "success");
       CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/options/wordreplacements',
diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php
index 181c013dde5f5f1f361854df4a3925161b0088e4..a2a71ff0c682a1e1acf731b6160c2a040fa232f2 100644
--- a/CRM/Case/BAO/Case.php
+++ b/CRM/Case/BAO/Case.php
@@ -1287,7 +1287,7 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type
       }
 
       if ($allowEdit) {
-        $values[$dao->id]['status'] = '<a class="crm-activity-status crm-activity-status-' . $dao->id . ' ' . $values[$dao->id]['class'] . ' crm-activity-change-status" activity_id='. $dao->id. ' contact_id=' . $contactID . ' current_status=' . $dao->status . ' case_id=' . $caseID . '" href="#" title=\'' . $statusTitle . '\'>' . $values[$dao->id]['status'] . '</a>';
+        $values[$dao->id]['status'] = '<a class="crm-activity-status crm-activity-status-' . $dao->id . ' ' . $values[$dao->id]['class'] . ' crm-activity-change-status" activity_id='. $dao->id. ' current_status=' . $dao->status . ' case_id=' . $caseID . '" href="#" title=\'' . $statusTitle . '\'>' . $values[$dao->id]['status'] . '</a>';
       }
     }
     $dao->free();
diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php
index 723745e3973579e0141e248e8bb69f5956739a3e..cfd2fb10cace58711a47a5725c3fd3b909560dcc 100644
--- a/CRM/Contact/BAO/Contact.php
+++ b/CRM/Contact/BAO/Contact.php
@@ -2986,7 +2986,7 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id )
    */
   public static function deleteObjectWithPrimary($type, $id) {
     if (!$id || !is_numeric($id)) {
-      return false;
+      return FALSE;
     }
     $daoName = "CRM_Core_DAO_$type";
     $obj = new $daoName();
@@ -2998,7 +2998,7 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id )
       $obj->delete();
     }
     else {
-      return false;
+      return FALSE;
     }
     $dao = new $daoName();
     $dao->contact_id = $contactId;
@@ -3015,5 +3015,6 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id )
     $dao->free();
     CRM_Utils_Hook::post('delete', $type, $id, $obj);
     $obj->free();
+    return TRUE;
   }
 }
diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php
index e21a768224abaa5e1b24df673b2961a6492dc80f..5fd504daeda6195a7e9a6918f67950dc656a35b1 100644
--- a/CRM/Contact/BAO/Group.php
+++ b/CRM/Contact/BAO/Group.php
@@ -782,6 +782,10 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
 
     while ($object->fetch()) {
       $permission = CRM_Contact_BAO_Group::checkPermission($object->id, $object->title);
+      //@todo CRM-12209 introduced an ACL check in the whereClause function
+      // it may be that this checking is now obsolete - or that what remains
+      // should be removed to the whereClause (which is also accessed by getCount)
+
       if ($permission) {
         $newLinks = $links;
         $values[$object->id] = array();
@@ -1115,6 +1119,15 @@ WHERE {$whereClause}";
     if ($excludeHidden) {
       $clauses[] = 'groups.is_hidden = 0';
     }
+    //CRM-12209
+    if (!CRM_Core_Permission::check('view all contacts')) {
+      //get the allowed groups for the current user
+      $groups = CRM_ACL_API::group(CRM_ACL_API::VIEW);
+      if (!empty( $groups)) {
+        $groupList = implode( ', ', array_values( $groups ) );
+        $clauses[] = "groups.id IN ( $groupList ) ";
+      }
+    }
 
     return implode(' AND ', $clauses);
   }
diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php
index 50a5b2415b12288d634e9660c5589536824e0f96..d9d09ee02714de969ef3f26a24dc9d62f832ef23 100644
--- a/CRM/Contact/Form/Contact.php
+++ b/CRM/Contact/Form/Contact.php
@@ -435,9 +435,9 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
 
     // set defaults for blocks ( custom data, address, communication preference, notes, tags and groups )
     foreach ($this->_editOptions as $name => $label) {
-      if (!in_array($name, array(
-        'Address', 'Notes'))) {
-        eval('CRM_Contact_Form_Edit_' . $name . '::setDefaultValues( $this, $defaults );');
+      if (!in_array($name, array('Address', 'Notes'))) {
+        $className = 'CRM_Contact_Form_Edit_' . $name;
+        $className::setDefaultValues($this, $defaults);
       }
     }
 
@@ -744,8 +744,8 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
   public function buildQuickForm() {
     //load form for child blocks
     if ($this->_addBlockName) {
-      $class = 'CRM_Contact_Form_Edit_' . $this->_addBlockName;
-      return $class::buildQuickForm($this);
+      $className = 'CRM_Contact_Form_Edit_' . $this->_addBlockName;
+      return $className::buildQuickForm($this);
     }
 
     if ($this->_action == CRM_Core_Action::UPDATE) {
@@ -770,7 +770,8 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
     }
 
     //build contact type specific fields
-    eval('CRM_Contact_Form_Edit_' . $this->_contactType . '::buildQuickForm( $this );');
+    $className = 'CRM_Contact_Form_Edit_' . $this->_contactType;
+    $className::buildQuickForm($this);
 
     // build Custom data if Custom data present in edit option
     $buildCustomData = 'noCustomDataPresent';
@@ -798,8 +799,8 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
         $this->_blocks['Address'] = $this->_editOptions['Address'];
         continue;
       }
-
-      eval('CRM_Contact_Form_Edit_' . $name . '::buildQuickForm( $this );');
+      $className = 'CRM_Contact_Form_Edit_' . $name;
+      $className::buildQuickForm($this);
     }
 
     // build location blocks.
diff --git a/CRM/Contact/Form/Edit/TagsAndGroups.php b/CRM/Contact/Form/Edit/TagsAndGroups.php
index 26767cccf28c40627c3da102f88ca4c5f08584e9..a7bb9d466c31d40606b900cf322916edb990015b 100644
--- a/CRM/Contact/Form/Edit/TagsAndGroups.php
+++ b/CRM/Contact/Form/Edit/TagsAndGroups.php
@@ -32,7 +32,7 @@
  * $Id$
  *
  */
-class CRM_Contact_Form_Edit_TagsandGroups {
+class CRM_Contact_Form_Edit_TagsAndGroups {
 
   /**
    * constant to determine which forms we are generating
@@ -57,13 +57,13 @@ class CRM_Contact_Form_Edit_TagsandGroups {
    * @access public
    */
   static function buildQuickForm(&$form,
-    $contactId  = 0,
-    $type       = CRM_Contact_Form_Edit_TagsandGroups::ALL,
+    $contactId = 0,
+    $type = self::ALL,
     $visibility = FALSE,
     $isRequired = NULL,
-    $groupName  = 'Group(s)',
-    $tagName    = 'Tag(s)',
-    $fieldName  = NULL
+    $groupName = 'Group(s)',
+    $tagName = 'Tag(s)',
+    $fieldName = NULL
   ) {
     if (!isset($form->_tagGroup)) {
       $form->_tagGroup = array();
@@ -74,8 +74,8 @@ class CRM_Contact_Form_Edit_TagsandGroups {
       $contactId = $form->_contactId;
     }
 
-    $type = (int ) $type;
-    if ($type & CRM_Contact_Form_Edit_TagsandGroups::GROUP) {
+    $type = (int) $type;
+    if ($type & self::GROUP) {
 
       $fName = 'group';
       if ($fieldName) {
@@ -122,7 +122,7 @@ class CRM_Contact_Form_Edit_TagsandGroups {
       }
     }
 
-    if ($type & CRM_Contact_Form_Edit_TagsandGroups::TAG) {
+    if ($type & self::TAG) {
       $fName = 'tag';
       if ($fieldName) {
         $fName = $fieldName;
@@ -163,7 +163,7 @@ class CRM_Contact_Form_Edit_TagsandGroups {
    * @access public
    * @static
    */
-  static function setDefaults($id, &$defaults, $type = CRM_Contact_Form_Edit_TagsandGroups::ALL, $fieldName = NULL) {
+  static function setDefaults($id, &$defaults, $type = self::ALL, $fieldName = NULL) {
     $type = (int ) $type;
     if ($type & self::GROUP) {
       $fName = 'group';
diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php
index 6c76df04ac892de569c8923b6096dd70c3f7c903..d6087b9c399fd16e45a381665b7e59dc848cef99 100644
--- a/CRM/Contribute/BAO/Contribution.php
+++ b/CRM/Contribute/BAO/Contribution.php
@@ -1719,7 +1719,7 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
             //updating the membership log
             $membershipLog = array();
             $membershipLog = $formatedParams;
-            $logStartDate  = CRM_Utils_Date::customFormat($dates['log_start_date'], $format);
+            $logStartDate  = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('log_start_date', $dates), $format);
             $logStartDate  = ($logStartDate) ? CRM_Utils_Date::isoToMysql($logStartDate) : $formatedParams['start_date'];
 
             $membershipLog['start_date'] = $logStartDate;
diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php
index fba41e28d3a9f92937c19072fe2e076d7ab4d8a3..23ecb75ebdf3c3a5758672ed5b73a97f401a1682 100644
--- a/CRM/Core/BAO/Address.php
+++ b/CRM/Core/BAO/Address.php
@@ -1135,6 +1135,6 @@ SELECT is_primary,
    * Call common delete function
    */
   static function del($id) {
-    CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Address', $id);
+    return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Address', $id);
   }
 }
diff --git a/CRM/Core/BAO/Email.php b/CRM/Core/BAO/Email.php
index 6de62fdcead70523eba8169d20907f89c565fdef..bd99c13940c3c6209dbdf242de7ba674386f89e5 100644
--- a/CRM/Core/BAO/Email.php
+++ b/CRM/Core/BAO/Email.php
@@ -311,7 +311,7 @@ AND    reset_date IS NULL
    * Call common delete function
    */
   static function del($id) {
-    CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Email', $id);
+    return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Email', $id);
   }
 }
 
diff --git a/CRM/Core/BAO/IM.php b/CRM/Core/BAO/IM.php
index a20f81541ca4377ef8f597255d7f183176f39823..20561926fda87c9de0d58437aba08626c56a4bba 100644
--- a/CRM/Core/BAO/IM.php
+++ b/CRM/Core/BAO/IM.php
@@ -171,7 +171,7 @@ ORDER BY cim.is_primary DESC, im_id ASC ";
    * Call common delete function
    */
   static function del($id) {
-    CRM_Contact_BAO_Contact::deleteObjectWithPrimary('IM', $id);
+    return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('IM', $id);
   }
 }
 
diff --git a/CRM/Core/BAO/OpenID.php b/CRM/Core/BAO/OpenID.php
index 4ece5a75a902bd3326d6e02ddf6887975149ba5c..eae3f9017d5d184c3428e033bd308af2001fa393 100644
--- a/CRM/Core/BAO/OpenID.php
+++ b/CRM/Core/BAO/OpenID.php
@@ -145,7 +145,7 @@ ORDER BY
    * Call common delete function
    */
   static function del($id) {
-    CRM_Contact_BAO_Contact::deleteObjectWithPrimary('OpenID', $id);
+    return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('OpenID', $id);
   }
 }
 
diff --git a/CRM/Core/BAO/Phone.php b/CRM/Core/BAO/Phone.php
index a514671e193f4532b58530796ea07843df451167..14572de4e2d1a81a5058688c54ebb76d154d0218 100644
--- a/CRM/Core/BAO/Phone.php
+++ b/CRM/Core/BAO/Phone.php
@@ -252,7 +252,7 @@ ORDER BY ph.is_primary DESC, phone_id ASC ";
    * Call common delete function
    */
   static function del($id) {
-    CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Phone', $id);
+    return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Phone', $id);
   }
 }
 
diff --git a/CRM/Core/BAO/Website.php b/CRM/Core/BAO/Website.php
index 7dab7a17285416a4cdecccb4929ebaa84ce3458c..42e6406e892ca2868cec3f89a2a75295fb41bc19 100644
--- a/CRM/Core/BAO/Website.php
+++ b/CRM/Core/BAO/Website.php
@@ -120,6 +120,8 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website {
   static function del($ids) {
     $query = 'DELETE FROM civicrm_website WHERE id IN ( ' . implode(',', $ids) . ')';
     CRM_Core_DAO::executeQuery($query);
+    // FIXME: we should return false if the del was unsuccessful
+    return TRUE;
   }
 
   /**
diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php
index 629f0c3df0fcffa7ad7355c15bf5191df0b6333a..55741dcfcc821db97cf90b7d1a413e04deda19d3 100644
--- a/CRM/Core/Resources.php
+++ b/CRM/Core/Resources.php
@@ -131,7 +131,7 @@ class CRM_Core_Resources {
     if ($cacheCodeKey !== NULL) {
       $this->cacheCode = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, $cacheCodeKey);
     }
-    if (! $this->cacheCode) {
+    if (!$this->cacheCode) {
       $this->resetCacheCode();
     }
   }
@@ -477,6 +477,13 @@ class CRM_Core_Resources {
     return $this;
   }
 
+  /**
+   * Flushes cached translated strings
+   */
+  public function flushStrings() {
+    $this->cache->flush();
+  }
+
   /**
    * Translate strings in a javascript file
    *
diff --git a/CRM/Mailing/Form/Test.php b/CRM/Mailing/Form/Test.php
index 88793cca9a13c32236be241c8c18827dd2c8c69f..664ecfacebe31307b2a7870f7e96a63282c47c69 100644
--- a/CRM/Mailing/Form/Test.php
+++ b/CRM/Mailing/Form/Test.php
@@ -179,7 +179,7 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form {
    * @return boolean          true on succesful SMTP handoff
    * @access public
    */
-  static function &testMail($testParams, $files, $self) {
+  static function testMail($testParams, $files, $self) {
     $error = NULL;
 
     $urlString = 'civicrm/mailing/send';
@@ -260,6 +260,14 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form {
       }
     }
 
+    if (CRM_Utils_Array::value('_qf_Test_next', $testParams) && 
+      $self->get('count') <= 0) {
+      return array(
+        '_qf_default' =>
+        ts("You can not schedule or send this mailing because there are currently no recipients selected. Click 'Previous' to return to the Select Recipients step, OR click 'Save & Continue Later'."),
+      );
+    }
+
     if (CRM_Utils_Array::value('_qf_Import_refresh', $_POST) ||
       CRM_Utils_Array::value('_qf_Test_next', $testParams) ||
       !CRM_Utils_Array::value('sendtest', $testParams)
diff --git a/CRM/Upgrade/Incremental/php/FourOne.php b/CRM/Upgrade/Incremental/php/FourOne.php
index 772fb9e9d1117fef1cc1729e6c96a14457ac93ec..7e0029057766afcabaf29121f6ecce9e07d23f06 100644
--- a/CRM/Upgrade/Incremental/php/FourOne.php
+++ b/CRM/Upgrade/Incremental/php/FourOne.php
@@ -33,6 +33,9 @@
  *
  */
 class CRM_Upgrade_Incremental_php_FourOne {
+  // This was changed in 4.3 so we define it locally for compatability with older dbs
+  const NAVIGATION_NAME = "Navigation Menu";
+
   function verifyPreDBstate(&$errors) {
     $config = CRM_Core_Config::singleton();
     if (in_array('CiviCase', $config->enableComponents)) {
@@ -123,7 +126,7 @@ class CRM_Upgrade_Incremental_php_FourOne {
 
 
     $userColumnNames = array(
-      CRM_Core_BAO_Setting::NAVIGATION_NAME => array(
+      self::NAVIGATION_NAME => array(
         'navigation',
       ),
     );
diff --git a/CRM/Upgrade/Incremental/php/FourThree.php b/CRM/Upgrade/Incremental/php/FourThree.php
index bfbff245b5fbafde4c45fcb49a39ce133737d1fc..de37b456865b0e168ab2235ab9b9d50f7e90f5cd 100644
--- a/CRM/Upgrade/Incremental/php/FourThree.php
+++ b/CRM/Upgrade/Incremental/php/FourThree.php
@@ -261,7 +261,6 @@ WHERE ceft.entity_id IS NULL;";
   }
 
   function upgrade_4_3_beta5($rev) {
-    $this->addTask(ts('Upgrade DB to 4.3.beta5: SQL'), 'task_4_3_x_runSql', $rev);
     // CRM-12205
     if (
       CRM_Core_DAO::checkTableExists('log_civicrm_financial_trxn') &&
@@ -269,6 +268,13 @@ WHERE ceft.entity_id IS NULL;";
     ) {
       CRM_Core_DAO::executeQuery('ALTER TABLE `log_civicrm_financial_trxn` CHANGE `trxn_id` `trxn_id` VARCHAR(255) NULL DEFAULT NULL');
     }
+    // CRM-12142 - some sites didn't get this column added yet, and sites which installed 4.3 from scratch will already have it
+    if (
+      !CRM_Core_DAO::checkFieldExists('civicrm_premiums', 'premiums_nothankyou_label')
+    ) {
+       CRM_Core_DAO::executeQuery('ALTER TABLE `civicrm_premiums` ADD COLUMN premiums_nothankyou_label varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT "Label displayed for No Thank-you option in premiums block (e.g. No thank you)"');
+    }    
+    $this->addTask(ts('Upgrade DB to 4.3.beta5: SQL'), 'task_4_3_x_runSql', $rev);
   }
 
   //CRM-11636
diff --git a/CRM/Upgrade/Incremental/sql/4.3.beta4.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.3.beta4.mysql.tpl
index 411e74271edd2b3efe948b9904426f78656b9626..aecd25327195f9748a3d830ce2661b9630be7771 100644
--- a/CRM/Upgrade/Incremental/sql/4.3.beta4.mysql.tpl
+++ b/CRM/Upgrade/Incremental/sql/4.3.beta4.mysql.tpl
@@ -1,18 +1,3 @@
--- CRM-12142
-{if !$multilingual}
-  ALTER TABLE `civicrm_premiums`
-    ADD COLUMN premiums_nothankyou_label varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Label displayed for No Thank-you
- option in premiums block (e.g. No thank you)';
-
--- Also need to populate default text for premiums_nothankyou_label
-  UPDATE `civicrm_premiums` SET premiums_nothankyou_label = '{ts escape="sql"}No thank-you{/ts}';
-{else}
-  {foreach from=$locales item=locale}
-    UPDATE `civicrm_premiums` SET premiums_nothankyou_label_{$locale} = '{ts escape="sql"}No thank-you{/ts}';	   
-  {/foreach}
-{/if}
-
-
 -- CRM-12151
 ALTER TABLE civicrm_option_value
   DROP INDEX index_option_group_id_value,
diff --git a/CRM/Upgrade/Incremental/sql/4.3.beta5.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.3.beta5.mysql.tpl
index d6d3a2a10508a1d4cdafccf466317e09d02c5b33..b27c0d3d7638ff191f827a30b8db2305077f61b5 100644
--- a/CRM/Upgrade/Incremental/sql/4.3.beta5.mysql.tpl
+++ b/CRM/Upgrade/Incremental/sql/4.3.beta5.mysql.tpl
@@ -1 +1,3 @@
-# empty sql file as a placeholder
\ No newline at end of file
+-- CRM-12142
+-- Populate default text for premiums_nothankyou_label
+UPDATE `civicrm_premiums` SET {localize field="premiums_nothankyou_label"}premiums_nothankyou_label = '{ts escape="sql"}No thank-you{/ts}'{/localize};
\ No newline at end of file
diff --git a/CRM/Utils/Pager.php b/CRM/Utils/Pager.php
index c25a719f9984623cd199723d8242974daa9fa9cb..2b8fa8185735cabd819dfbda1281adb4ce12df5d 100644
--- a/CRM/Utils/Pager.php
+++ b/CRM/Utils/Pager.php
@@ -274,7 +274,7 @@ class CRM_Utils_Pager extends Pager_Sliding {
    */
   function getPerPageLink($perPage) {
     if ($perPage != $this->_perPage) {
-      $href = CRM_Utils_System::makeURL(self::PAGE_ROWCOUNT) . $perPage;
+      $href = $this->makeURL(self::PAGE_ROWCOUNT, $perPage);
       $link = sprintf('<a href="%s" %s>%s</a>',
         $href,
         $this->_classString,
@@ -293,7 +293,7 @@ class CRM_Utils_Pager extends Pager_Sliding {
       return '';
     }
 
-    $href = CRM_Utils_System::makeURL(self::PAGE_ID) . 1;
+    $href = $this->makeURL(self::PAGE_ID, 1);
     return sprintf('<a href="%s" title="%s">%s</a>',
       $href,
       str_replace('%d', 1, $this->_altFirst),
@@ -306,7 +306,7 @@ class CRM_Utils_Pager extends Pager_Sliding {
       return '';
     }
 
-    $href = CRM_Utils_System::makeURL(self::PAGE_ID) . $this->_totalPages;
+    $href = $this->makeURL(self::PAGE_ID, $this->_totalPages);
     return sprintf('<a href="%s" title="%s">%s</a>',
       $href,
       str_replace('%d', $this->_totalPages, $this->_altLast),
@@ -316,7 +316,7 @@ class CRM_Utils_Pager extends Pager_Sliding {
 
   function getBackPageLink() {
     if ($this->_currentPage > 1) {
-      $href = CRM_Utils_System::makeURL(self::PAGE_ID) . $this->getPreviousPageID();
+      $href = $this->makeURL(self::PAGE_ID, $this->getPreviousPageID());
       return sprintf('<a href="%s" title="%s">%s</a>',
         $href,
         $this->_altPrev, $this->_prevImg
@@ -327,7 +327,7 @@ class CRM_Utils_Pager extends Pager_Sliding {
 
   function getNextPageLink() {
     if ($this->_currentPage < $this->_totalPages) {
-      $href = CRM_Utils_System::makeURL(self::PAGE_ID) . $this->getNextPageID();
+      $href = $this->makeURL(self::PAGE_ID, $this->getNextPageID());
       return $this->_spacesAfter . sprintf('<a href="%s" title="%s">%s</a>',
         $href,
         $this->_altNext, $this->_nextImg
@@ -335,5 +335,17 @@ class CRM_Utils_Pager extends Pager_Sliding {
     }
     return '';
   }
+
+  /**
+   * Build a url for pager links
+   */
+  function makeURL($key, $value) {
+    $href = CRM_Utils_System::makeURL($key);
+    // CRM-12212 Remove alpha sort param
+    if (strpos($href, '&amp;sortByCharacter=')) {
+      $href = preg_replace('#(.*)\&amp;sortByCharacter=[^&]*(.*)#', '\1\2', $href);
+    }
+    return $href . $value;
+  }
 }
 
diff --git a/api/v3/Im.php b/api/v3/Im.php
index 2e96a7d730a3053206359db3f3b1991aea631142..554afcb975d08ed03d20d8697f5801f2def19761 100644
--- a/api/v3/Im.php
+++ b/api/v3/Im.php
@@ -42,11 +42,9 @@
  *
  * @return array of newly created IM property values.
  * @access public
- * @todo convert to using basic create - BAO function non-std
  */
 function civicrm_api3_im_create($params) {
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
-
 }
 
 /**
diff --git a/api/v3/Phone.php b/api/v3/Phone.php
index d32561080a0b6cab644c037c25d526c0f1dbea1c..8ed7c3213d0e41faae1196f99cd78edda9f127ac 100644
--- a/api/v3/Phone.php
+++ b/api/v3/Phone.php
@@ -80,21 +80,7 @@ function _civicrm_api3_phone_create_spec(&$params) {
  * @access public
  */
 function civicrm_api3_phone_delete($params) {
-
-  $phoneID = CRM_Utils_Array::value('id', $params);
-
-  require_once 'CRM/Core/DAO/Phone.php';
-  $phoneDAO = new CRM_Core_DAO_Phone();
-  $phoneDAO->id = $phoneID;
-  if ($phoneDAO->find()) {
-    while ($phoneDAO->fetch()) {
-      $phoneDAO->delete();
-      return civicrm_api3_create_success($phoneDAO->id, $params, $phoneDAO);
-    }
-  }
-  else {
-    return civicrm_api3_create_error('Could not delete phone with id ' . $phoneID);
-  }
+  return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }
 
 /**
diff --git a/api/v3/utils.php b/api/v3/utils.php
index 5db195396df6bd5ccea1d81dd87f48cbc7f9e898..e1d468d714259f2a7ff7193429a40ff56516dffc 100644
--- a/api/v3/utils.php
+++ b/api/v3/utils.php
@@ -134,8 +134,7 @@ function civicrm_api3_verify_mandatory($params, $daoName = NULL, $keys = array(
  *
  * @return <type>
  */
-function civicrm_api3_create_error($msg, $data = array(
-  ), &$dao = NULL) {
+function civicrm_api3_create_error($msg, $data = array(), &$dao = NULL) {
   //fix me - $dao should be param 4 & 3 should be $apiRequest
   if (is_object($dao)) {
     $dao->free();
@@ -989,7 +988,10 @@ function _civicrm_api3_basic_delete($bao_name, &$params) {
   $args = array(&$params['id']);
   if (method_exists($bao_name, 'del')) {
     $bao = call_user_func_array(array($bao_name, 'del'), $args);
-    return civicrm_api3_create_success(TRUE);
+    if ($bao !== FALSE) {
+      return civicrm_api3_create_success(TRUE);
+    }
+    return civicrm_api3_create_error('Could not delete entity id ' . $params['id']);
   }
   elseif (method_exists($bao_name, 'delete')) {
     $dao = new $bao_name();
diff --git a/css/civicrm.css b/css/civicrm.css
index 0b8a869e49372481f2cc783f7167d8bfd92fcacb..907485d3291d1a527eb899c93339c69173169db4 100644
--- a/css/civicrm.css
+++ b/css/civicrm.css
@@ -2649,7 +2649,7 @@ div.grippie {
 
 /* accordion styles */
 
-#crm-container .crm-accordion-header {
+.crm-container .crm-accordion-header {
   background-image: url("../i/TreeMinusWhite.gif");
   background-repeat: no-repeat;
   background-position: 2px center;
@@ -2660,63 +2660,63 @@ div.grippie {
   background-color: #5D677B;
 }
 
-#crm-container .crm-accordion-header:hover {
+.crm-container .crm-accordion-header:hover {
   background-color: #32414f;
 }
 
-#crm-container .collapsed .crm-accordion-header {
+.crm-container .collapsed .crm-accordion-header {
   background-image: url("../i/TreePlusWhite.gif");
 }
 
-#crm-container .collapsed .crm-accordion-body,
-#crm-container .crm-collapsible.collapsed .collapsible-title + * {
+.crm-container .collapsed .crm-accordion-body,
+.crm-container .crm-collapsible.collapsed .collapsible-title + * {
   display: none;
 }
 
-#crm-container .crm-accordion-inner .crm-accordion-header,
-#crm-container .crm-accordion-wrapper .crm-master-accordion-header,
-#crm-container .crm-collapsible .collapsible-title {
+.crm-container .crm-accordion-inner .crm-accordion-header,
+.crm-container .crm-accordion-wrapper .crm-master-accordion-header,
+.crm-container .crm-collapsible .collapsible-title {
   background-image: url("../i/TreeMinus.gif");
   background-color: transparent;
   color: #3E3E3E;
 }
 
-#crm-container .crm-accordion-inner.collapsed .crm-accordion-header,
-#crm-container .crm-accordion-wrapper.collapsed .crm-master-accordion-header,
-#crm-container .crm-collapsible.collapsed .collapsible-title {
+.crm-container .crm-accordion-inner.collapsed .crm-accordion-header,
+.crm-container .crm-accordion-wrapper.collapsed .crm-master-accordion-header,
+.crm-container .crm-collapsible.collapsed .collapsible-title {
   background-image: url("../i/TreePlus.gif");
 }
 
-#crm-container .crm-accordion-wrapper .crm-master-accordion-header {
+.crm-container .crm-accordion-wrapper .crm-master-accordion-header {
   background-color: transparent;
   font-size: 16px;
   color: #3e3e3e;
   margin-bottom: 0px;
 }
 
-#crm-container .crm-accordion-inner .crm-accordion-header {
+.crm-container .crm-accordion-inner .crm-accordion-header {
   font-size: 12px;
 }
 
-#crm-container .crm-accordion-wrapper {
+.crm-container .crm-accordion-wrapper {
   margin-bottom: 4px;
 }
 
-#crm-container .crm-accordion-header {
+.crm-container .crm-accordion-header {
   -moz-border-radius: 4px 4px 0px 0px;
   -webkit-border-radius: 4px 4px 0px 0px;
   -khtml-border-radius: 4px 4px 0px 0px;
   border-radius: 4px 4px 0px 0px;
 }
 
-#crm-container .collapsed .crm-accordion-header {
+.crm-container .collapsed .crm-accordion-header {
   -moz-border-radius: 4px;
   -webkit-border-radius: 4px;
   -khtml-border-radius: 4px;
   border-radius: 4px;
 }
 
-#crm-container .crm-accordion-body {
+.crm-container .crm-accordion-body {
   -moz-border-radius: 0px 0px 4px 4px;
   -webkit-border-radius: 0px 0px 4px 4px;
   -khtml-border-radius: 0px 0px 4px 4px;
@@ -2726,7 +2726,7 @@ div.grippie {
   padding: 4px 0px;
 }
 
-#crm-container .crm-collapsible .collapsible-title {
+.crm-container .crm-collapsible .collapsible-title {
   padding-left: 19px;
   text-decoration: none;
   background-repeat: no-repeat;
@@ -2734,33 +2734,33 @@ div.grippie {
   cursor: pointer;
 }
 
-#crm-container .crm-master-accordion-header+.crm-accordion-body {
+.crm-container .crm-master-accordion-header+.crm-accordion-body {
   border: none;
   padding: 0px;
 }
 
-#crm-container .crm-accordion-header.active {
+.crm-container .crm-accordion-header.active {
   font-weight: bold;
   background-color: #41477E;
 }
 
-#crm-container .crm-accordion-header.active:hover {
+.crm-container .crm-accordion-header.active:hover {
   background-color: #2E3471;
 }
 
-#crm-container .crm-accordion-header a.close-accordion {
+.crm-container .crm-accordion-header a.close-accordion {
   font-weight: normal !important;
   float: right;
   color: #FFF !important;
   text-decoration: none;
 }
 
-#crm-container .crm-accordion-header a.close-accordion:hover {
+.crm-container .crm-accordion-header a.close-accordion:hover {
   text-decoration: underline !important;
 }
 
-#crm-container .crm-master-accordion-header.crm-accordion-header:hover,
-#crm-container .crm-collapsible .collapsible-title:hover {
+.crm-container .crm-master-accordion-header.crm-accordion-header:hover,
+.crm-container .crm-collapsible .collapsible-title:hover {
   background-color: transparent;
   color: #0200A0;
 }
diff --git a/templates/CRM/Case/Form/ActivityChangeStatus.js b/templates/CRM/Case/Form/ActivityChangeStatus.js
index 3273b4905b6ef296f57416f187251c88776c51fe..77e077fadf9139162e720f37e56ef793e7905011 100644
--- a/templates/CRM/Case/Form/ActivityChangeStatus.js
+++ b/templates/CRM/Case/Form/ActivityChangeStatus.js
@@ -3,67 +3,56 @@ cj(function($) {
   $('.crm-container').on('click', 'a.crm-activity-change-status', function() {
     changeActivityStatus(
       $(this).attr('activity_id'),
-      $(this).attr('contact_id'),
       $(this).attr('current_status'),
       $(this).attr('case_id')
     );
     return false;
   });
 
-  function changeActivityStatus(activityId, contactId, current_status_id, caseId) {
+  function changeActivityStatus(activityId, current_status_id, caseId) {
+    var o = $('<div class="crm-container crm-activity_change_status"></div>');
+    addCiviOverlay(o);
+
     var data = 'snippet=1&reset=1';
-    $('<div>')
-      .load(CRM.url('civicrm/case/changeactivitystatus'), data, function() {
-        cj("#activity_change_status").val(current_status_id);
-      })
-      .dialog({
-        modal: true,
-        title: ts('Change Activity Status'),
-        buttons: {
-          "Ok" : function() {
-            // update the status
-            var status_id = $("#activity_change_status").val( );
+    o.load(CRM.url('civicrm/case/changeactivitystatus'), data, function() {
+      removeCiviOverlay(o);
+      cj("#activity_change_status").val(current_status_id);
+    });
 
-            if (status_id === current_status_id) {
-              $(this).dialog('close').remove();
+    CRM.confirm(function() {
+        // update the status
+        var status_id = $("#activity_change_status").val( );
+        if (status_id === current_status_id) {
+          return false;
+        }
+
+        var dataUrl = CRM.url('civicrm/ajax/rest');
+        var data = 'json=1&version=3&entity=Activity&action=update&id=' + activityId + '&status_id=' + status_id
+          + '&case_id=' + caseId;
+        $.ajax({
+          type     : 'POST',
+          dataType : 'json',
+          url      : dataUrl,
+          data     : data,
+          success  : function(values) {
+            if (values.is_error) {
+              CRM.alert(values.error_message, ts('Unable to change status'), 'error');
               return false;
             }
-
-            var dataUrl = CRM.url('civicrm/ajax/rest');
-            var data = 'json=1&version=3&entity=Activity&action=update&id=' + activityId + '&status_id=' + status_id
-              + '&case_id=' + caseId;
-            $.ajax({
-              type     : "POST",
-              dataType : "json",
-              url      : dataUrl,
-              data     : data,
-              success  : function( values ) {
-                if ( values.is_error ) {
-                  // seems to be some discrepancy as to which spelling it should be
-                  var err_msg = values.error_msg ? values.error_msg : values.error_message;
-                  CRM.alert(err_msg, ts('Unable to change status'), 'error');
-                  return false;
-                }
-                else {
-                  // just reload the page on success
-                  window.location.reload();
-                }
-              },
-              error    : function( jqXHR, textStatus ) {
-                CRM.alert(jqXHR.responseText, jqXHR.statusText, 'error');
-                return false;
-              }
-            });
-
-            $(this).dialog('close').remove();
+            else {
+              // just reload the page on success
+              window.location.reload();
+            }
           },
-          "Cancel": function() {
-            $(this).dialog('close').remove();
+          error : function(jqXHR) {
+            CRM.alert(jqXHR.responseText, jqXHR.statusText, 'error');
+            return false;
           }
-        },
-        beforeClose: function() {
-          $(this).dialog("destroy");
-        }
+        });
+      }
+      ,{
+        title: ts('Change Activity Status'),
+        message: o
       }
     );
   }
diff --git a/templates/CRM/Case/Form/CaseView.tpl b/templates/CRM/Case/Form/CaseView.tpl
index 955c03b06e592b7c349c19707720ec669ec2bc78..df0ad7e3b054eb2da29059358d42b9ef0da46c2d 100644
--- a/templates/CRM/Case/Form/CaseView.tpl
+++ b/templates/CRM/Case/Form/CaseView.tpl
@@ -1123,3 +1123,4 @@ function printCaseReport( ) {
 
 {/if} {* view related cases if end *}
 </div>
+{include file="CRM/common/overlay.tpl"}
diff --git a/templates/CRM/Case/Form/Selector.tpl b/templates/CRM/Case/Form/Selector.tpl
index 7c96eff158af5ee3d07aef01128b1cc27f9a070f..1b86ee5113950bd8aa3110a052b5818bf11b8777 100644
--- a/templates/CRM/Case/Form/Selector.tpl
+++ b/templates/CRM/Case/Form/Selector.tpl
@@ -165,3 +165,4 @@ function buildCaseDetails( caseId, contactId )
 </script>
 
 {/literal}
+{include file="CRM/common/overlay.tpl"}
diff --git a/templates/CRM/Case/Page/DashBoard.tpl b/templates/CRM/Case/Page/DashBoard.tpl
index 102e6fb714bc43790cbed05593a985b84be04779..22d415570a1d81f184bffd07e1d6d6ff106411a1 100644
--- a/templates/CRM/Case/Page/DashBoard.tpl
+++ b/templates/CRM/Case/Page/DashBoard.tpl
@@ -110,3 +110,4 @@
     {/if}
 {/if}
 </div>
+{include file="CRM/common/overlay.tpl"}
diff --git a/templates/CRM/Contact/Form/Edit/TagsAndGroups.tpl b/templates/CRM/Contact/Form/Edit/TagsAndGroups.tpl
index 7cf07b93609d99d106f0c5fc74f008ec0635b318..553c307a9f40f2291688c48cb1bb28fc5398f0e0 100644
--- a/templates/CRM/Contact/Form/Edit/TagsAndGroups.tpl
+++ b/templates/CRM/Contact/Form/Edit/TagsAndGroups.tpl
@@ -25,43 +25,42 @@
 *}
 {if $title}
 <div class="crm-accordion-wrapper crm-tagGroup-accordion collapsed">
- <div class="crm-accordion-header">
-    {$title}
-  </div><!-- /.crm-accordion-header -->
+  <div class="crm-accordion-header">{$title}</div>
   <div class="crm-accordion-body" id="tagGroup">
 {/if}
     <table class="form-layout-compressed{if $context EQ 'profile'} crm-profile-tagsandgroups{/if}">
-  <tr>
+      <tr>
       {foreach key=key item=item from=$tagGroup}
-    {* $type assigned from dynamic.tpl *}
-    {if !$type || $type eq $key }
-    <td width={cycle name=tdWidth values="70%","30%"}><span class="label">{if $title}{$form.$key.label}{/if}</span>
-        <div id="crm-tagListWrap">
-        <table id="crm-tagGroupTable">
-      {foreach key=k item=it from=$form.$key}
-          {if $k|is_numeric}
-        <tr class={cycle values="'odd-row','even-row'" name=$key} id="crm-tagRow{$k}">
-            <td>
-          <strong>{$it.html}</strong><br />
-          {if $item.$k.description}
-              <div class="description">
-            {$item.$k.description}
-              </div>
-          {/if}
-            </td>
-        </tr>
-          {/if}
+        {* $type assigned from dynamic.tpl *}
+        {if !$type || $type eq $key }
+          <td width={cycle name=tdWidth values="70%","30%"}><span class="label">{if $title}{$form.$key.label}{/if}</span>
+            <div id="crm-tagListWrap">
+              <table id="crm-tagGroupTable">
+                {foreach key=k item=it from=$form.$key}
+                  {if $k|is_numeric}
+                    <tr class={cycle values="'odd-row','even-row'" name=$key} id="crm-tagRow{$k}">
+                      <td>
+                        <strong>{$it.html}</strong><br />
+                        {if $item.$k.description}
+                          <div class="description">
+                            {$item.$k.description}
+                          </div>
+                        {/if}
+                      </td>
+                    </tr>
+                  {/if}
+                {/foreach}
+              </table>
+            </div>
+          </td>
+        {/if}
       {/foreach}
-        </table>
-        </div>
-    </td>
+    </tr>
+    {if !$type || $type eq 'tag'}
+      <tr><td>{include file="CRM/common/Tag.tpl"}</td></tr>
     {/if}
-      {/foreach}
-  </tr>
-  <tr><td>{include file="CRM/common/Tag.tpl"}</td></tr>
-    </table>
+  </table>
 {if $title}
- </div><!-- /.crm-accordion-body -->
+  </div>
 </div><!-- /.crm-accordion-wrapper -->
-
 {/if}
diff --git a/templates/CRM/common/dashboard.tpl b/templates/CRM/common/dashboard.tpl
index 16e1bfa1c24d623469ef172adf4465bb712d3c7e..654950259040201bd3529148ba87b9f640c1db63 100644
--- a/templates/CRM/common/dashboard.tpl
+++ b/templates/CRM/common/dashboard.tpl
@@ -26,8 +26,7 @@
 {literal}
 <script type="text/javascript">
     
-// Create closure, so that we don't accidentally spoil the global/window namespace.
-cj(function() {
+cj(function($) {
   // The set of options we can use to initialize jQuery.dashboard().
   var options = {
     // Optional. Defaults to 3.  You'll need to change the width of columns in CSS too.
@@ -204,12 +203,10 @@ cj(function() {
     }
   };
 
-  // Initialize the dashboard using these options, and save to the global/window
-  // namesapace so that server-side executable js file callbacks can access
-  // window.dashboardDemo.widgets by ID.
-  window.dashboardDemo = cj('#civicrm-dashboard').dashboard(options);
+  // Initialize the dashboard using these options
+  $('#civicrm-dashboard').dashboard(options);
 
-}); // End closure.
+});
 
 </script>
 {/literal}
diff --git a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php
index 8a06cebaa98c46dffb664db6c70c214fa8e66112..06f364ff3b5d9eadaf97d9cb1b7f91ebc7641d10 100644
--- a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php
+++ b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php
@@ -146,5 +146,94 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase {
       )
     );
   }
+
+  function testSeparateActivityForMultiTargetContacts() {
+    $this->webtestLogin();
+
+    //creating contacts
+    $firstName1 = substr(sha1(rand()), 0, 7);
+    $this->webtestAddContact($firstName1, "Summerson", $firstName1 . "@summerson.name");
+    $firstName2 = substr(sha1(rand()), 0, 7);
+    $this->webtestAddContact($firstName2, "Andersonnn", $firstName2 . "@anderson.name");
+    $firstName3 = substr(sha1(rand()), 0, 7);
+    $this->webtestAddContact($firstName3, "Anderson", $firstName3 . "@andersonnn.name");
+
+    $this->click("css=li#tab_activity a");
+
+    // waiting for the activity dropdown to show up
+    $this->waitForElementPresent("other_activity");
+
+    // Select the activity type from the activity dropdown
+    $this->select("other_activity", "label=Meeting");
+    $this->waitForPageToLoad($this->getTimeoutMsec());
+
+    // ...and verifying if the page contains properly formatted display name for chosen contact.
+    $this->waitForText('css=tr.crm-activity-form-block-target_contact_id td ul li.token-input-token-facebook', 'Anderson, ' . $firstName3, 'Contact not found in line ' . __LINE__);
+
+    //filling the second target Contact
+    $this->click("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1");
+    $this->type("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", $firstName1);
+    $this->typeKeys("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", $firstName1);
+
+    // ...waiting for drop down with results to show up...
+    $this->waitForElementPresent("css=div.token-input-dropdown-facebook");
+    $this->waitForElementPresent("css=li.token-input-dropdown-item2-facebook");
+
+    // ...need to use mouseDownAt on first result (which is a li element), click does not work
+    $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook");
+
+    // ...again, waiting for the box with contact name to show up...
+    $this->waitForElementPresent("css=tr.crm-activity-form-block-target_contact_id td ul li span.token-input-delete-token-facebook");
+
+    // ...and verifying if the page contains properly formatted display name for chosen contact.
+    $this->waitForText('css=tr.crm-activity-form-block-target_contact_id td ul', 'Summerson, ' . $firstName1, 'Contact not found in line ' . __LINE__);
+
+    //filling the third target contact
+    $this->click("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1");
+    $this->type("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", $firstName2);
+    $this->typeKeys("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", $firstName2);
+
+    // ...waiting for drop down with results to show up...
+    $this->waitForElementPresent("css=div.token-input-dropdown-facebook");
+    $this->waitForElementPresent("css=li.token-input-dropdown-item2-facebook");
+
+    // ...need to use mouseDownAt on first result (which is a li element), click does not work
+    $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook");
+
+    // ...again, waiting for the box with contact name to show up...
+    $this->waitForElementPresent("css=tr.crm-activity-form-block-target_contact_id td ul li span.token-input-delete-token-facebook");
+
+    // ...and verifying if the page contains properly formatted display name for chosen contact.
+    $this->waitForText('css=tr.crm-activity-form-block-target_contact_id td ul', 'Andersonnn, ' . $firstName2, 'Contact not found in line ' . __LINE__);
+
+    //check the checkbox to create a separate activity for the selected target contacts
+    $this->check('is_multi_activity');
+
+    $subject = "This is subject of test activity for creating a separate activity for contacts {$firstName1},{$firstName2} and {$firstName3}.";
+    $this->type("subject", $subject);
+  
+    $this->webtestFillDateTime('activity_date_time', '+1 month 11:10PM');
+    $this->select("status_id", "value=1");
+
+    // Clicking save.
+    $this->clickLink('_qf_Activity_upload');
+
+    // Is status message correct?
+    $this->waitForText('crm-notification-container', $subject);
+
+    //activity search page
+    $this->openCiviPage('activity/search', 'reset=1');
+    
+    $this->type('activity_subject', $subject);
+    
+    $this->clickLink('_qf_Search_refresh');
+
+    $targetContacts = array("Summerson, ". $firstName1, "Andersonnn, ". $firstName2, "Anderson, ". $firstName3 );
+
+    //check whether separate activities are created for the target contacts
+    foreach ($targetContacts as $contact) {
+      $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody//tr/td[5]/a[text()='$contact']"));
+    }
+  }
 }
 
diff --git a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php
index 8015d746b1d02a916a34a5f5b957e75100f00e78..9c53597e2d588896b1e571c5045c0804446fc97a 100644
--- a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php
+++ b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php
@@ -534,8 +534,8 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent('_qf_Interview_cancel_interview');
 
     $this->type("field_{$id1}_phone-Primary-1", 9876543210);
-    $this->click("//table[@id='voterRecords']/tbody//tr[@id='row_{$id1}']/td[5]/input[2]/../label[text()='$label1']");
-    $this->click("//table[@id='voterRecords']/tbody//tr[@id='row_{$id1}']/td[5]/input[6]/../label[text()='$label2']");
+    $this->click("//table[@id='voterRecords']/tbody//tr[@id='row_{$id1}']/td[7]/input[2]/../label[text()='$label1']");
+    $this->click("//table[@id='voterRecords']/tbody//tr[@id='row_{$id1}']/td[7]/input[6]/../label[text()='$label2']");
     $this->select("field_{$id1}_result", $optionLabel1);
     $this->click("interview_voter_button_{$id1}");
     // Because it tends to cause problems, all uses of sleep() must be justified in comments
diff --git a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php
index 6f069c3aaa50897e5ca105fb004d00719a5391cc..2425293b9d8f6f58021c79b9c871217ffc317e20 100644
--- a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php
+++ b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php
@@ -206,7 +206,7 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase {
 
     $this->click("xpath=//div[@id='activities']//table[@id='activities-selector']/tbody//tr/td[2]/a[text()='{$subject}']/../../td[6]/a[text()='Scheduled']");
 
-    $this->waitForElementPresent("css=div#changeStatusDialog");
+    $this->waitForElementPresent("xpath=//html/body/div[7]");
     $this->waitForElementPresent('activity_change_status');
 
     // change activity status
diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php
index 8826cecd2dbba28df5e957d8324a12e719fdeda0..e82a3868569784c5693292b606c1d25604710647 100644
--- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php
+++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php
@@ -101,7 +101,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
     $this->click("_qf_Contact_refresh_dedupe");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertTrue($this->isTextPresent("One matching contact was found. You can View or Edit the existing contact."));
+    $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact.");
     $this->click("_qf_Contact_upload_duplicate");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->waitForText('crm-notification-container', "Contact Saved");
@@ -119,7 +119,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
     $this->type("email_1_email", $email2);
     $this->click("_qf_Contact_refresh_dedupe");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent("One matching contact was found. You can View or Edit the existing contact."));
+    $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact.");
     $this->click("_qf_Contact_upload_duplicate");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->waitForText('crm-notification-container', "Contact Saved");
@@ -263,7 +263,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Is status message correct?
-    $this->assertTrue($this->isTextPresent("Activity '$subject' has been saved."), "Status message didn't show up after saving!");
+    $this->waitForText('crm-notification-container', "Activity '$subject' has been saved.", "Status message didn't show up after saving!");
   }
 
   function testMergeTest() {
@@ -322,7 +322,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
     $this->click("_qf_Contact_refresh_dedupe");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertTrue($this->isTextPresent("One matching contact was found. You can View or Edit the existing contact."));
+    $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact.");
     $this->click("_qf_Contact_upload_duplicate");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->waitForText('crm-notification-container', "Contact Saved");
@@ -411,7 +411,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
     // Clicking save.
     $this->click("_qf_Contact_refresh_dedupe");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent("One matching contact was found. You can View or Edit the existing contact."));
+    $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact.");
     $this->click("_qf_Contact_upload_duplicate");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->waitForText('crm-notification-container', "Contact Saved");
@@ -520,7 +520,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
     $this->click("_qf_Contact_refresh_dedupe");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertTrue($this->isTextPresent("One matching contact was found. You can View or Edit the existing contact."));
+    $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact.");
     $this->click("_qf_Contact_upload_duplicate");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->waitForText('crm-notification-container', "Contact Saved");
@@ -629,7 +629,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
     $this->click("_qf_Contact_refresh_dedupe");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertTrue($this->isTextPresent("One matching contact was found. You can View or Edit the existing contact."));
+    $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact.");
     $this->click("_qf_Contact_upload_duplicate");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->waitForText('crm-notification-container', "Contact Saved");