updated to use iife pattern