Would love to see things like the deletion handler pulled out into a named function, for instance, but this commit does not have to boil the entire ocean, just solve the memory problem.