Update, add function to the main loop