Tidy up the main module, reuse the main loop with a NoCC