diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php
index b84e575bc8358c2baf68ad8fd543517021d7ea9c..e0c0e83d5d0f71742e1c3a932d22736867a1e7fa 100644
--- a/apps/calendar/lib/object.php
+++ b/apps/calendar/lib/object.php
@@ -96,8 +96,7 @@ class OC_Calendar_Object{
 		list($type,$startdate,$enddate,$summary,$repeating,$uid) = self::extractData($object);
 
 		if(is_null($uid)){
-			$uid = self::createUID();
-			$object->add('UID',$uid);
+			$object->setUID();
 			$data = $object->serialize();
 		}
 
@@ -208,14 +207,6 @@ class OC_Calendar_Object{
 		return true;
 	}
 
-	/**
-	 * @brief Creates a UID
-	 * @return string
-	 */
-	protected static function createUID(){
-		return substr(md5(rand().time()),0,10);
-	}
-
 	/**
 	 * @brief Extracts data from a vObject-Object
 	 * @param Sabre_VObject $object
diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php
index b1dc69a469105d56dfc56b3423dd40078ff6948f..49a4a16170b8a18c62ed482132522778a1419580 100644
--- a/apps/contacts/ajax/addcard.php
+++ b/apps/contacts/ajax/addcard.php
@@ -92,7 +92,7 @@ foreach( $add as $propname){
 		}
 	}
 }
-$id = OC_Contacts_VCard::add($aid,$vcard->serialize());
+$id = OC_Contacts_VCard::add($aid,$vcard);
 if(!$id) {
 	OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('There was an error adding the contact.'))));
 	OC_Log::write('contacts','ajax/addcard.php: Recieved non-positive ID on adding card: '.$id, OC_Log::ERROR);
diff --git a/apps/contacts/ajax/addcontact.php b/apps/contacts/ajax/addcontact.php
index 5d17631caa4deff8bc04386d3e2b3419121aa081..839a39199811dbbe451e0b3ed3991a357d038dcb 100644
--- a/apps/contacts/ajax/addcontact.php
+++ b/apps/contacts/ajax/addcontact.php
@@ -52,7 +52,7 @@ $vcard->setUID();
 $vcard->setString('FN',$fn);
 $vcard->setString('N',$n);
 
-$id = OC_Contacts_VCard::add($aid,$vcard->serialize());
+$id = OC_Contacts_VCard::add($aid,$vcard);
 if(!$id) {
 	OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('There was an error adding the contact.'))));
 	OC_Log::write('contacts','ajax/addcontact.php: Recieved non-positive ID on adding card: '.$id, OC_Log::ERROR);
diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php
index a28aed34d2ca86e4405b6602cc13f483178c0972..e1a31292837fbc01a196dffc4c9a474d103ca546 100644
--- a/apps/contacts/ajax/addproperty.php
+++ b/apps/contacts/ajax/addproperty.php
@@ -116,7 +116,7 @@ foreach ($parameters as $key=>$element) {
 }
 $checksum = md5($vcard->children[$line]->serialize());
 
-if(!OC_Contacts_VCard::edit($id,$vcard->serialize())) {
+if(!OC_Contacts_VCard::edit($id,$vcard)) {
 	OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error adding contact property.'))));
 	OC_Log::write('contacts','ajax/addproperty.php: Error updating contact property: '.$name, OC_Log::ERROR);
 	exit();
diff --git a/apps/contacts/ajax/deleteproperty.php b/apps/contacts/ajax/deleteproperty.php
index a9afffaad4c490f6902f416a4940c4be78ed456b..ab0958cac58ab0a6cdb5c9ff3d2da78871c9845b 100644
--- a/apps/contacts/ajax/deleteproperty.php
+++ b/apps/contacts/ajax/deleteproperty.php
@@ -39,7 +39,7 @@ if(is_null($line)){
 
 unset($vcard->children[$line]);
 
-if(!OC_Contacts_VCard::edit($id,$vcard->serialize())) {
+if(!OC_Contacts_VCard::edit($id,$vcard)) {
 	OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error deleting contact property.'))));
 	OC_Log::write('contacts','ajax/deleteproperty.php: Error deleting contact property', OC_Log::ERROR);
 	exit();
diff --git a/apps/contacts/ajax/savecrop.php b/apps/contacts/ajax/savecrop.php
index 1a84f6fdfaea55c0d5b5711b0fff52aeef26f062..ffbfaeb6e384c1998c8e05b99f6a513e0101eeb0 100644
--- a/apps/contacts/ajax/savecrop.php
+++ b/apps/contacts/ajax/savecrop.php
@@ -95,7 +95,7 @@ if(file_exists($tmp_path)) {
 						OC_Log::write('contacts','savecrop.php: files: Adding PHOTO property.', OC_Log::DEBUG);
 						$card->addProperty('PHOTO', $image->__toString(), array('ENCODING' => 'b', 'TYPE' => $image->mimeType()));
 					}
-					if(!OC_Contacts_VCard::edit($id,$card->serialize())) {
+					if(!OC_Contacts_VCard::edit($id,$card)) {
 						bailOut('Error saving contact.');
 					}
 					unlink($tmpfname);
diff --git a/apps/contacts/ajax/saveproperty.php b/apps/contacts/ajax/saveproperty.php
index e31c4b7c2384be57e303fddcc3b57b8c2acf5184..3a50d18e6a6bfef8a947f37deadec1e538b67c60 100644
--- a/apps/contacts/ajax/saveproperty.php
+++ b/apps/contacts/ajax/saveproperty.php
@@ -128,8 +128,14 @@ switch($element) {
 $checksum = md5($vcard->children[$line]->serialize());
 debug('New checksum: '.$checksum);
 
+<<<<<<< HEAD
 if(!OC_Contacts_VCard::edit($id,$vcard->serialize())) {
 	bailOut(OC_Contacts_App::$l10n->t('Error updating contact property.'));
+=======
+if(!OC_Contacts_VCard::edit($id,$vcard)) {
+	OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error updating contact property.'))));
+	OC_Log::write('contacts','ajax/setproperty.php: Error updating contact property: '.$value, OC_Log::ERROR);
+>>>>>>> d8cfe77ba5348d29a9e2b046e2c7efc1dd4758cb
 	exit();
 }
 
diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php
index f9e2a8e864733dfec8652cb15f63c382a3cb2c07..8e07b4a8f1cd383498f4683b91e32e2e163b1fcb 100644
--- a/apps/contacts/ajax/setproperty.php
+++ b/apps/contacts/ajax/setproperty.php
@@ -80,7 +80,7 @@ foreach($missingparameters as $i){
 // NOTE: This checksum is not used..?
 $checksum = md5($vcard->children[$line]->serialize());
 
-if(!OC_Contacts_VCard::edit($id,$vcard->serialize())) {
+if(!OC_Contacts_VCard::edit($id,$vcard)) {
 	OC_JSON::error(array('data' => array('message' => $l->t('Error updating contact property.'))));
 	OC_Log::write('contacts','ajax/setproperty.php: Error updating contact property: '.$value, OC_Log::ERROR);
 	exit();
diff --git a/apps/contacts/import.php b/apps/contacts/import.php
index 4638bf0d73cd609ff6ac4e9e4d6efc6ede26954e..04cfc397d56a7322dadbaae7ad90f8e551092f3b 100644
--- a/apps/contacts/import.php
+++ b/apps/contacts/import.php
@@ -97,11 +97,15 @@ if(is_writable('import_tmp/')){
 	fclose($progressfopen);
 }
 if(count($parts) == 1){
-	OC_Contacts_VCard::add($id, $file);
-}else{
-	foreach($importready as $import){
-		OC_Contacts_VCard::add($id, $import);
+	$importready = array($file);
+}
+foreach($importready as $import){
+	$card = OC_VObject::parse($import);
+	if (!$card) {
+		OC_Log::write('contacts','Import: skipping card. Error parsing VCard: '.$import, OC_Log::ERROR);
+		continue; // Ditch cards that can't be parsed by Sabre.
 	}
+	OC_Contacts_VCard::add($id, $card);
 }
 //done the import
 if(is_writable('import_tmp/')){
@@ -113,4 +117,4 @@ sleep(3);
 if(is_writable('import_tmp/')){
 	unlink($progressfile);
 }
-OC_JSON::success();
\ No newline at end of file
+OC_JSON::success();
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index d86842a4317f17c841b90fd553ac06e46abf53dd..483d2a228d1989e4a1bb371ef4a5e418d9769260 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -166,7 +166,7 @@ Contacts={
 			return $(obj).parents('.propertycontainer').first().data('element');
 		},
 		showHideContactInfo:function() {
-			var show = ($('#emaillist li[class*="propertycontainer"]').length > 0 || $('#phonelist li[class*="propertycontainer"]').length > 0 || $('#addressdisplay dl[class*="propertycontainer"]').length > 0);
+			var show = ($('#emaillist li.propertycontainer').length > 0 || $('#phonelist li.propertycontainer').length > 0 || $('#addressdisplay dl.propertycontainer').length > 0);
 			console.log('showHideContactInfo: ' + show);
 			if(show) {
 				$('#contact_communication').show();
@@ -180,19 +180,19 @@ Contacts={
 			switch (type) {
 				case 'EMAIL':
 					console.log('emails: '+$('#emaillist>li').length);
-					if($('#emaillist li[class*="propertycontainer"]').length == 0) {
+					if($('#emaillist li.propertycontainer').length == 0) {
 						$('#emails').hide();
 					}
 					break;
 				case 'TEL':
 					console.log('phones: '+$('#phonelist>li').length);
-					if($('#phonelist li[class*="propertycontainer"]').length == 0) {
+					if($('#phonelist li.propertycontainer').length == 0) {
 						$('#phones').hide();
 					}
 					break;
 				case 'ADR':
 					console.log('addresses: '+$('#addressdisplay>dl').length);
-					if($('#addressdisplay dl[class*="propertycontainer"]').length == 0) {
+					if($('#addressdisplay dl.propertycontainer').length == 0) {
 						$('#addresses').hide();
 					}
 					break;
@@ -259,7 +259,7 @@ Contacts={
 										classes: 'categories'
 									});
 			// Style phone types
-			$('#phonelist').find('select[class*="contacts_property"]').multiselect({
+			$('#phonelist').find('select.contacts_property').multiselect({
 													noneSelectedText: t('contacts', 'Select type'),
 													header: false,
 													selectedList: 4,
@@ -459,7 +459,7 @@ Contacts={
 			loadSingleProperties:function() {
 				var props = ['BDAY', 'NICKNAME', 'ORG'];
 				// Clear all elements
-				$('#ident .propertycontainer[class*="propertycontainer"]').each(function(){
+				$('#ident .propertycontainer').each(function(){
 					if(props.indexOf($(this).data('element')) > -1) {
 						$(this).data('checksum', '');
 						$(this).find('input').val('');
@@ -534,6 +534,9 @@ Contacts={
 				$('#fn_select option').remove();
 				$('#fn_select').combobox('value', this.fn);
 				var names = [this.fullname, this.givname + ' ' + this.famname, this.famname + ' ' + this.givname, this.famname + ', ' + this.givname];
+				if(this.data.ORG) {
+					names[names.length]=this.data.ORG[0].value;
+				}
 				$.each(names, function(key, value) {
 					$('#fn_select')
 						.append($('<option></option>')
@@ -652,8 +655,8 @@ Contacts={
 				var checksum = container.data('checksum');
 				var name = container.data('element');
 				console.log('saveProperty: ' + name);
-				var fields = container.find('input[class*="contacts_property"],select[class*="contacts_property"]').serializeArray();
-				var q = container.find('input[class*="contacts_property"],select[class*="contacts_property"]').serialize();
+				var fields = container.find('input.contacts_property,select.contacts_property').serializeArray();
+				var q = container.find('input.contacts_property,select.contacts_property').serialize();
 				if(q == '' || q == undefined) {
 					console.log('Couldn\'t serialize elements.');
 					Contacts.UI.loading(container, false);
@@ -863,7 +866,7 @@ Contacts={
 			},
 			loadAddresses:function(){
 				$('#addresses').hide();
-				$('#addressdisplay dl[class*="propertycontainer"]').remove();
+				$('#addressdisplay dl.propertycontainer').remove();
 				for(var adr in this.data.ADR) {
 					$('#addressdisplay dl').first().clone().insertAfter($('#addressdisplay dl').last()).show();
 					$('#addressdisplay dl').last().removeClass('template').addClass('propertycontainer');
@@ -1079,15 +1082,15 @@ Contacts={
 			},
 			addMail:function() {
 				//alert('addMail');
-				$('#emaillist li[class*="template"]:first-child').clone().appendTo($('#emaillist')).show();
-				$('#emaillist li[class*="template"]:last-child').removeClass('template').addClass('propertycontainer');
+				$('#emaillist li.template:first-child').clone().appendTo($('#emaillist')).show();
+				$('#emaillist li.template:last-child').removeClass('template').addClass('propertycontainer');
 				$('#emaillist li:last-child').find('input[type="email"]').focus();
 				Contacts.UI.loadListHandlers();
 				return false;
 			},
 			loadMails:function() {
 				$('#emails').hide();
-				$('#emaillist li[class*="propertycontainer"]').remove();
+				$('#emaillist li.propertycontainer').remove();
 				for(var mail in this.data.EMAIL) {
 					this.addMail();
 					//$('#emaillist li:first-child').clone().appendTo($('#emaillist')).show();
@@ -1109,9 +1112,9 @@ Contacts={
 				return false;
 			},
 			addPhone:function() {
-				$('#phonelist li[class*="template"]:first-child').clone().appendTo($('#phonelist')); //.show();
-				$('#phonelist li[class*="template"]:last-child').find('select').addClass('contacts_property');
-				$('#phonelist li[class*="template"]:last-child').removeClass('template').addClass('propertycontainer');
+				$('#phonelist li.template:first-child').clone().appendTo($('#phonelist')); //.show();
+				$('#phonelist li.template:last-child').find('select').addClass('contacts_property');
+				$('#phonelist li.template:last-child').removeClass('template').addClass('propertycontainer');
 				$('#phonelist li:last-child').find('input[type="text"]').focus();
 				Contacts.UI.loadListHandlers();
 				$('#phonelist li:last-child').find('select').multiselect({
@@ -1125,7 +1128,7 @@ Contacts={
 			},
 			loadPhones:function() {
 				$('#phones').hide();
-				$('#phonelist li[class*="propertycontainer"]').remove();
+				$('#phonelist li.propertycontainer').remove();
 				for(var phone in this.data.TEL) {
 					this.addPhone();
 					$('#phonelist li:last-child').find('select').multiselect('destroy');
diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php
index 47220e0bc8cf3d67a1039b7bc4370133dc3f5e22..1fa441475d2ec76aff1b37c2a64fdeeee7319fea 100644
--- a/apps/contacts/lib/app.php
+++ b/apps/contacts/lib/app.php
@@ -94,7 +94,7 @@ class OC_Contacts_App {
 				OC_Log::write('contacts','getContactVCard, found FN field: '.$vcard->__get('FN'), OC_Log::DEBUG);
 				$n = implode(';', array_reverse(array_slice(explode(' ', $vcard->__get('FN')), 0, 2))).';;;';
 				$vcard->setString('N', $n);
-				OC_Contacts_VCard::edit( $id, $vcard->serialize());
+				OC_Contacts_VCard::edit( $id, $vcard);
 			} else { // Else just add an empty 'N' field :-P
 				$vcard->setString('N', 'Unknown;Name;;;');
 			}
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index 3c95dd19abff3fb2ab4a6fee340bd8e41395e10c..50370370898bd12bf8ff831b43942efe5b2e0dd1 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -175,6 +175,9 @@ class OC_Contacts_VCard{
 			if($property->name == 'UID'){
 				$uid = $property->value;
 			}
+			if($property->name == 'ORG'){
+				$org = $property->value;
+			}
 			if($property->name == 'EMAIL' && is_null($email)){ // only use the first email as substitute for missing N or FN.
 				$email = $property->value;
 			}
@@ -185,6 +188,8 @@ class OC_Contacts_VCard{
 				$fn = join(' ', array_reverse(array_slice(explode(';', $n), 0, 2)));
 			} elseif($email) {
 				$fn = $email;
+			} elseif($org) {
+				$fn = $org;
 			} else {
 				$fn = 'Unknown Name';
 			}
@@ -218,32 +223,37 @@ class OC_Contacts_VCard{
 
 	/**
 	 * @brief Adds a card
-	 * @param integer $id Addressbook id
-	 * @param string $data  vCard file
-	 * @return insertid on success or null if card is not parseable.
+	 * @param integer $aid Addressbook id
+	 * @param OC_VObject $card  vCard file
+	 * @param string $uri the uri of the card, default based on the UID
+	 * @return insertid on success or null if no card.
 	 */
-	public static function add($id,$data){
-		$fn = null;
-
-		$card = OC_VObject::parse($data);
-		if(!is_null($card)){
-			OC_Contacts_App::$categories->loadFromVObject($card);
-			self::updateValuesFromAdd($card);
-			$data = $card->serialize();
-		}
-		else{
-			OC_Log::write('contacts','OC_Contacts_VCard::add. Error parsing VCard: '.$data,OC_Log::ERROR);
-			return null; // Ditch cards that can't be parsed by Sabre.
+	public static function add($aid, $card, $uri=null){
+		if(is_null($card)){
+			OC_Log::write('contacts','OC_Contacts_VCard::add. No vCard supplied', OC_Log::ERROR);
+			return null;
 		};
 
+		OC_Contacts_App::$categories->loadFromVObject($card);
+
+		self::updateValuesFromAdd($card);
+
 		$fn = $card->getAsString('FN');
-		$uid = $card->getAsString('UID');
-		$uri = $uid.'.vcf';
+		if (empty($fn)) {
+			$fn = null;
+		}
+
+		if (!$uri) {
+			$uid = $card->getAsString('UID');
+			$uri = $uid.'.vcf';
+		}
+
+		$data = $card->serialize();
 		$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
-		$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
+		$result = $stmt->execute(array($aid,$fn,$data,$uri,time()));
 		$newid = OC_DB::insertid('*PREFIX*contacts_cards');
 
-		OC_Contacts_Addressbook::touch($id);
+		OC_Contacts_Addressbook::touch($aid);
 
 		return $newid;
 	}
@@ -257,23 +267,7 @@ class OC_Contacts_VCard{
 	 */
 	public static function addFromDAVData($id,$uri,$data){
 		$card = OC_VObject::parse($data);
-		if(!is_null($card)){
-			OC_Contacts_App::$categories->loadFromVObject($card);
-			self::updateValuesFromAdd($card);
-			$data = $card->serialize();
-		} else {
-			OC_Log::write('contacts','OC_Contacts_VCard::addFromDAVData. Error parsing VCard: '.$data, OC_Log::ERROR);
-			return null; // Ditch cards that can't be parsed by Sabre.
-		};
-		$fn = $card->getAsString('FN');
-
-		$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
-		$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
-		$newid = OC_DB::insertid('*PREFIX*contacts_cards');
-
-		OC_Contacts_Addressbook::touch($id);
-
-		return $newid;
+		return self::add($id, $data, $uri);
 	}
 
 	/**
@@ -302,29 +296,25 @@ class OC_Contacts_VCard{
 	/**
 	 * @brief edits a card
 	 * @param integer $id id of card
-	 * @param string $data  vCard file
+	 * @param OC_VObject $card  vCard file
 	 * @return boolean
 	 */
-	public static function edit($id, $data){
+	public static function edit($id, OC_VObject $card){
 		$oldcard = self::find($id);
-		$fn = null;
 
-		$card = OC_VObject::parse($data);
-		if(!is_null($card)){
-			OC_Contacts_App::$categories->loadFromVObject($card);
-			foreach($card->children as $property){
-				if($property->name == 'FN'){
-					$fn = $property->value;
-					break;
-				}
-			}
-		} else {
+		if(is_null($card)) {
 			return false;
 		}
+
+		$fn = $card->getAsString('FN');
+		if (empty($fn)) {
+			$fn = null;
+		}
+
 		$now = new DateTime;
 		$card->setString('REV', $now->format(DateTime::W3C));
-		$data = $card->serialize();
 
+		$data = $card->serialize();
 		$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET fullname = ?,carddata = ?, lastmodified = ? WHERE id = ?' );
 		$result = $stmt->execute(array($fn,$data,time(),$id));
 
@@ -342,28 +332,8 @@ class OC_Contacts_VCard{
 	 */
 	public static function editFromDAVData($aid,$uri,$data){
 		$oldcard = self::findWhereDAVDataIs($aid,$uri);
-
-		$fn = null;
 		$card = OC_VObject::parse($data);
-		if(!is_null($card)){
-			OC_Contacts_App::$categories->loadFromVObject($card);
-			foreach($card->children as $property){
-				if($property->name == 'FN'){
-					$fn = $property->value;
-					break;
-				}
-			}
-		}
-		$now = new DateTime;
-		$card->setString('REV', $now->format(DateTime::W3C));
-		$data = $card->serialize();
-
-		$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET fullname = ?,carddata = ?, lastmodified = ? WHERE id = ?' );
-		$result = $stmt->execute(array($fn,$data,time(),$oldcard['id']));
-
-		OC_Contacts_Addressbook::touch($oldcard['addressbookid']);
-
-		return true;
+		return self::edit($oldcard['id'], $card);
 	}
 
 	/**
@@ -379,14 +349,6 @@ class OC_Contacts_VCard{
 		return true;
 	}
 
-	/**
-	 * @brief Creates a UID
-	 * @return string
-	 */
-	public static function createUID(){
-		return substr(md5(rand().time()),0,10);
-	}
-
 	/**
 	 * @brief deletes a card with the data provided by sabredav
 	 * @param integer $aid Addressbook id
diff --git a/apps/contacts/templates/part.contactphoto.php b/apps/contacts/templates/part.contactphoto.php
index 9e3f5876cd14a197e5ee267205ae57fc63792423..8107650d161fd14510049e19456f185cc24d07a1 100644
--- a/apps/contacts/templates/part.contactphoto.php
+++ b/apps/contacts/templates/part.contactphoto.php
@@ -3,7 +3,7 @@ $id = $_['id'];
 $wattr = isset($_['width'])?'width="'.$_['width'].'"':'';
 $hattr = isset($_['height'])?'height="'.$_['height'].'"':'';
 ?>
-<img class="loading" id="contacts_details_photo" <?php echo $wattr; ?> <?php echo $hattr; ?> src="<?php echo OC_Helper::linkToAbsolute('contacts', 'photo.php'); ?>?id=<?php echo $id; ?>&amp;refresh=<?php echo rand(); ?>" />
+<img class="loading" id="contacts_details_photo" <?php echo $wattr; ?> <?php echo $hattr; ?> src="<?php echo OC_Helper::linkToAbsolute('contacts', 'photo.php'); ?>?id=<?php echo $id; ?>" />
 <progress id="contacts_details_photo_progress" style="display:none;" value="0" max="100">0 %</progress>
 
 
diff --git a/core/css/styles.css b/core/css/styles.css
index 62f5299ef78809fcb4642da350401318b43d5a06..f5a181c4529f42721acb0df5bf4ceaea0648b7e2 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -60,7 +60,7 @@ input[type="submit"].highlight{ background:#ffc100; border:1px solid #db0; text-
 #leftcontent, .leftcontent { position:fixed; overflow: auto; top:6.4em; width:20em; background:#f8f8f8; border-right:1px solid #ddd; }
 #leftcontent li, .leftcontent li { background:#f8f8f8; padding:.3em .8em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; -webkit-transition:background-color 500ms; -moz-transition:background-color 500ms; -o-transition:background-color 500ms; transition:background-color 500ms; }
 #leftcontent li:hover, #leftcontent li:active, #leftcontent li.active, .leftcontent li:hover, .leftcontent li:active, .leftcontent li.active { background:#eee; }
-#rightcontent, .rightcontent { position:fixed; top: 6.4em; left: 32.5em; }
+#rightcontent, .rightcontent { position:fixed; top: 6.4em; left: 32.5em; overflow: auto }
 
 
 /* LOG IN & INSTALLATION ------------------------------------------------------------ */
diff --git a/files/ajax/newfile.php b/files/ajax/newfile.php
index afc444bc0acadbcb35247ac4691d44c255106bc9..2d1372f06ee5fb8d40c57233fd6b964d9a9d6d5e 100644
--- a/files/ajax/newfile.php
+++ b/files/ajax/newfile.php
@@ -6,15 +6,35 @@ require_once('../../lib/base.php');
 OC_JSON::checkLoggedIn();
 
 // Get the params
-$dir = isset( $_GET['dir'] ) ? stripslashes($_GET['dir']) : '';
-$filename = isset( $_GET['filename'] ) ? stripslashes($_GET['filename']) : '';
-$content = isset( $_GET['content'] ) ? $_GET['content'] : '';
+$dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : '';
+$filename = isset( $_POST['filename'] ) ? stripslashes($_POST['filename']) : '';
+$content = isset( $_POST['content'] ) ? $_POST['content'] : '';
+$source = isset( $_POST['source'] ) ? stripslashes($_POST['source']) : '';
 
 if($filename == '') {
 	OC_JSON::error(array("data" => array( "message" => "Empty Filename" )));
 	exit();
 }
 
+if($source){
+	if(substr($source,0,8)!='https://' and substr($source,0,7)!='http://'){
+		OC_JSON::error(array("data" => array( "message" => "Not a valid source" )));
+		exit();
+	}
+	$sourceStream=fopen($source,'rb');
+	$target=$dir.'/'.$filename;
+	$result=OC_Filesystem::file_put_contents($target,$sourceStream);
+	if($result){
+		$mime=OC_Filesystem::getMimetype($target);
+		OC_JSON::success(array("data" => array('mime'=>$mime)));
+		exit();
+	}else{
+		OC_JSON::error(array("data" => array( "message" => "Error while downloading ".$source. ' to '.$target )));
+		exit();
+	}
+}
+
+
 if(OC_Files::newFile($dir, $filename, 'file')) {
 	if($content){
 		OC_Filesystem::file_put_contents($dir.'/'.$filename,$content);
diff --git a/files/ajax/newfolder.php b/files/ajax/newfolder.php
index 6db045c4e1728fc7d555f5c8bd73fe09d798f46c..228e369fbef95c336dfd6426470a9a0951f2bbb9 100644
--- a/files/ajax/newfolder.php
+++ b/files/ajax/newfolder.php
@@ -6,8 +6,8 @@ require_once('../../lib/base.php');
 OC_JSON::checkLoggedIn();
 
 // Get the params
-$dir = isset( $_GET['dir'] ) ? stripslashes($_GET['dir']) : '';
-$foldername = isset( $_GET['foldername'] ) ? stripslashes($_GET['foldername']) : '';
+$dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : '';
+$foldername = isset( $_POST['foldername'] ) ? stripslashes($_POST['foldername']) : '';
 
 if(trim($foldername) == '') {
 	OC_JSON::error(array("data" => array( "message" => "Empty Foldername" )));
diff --git a/files/js/files.js b/files/js/files.js
index f5dc40ad45d286808c4f1f2a5e9d2814522971e4..a678e12cc2d42aaac6fbf9fd7c3a14b0c5781954 100644
--- a/files/js/files.js
+++ b/files/js/files.js
@@ -127,20 +127,6 @@ $(document).ready(function() {
 		procesSelection();
 	});
 	
-	$('#file_newfolder_form').submit(function(event) {
-		event.preventDefault();
-		$.ajax({
-			url: 'ajax/newfolder.php',
-			data: "dir="+$('#dir').val()+"&foldername="+$('#file_newfolder_name').val(),
-			complete: function(data){boolOperationFinished(data, function(){
-				var date=new Date();
-				FileList.addDir($('#file_newfolder_name').val(),0,date);
-				$('#file_newfolder_name').val('New Folder');
-				$('#file_newfolder_name').blur();
-			});}
-		});
-	});
-	
 	$('#file_newfolder_name').click(function(){
 		if($('#file_newfolder_name').val() == 'New Folder'){
 			$('#file_newfolder_name').val('');
@@ -312,10 +298,10 @@ $(document).ready(function() {
 			var name=$(this).val();
 			switch(type){
 				case 'file':
-					$.ajax({
-						url: OC.filePath('files','ajax','newfile.php'),
-						data: "dir="+encodeURIComponent($('#dir').val())+"&filename="+encodeURIComponent(name)+'&content=%20%0A',
-						complete: function(data){boolOperationFinished(data, function(){
+					$.post(
+						OC.filePath('files','ajax','newfile.php'),
+						{dir:$('#dir').val(),filename:name,content:" \n"},
+						function(data){
 							var date=new Date();
 							FileList.addFile(name,0,date);
 							var tr=$('tr').filterAttr('data-file',name);
@@ -323,18 +309,49 @@ $(document).ready(function() {
 							getMimeIcon('text/plain',function(path){
 								tr.find('td.filename').attr('style','background-image:url('+path+')');
 							});
-						});}
-					});
+						}
+					);
 					break;
 				case 'folder':
-					$.ajax({
-						url: OC.filePath('files','ajax','newfolder.php'),
-						data: "dir="+encodeURIComponent($('#dir').val())+"&foldername="+encodeURIComponent(name),
-						complete: function(data){boolOperationFinished(data, function(){
+					$.post(
+						OC.filePath('files','ajax','newfolder.php'),
+						{dir:$('#dir').val(),foldername:name},
+						function(data){
 							var date=new Date();
 							FileList.addDir(name,0,date);
-						});}
-					});
+						}
+					);
+					break;
+				case 'web':
+					if(name.substr(0,8)!='https://' && name.substr(0,7)!='http://'){
+						name='http://'.name;
+					}
+					var localName=name;
+					if(localName.substr(localName.length-1,1)=='/'){//strip /
+						localName=localName.substr(0,localName.length-1)
+					}
+					if(localName.indexOf('/')){//use last part of url
+						localName=localName.split('/').pop();
+					}else{//or the domain
+						localName=(localName.match(/:\/\/(.[^/]+)/)[1]).replace('www.','');
+					}
+					$.post(
+						OC.filePath('files','ajax','newfile.php'),
+						{dir:$('#dir').val(),source:name,filename:localName},
+						function(result){
+							if(result.status == 'success'){
+								var date=new Date();
+								FileList.addFile(localName,0,date);
+								var tr=$('tr').filterAttr('data-file',localName);
+								tr.data('mime',result.data.mime);
+								getMimeIcon(result.data.mime,function(path){
+									tr.find('td.filename').attr('style','background-image:url('+path+')');
+								});
+							}else{
+								
+							}
+						}
+					);
 					break;
 			}
 			var li=$(this).parent();
diff --git a/files/templates/index.php b/files/templates/index.php
index 7e9505dec2f936435791c8eea86457c0c91bd143..7fc51c288e1c7402c6edbb3df47281d71f9939f6 100644
--- a/files/templates/index.php
+++ b/files/templates/index.php
@@ -7,6 +7,7 @@
 				<ul class="popup popupTop">
 					<li style="background-image:url('<?php echo mimetype_icon('text/plain') ?>')" data-type='file'><p><?php echo $l->t('Text file');?></p></li>
 					<li style="background-image:url('<?php echo mimetype_icon('dir') ?>')" data-type='folder'><p><?php echo $l->t('Folder');?></p></li>
+					<li style="background-image:url('<?php echo image_path('core','actions/public.png') ?>')" data-type='web'><p><?php echo $l->t('From url');?></p></li>
 				</ul>
 			</div>
 			<div class="file_upload_wrapper svg">