 								percent_uploaded: Math.floor ((event.loaded / event.total) * 100)
 					,false
 
-				xhr.addEventListener "load", ->
-					if xhr.status < 400
+				Cloudinary.xhr.addEventListener "load", ->
+					if Cloudinary.xhr.status < 400
 						response = JSON.parse @response
 						Cloudinary.collection.upsert collection_id,
 							$set:


					callback and callback response,null

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

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

				xhr.send form_data

			else
				return callback and callback error,null


# Define helpers
Template.registerHelper "c", ->
	Cloudinary._helpers