I'll add a comment about holding cs_main, and will note that when we switch to C++11 replacing it with lambda expressions will probably make sense.