changed main.cpp slightly