Wrap inside closure to prevent vars from polluting global