fixing scoping issues that steve found