Made some updates to cythonized code