Change scope variables to local variables