wrote som sep_M functions in c, not working though