decomposed main.cpp into two files to be slightly more readable