Start of removing most from main.cpp