Set base main loop