modified main.cpp