changed this reference to explicit window reference passed in to IIFE