Reorganize main.cpp: argument struct and separate fcts