replaced window.onload with IIFE