Changed the Cython generator into a class.