improved performance by cython