New envelope.pyx and changes to envelope for Cythonification.