This seems 'meh'. Something about global variables makes my skin crawl.