Set variables to volatile where it seemed appropriate to do so.