MAINT: move more code into cython