Main loop update