just learned a lot about scoping in javascript.