Compiling with -D_GLIBCXX_DEBUG enables libstc++ "debug mode", where
additional debug information is tracked with iterators and reported if
iterators are misused. This turned up two bugs.
I threw in removing dead code and avoiding an unnecessary map lookup
while I was in the neighborhood.