MAINT: remove chunks of code and replace them with calls to existing functions