main: limit the scope of 2 variables to where they are needed