Started splitting up a monolithic main() function