Add the template of main loop.