ENH: Improved exiting Cython code.
ENH: Added much faster Cython version.