Support use-strict: add IIFE and reorder function declarations.

This allows us to import the code in ES6