First working DetectCommutationZeroCrossing - very ugly, to be revised!