Begin rework of extend_remove_prep to reduce reliance on globals.