Improved buffer clear function by calling remove callback using iterators then doing an actual clear