work on SGM
sgm.pyx