CRM-12639-improvements : code improvements which also fixes the failing tests https://test.civicrm.org/job/CiviCRM-master-git/LABEL=debian6,SUITE=api_v3_AllTests/397/

CRM-12639-improvements : code improvements which also fixes the failing tests https://test.civicrm.org/job/CiviCRM-master-git/LABEL=debian6,SUITE=api_v3_AllTests/397/