Study finds how to mend a broken heart