Check for updates outside of the loop to avoid doing it more than once