main.cpp modified