Rewrite Chapter 5 Global variables