Declaring variables with var to avoid data becoming global.