Tiny optimizations in insert and erase