Made these variables local rather than global.