MAINT: use more vectorization