Cleaning up dead code from main.cpp and common.h, and moving global