Pass factory to define()

Also, the deps array is optional so get rid of that.
Merge pull request #8 from matthewwithanm/fix-amd

Pass factory to define()