being a little smarter about the scope in which things are defined