CRM-12809

Points 1, 2, 3 and 4 of issue CRM-12809.