main.cpp clean up