Add comments, compatibility improvements

Should now be compatible with AMD, CommonJS, NodeJs, etc