change some variables to local