separated main.cpp into several files