Completed all of this exercise, except one issue with a global variable