Update to main.cpp

replaced the whole main.cpp