Update main.cpp -- Add conditions