Use UMD pattern for compatibility with different module formats

The UMD pattern is a little cleaner than the ol' faithful wrap function. Tests passing and checked loading in browser examples.