diff --git a/apps/files_versions/ajax/getVersions.php b/apps/files_versions/ajax/getVersions.php
index fbe65146acca56a605eff98f5931113d452d629c..32aac10b718dd0d59b298ab0bc49d81e91c4f721 100644
--- a/apps/files_versions/ajax/getVersions.php
+++ b/apps/files_versions/ajax/getVersions.php
@@ -11,9 +11,16 @@ $source = strip_tags( $source );
 if( OCA_Versions\Storage::isversioned( $source ) ) {
 
 	$count=5; //show the newest revisions
-	$versions=OCA_Versions\Storage::getversions( $source, $count);
+	$versions = OCA_Versions\Storage::getversions( $source, $count);
+	$versionsFormatted = array();
+	
+	foreach ( $versions AS $version ) {
+	
+		$versionsFormatted[] = OC_Util::formatDate( $version );
+		
+	}
 
-	$versionsSorted = array_reverse( $versions );
+	$versionsSorted = array_reverse( $versionsFormatted );
 	
 	if ( !empty( $versionsSorted ) ) {
 		OC_JSON::encodedPrint($versionsSorted);
diff --git a/apps/files_versions/ajax/rollbackVersion.php b/apps/files_versions/ajax/rollbackVersion.php
new file mode 100644
index 0000000000000000000000000000000000000000..660411973a274feaa6dc4aa13d2d44dfc1550fe4
--- /dev/null
+++ b/apps/files_versions/ajax/rollbackVersion.php
@@ -0,0 +1,26 @@
+<?php
+
+require_once('../../../lib/base.php');
+OC_JSON::checkAppEnabled('files_versions');
+require_once('../versions.php');
+
+$userDirectory = "/".OC_User::getUser()."/files";
+
+$source = $_GET['source'];
+
+$source = strip_tags( $source );
+
+echo "\n\n$source\n\n";
+
+$revision = strtotime( $source );
+
+echo "\n\n$revision\n\n";
+
+if( OCA_Versions\Storage::isversioned( $source ) ) {
+
+
+        #\OCA_Versions\Storage::rollback( $source, $revision );
+	
+}
+
+?>
\ No newline at end of file
diff --git a/apps/files_versions/history.php b/apps/files_versions/history.php
index 434feaf35762428a30d8fcfa848b93c76f2f7846..05a5db55daa245d2be90791b322dd05792e5139a 100644
--- a/apps/files_versions/history.php
+++ b/apps/files_versions/history.php
@@ -32,13 +32,18 @@ if ( isset( $_GET['path'] ) ) {
 
 	// roll back to old version if button clicked
         if( isset( $_GET['revert'] ) ) {
-        	\OCA_Versions\Storage::rollback( $path, $_GET['revert'] );
+        	
+        	if( \OCA_Versions\Storage::rollback( $path, $_GET['revert'] ) ) {
+        	
+			echo "<script>OC.dialogs.alert(response.data.message, t('contacts', 'Error'))</script>";
+			
+		}
 	}
 
 	// show the history only if there is something to show
         if( OCA_Versions\Storage::isversioned( $path ) ) {
 
-		$count=5; //show the newest revisions
+		$count=999; //show the newest revisions
 	        $versions=OCA_Versions\Storage::getversions( $path, $count);
 
 		$tmpl = new OC_Template( 'files_versions', 'history', 'user' );
diff --git a/apps/files_versions/js/versions.js b/apps/files_versions/js/versions.js
index 5018b75f154a81762a1164ccee3a0567d901f872..a9e60a0cfa6c0b43bb15b0a0251b147b4c7ac7f0 100644
--- a/apps/files_versions/js/versions.js
+++ b/apps/files_versions/js/versions.js
@@ -17,17 +17,7 @@ $(document).ready(function(){
 			async: false,
 			success: function(versions) {
 				if (versions) {
-					
-	// 				icon = OC.imagePath('core', 'actions/shared');
-	// 				$.each(users, function(index, row) {
-	// 					if (row.uid_shared_with == 'public') {
-	// 						icon = OC.imagePath('core', 'actions/public');
-	// 					}
-	// 				});
-	// 			} else {
-	// 				icon = OC.imagePath('core', 'actions/share');
 				}
-	 			shared_status[file]= { timestamp: new Date().getTime(), icon: icon };
 			}
 		});
 	
@@ -37,15 +27,15 @@ $(document).ready(function(){
 
 function createVersionsDropdown(filename, files) {
 	var historyUrl = '../apps/files_versions/history.php?path='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename);
-	//alert( historyUrl );
+
 	var html = '<div id="dropdown" class="drop" data-file="'+files+'">';
 	html += '<div id="private">';
 	html += '<select data-placeholder="File Version" id="found_versions" class="chzen-select">';
 	html += '<option value="">Select version</option>';
 	html += '</select>';
 	html += '</div>';
-	html += '<input type="button" name="makelink" id="makelink" value="Revert file" />';
-	html += '<input type="button" onclick="window.location=\''+historyUrl+'\'" name="makelink" id="makelink" value="More..." />';
+	html += '<input type="button" value="Revert file" onclick="revertFile()" />';
+	html += '<input type="button" value="More..." onclick="window.location=\''+historyUrl+'\'" name="makelink" id="makelink" />';
 	html += '<br />';
 	html += '<input id="link" style="display:none; width:90%;" />';
 	
@@ -76,6 +66,22 @@ function createVersionsDropdown(filename, files) {
 		
 	});
 	
+	function revertFile() {
+		
+		$.ajax({
+			type: 'GET',
+			url: OC.linkTo('files_versions', 'ajax/rollbackVersion.php'),
+			dataType: 'json',
+			data: {path: file, revision: 'revision'},
+			async: false,
+			success: function(versions) {
+				if (versions) {
+				}
+			}
+		});	
+		
+	}
+	
 	function addVersion( name ) {
 		
 		var version = '<option>'+name+'</option>';