Add AMD support

Adds support for AMD style javascript modules.