updated c calculation in cython version