Cythonization improvements