Use global object passed into IIFE rather than window
JSHint fixes