completed splitting the main.cpp glue code into modules