Wrap code in IIFE to prevent variable hoisting