added comments in main outlining calling mainTerminate