Add window at the end of the IIFE because we need to pass it to the function.