encapsulating script in IIFE