Added Anca's new code