Redo of main.cpp

Recode