Removed all global references as such a reference is no longer necessary and bad practice. Changed index.html so that foo.js is loaded last to demostrate delayed loading with dependencies. Simplified some of the code.