remove unshared vars from higher scope