New main loop