MAINT: replace a block of code that does the same thing that an existing function already does