Rewrite main.cc