AMD loader compat

Added support for AMD loader (requirejs)