update to use single IIFE