Update main.cpp

minor refactoring