revised IIFE to be self-contained