altered scope of many variables to private