 					return callback and callback null,result
 
 	upload: (files, ops={}, callback) ->
+		if _.isFunction ops
+			callback = ops
+			ops = {}
+
 		_.each files, (file) ->
 			reader = new FileReader
 


					callback and callback response,null

				Cloudinary.xhr.addEventListener "abort", ->
					Cloudinary.collection.upsert collection_id,
						$set:
							status:"aborted"

				Cloudinary.xhr.open "POST",result.form_attrs.action,true

				Cloudinary.xhr.send form_data

			else
				return callback and callback error,null


# Define helpers


	_upload_file: (file, ops={}, callback) ->
		Meteor.call "c.sign", ops, (error,result) ->
			console.log error
			console.log result
			console.log callback

			if error
				return callback and callback error,null

			# Build form
			form_data = new FormData()
			_.each result.hidden_fields, (v,k) ->
				form_data.append k,v

			form_data.append "file",file

			# Create collection document ID
			collection_id = Random.id()

			# Send data
			Cloudinary.xhr = new XMLHttpRequest()

			Cloudinary.collection.insert
				_id:collection_id
				status:"uploading"
				preview:file

			Cloudinary.xhr.upload.addEventListener "progress", (event) ->
					Cloudinary.collection.update _id:collection_id,
						$set:
							loaded:event.loaded
							total:event.total
							percent_uploaded: Math.floor ((event.loaded / event.total) * 100)
				,false

			Cloudinary.xhr.addEventListener "load", ->
				if Cloudinary.xhr.status < 400
					response = JSON.parse @response
					Cloudinary.collection.upsert collection_id,
						$set:
							status:"complete"
							percent_uploaded: 100
							response: response

					callback and callback null,response
				else
					response = JSON.parse @response
					Cloudinary.collection.upsert collection_id,
						$set:
