updating the cython implementation