Add UMD shim, refactor