It's not easy task. Just came to my mind, calibrating the zero crossing was the biggest obstacle. If you don't do it correctly, it can easily shift the phase cut delay from one half cycle to another. I wrote about it in another topic some while ago.