DEV: Begin refactoring of main.cpp