Stopping variables leaking to global