MAINT: put more code into C