Add AMD support

Added code to support Asynchronous Module Definition. This prevents polluting the global scope for people using libraries like require.js