MAINT: replace another code chunk with a call to an existing function