simplify main.cpp