diff --git a/modules/Migration/schema/660_to_700.php b/modules/Migration/schema/660_to_700.php
index 9aa09702e45fff75420c4e5bc5e689e39a0339a6..0d2b26b1b80717ef26cbc462607b4c67b5e9543b 100644
--- a/modules/Migration/schema/660_to_700.php
+++ b/modules/Migration/schema/660_to_700.php
@@ -1943,9 +1943,12 @@ if(defined('VTIGER_UPGRADE')) {
 
 	$marketingSequence = 1;
 	foreach ($marketingSalesFields as $fieldName => $linkTo) {
-		$updateQuery = 'INSERT INTO vtiger_settings_field(fieldid,blockid,name,iconpath,description,linkto,sequence,active,pinned) VALUES(?,?,?,?,?,?,?,?,?)';
-		$params = array($db->getUniqueID('vtiger_settings_field'), $marketingSalesBlockId, $fieldName, 'NULL', 'NULL', $linkTo, $marketingSequence++, 0, 1);
-		$db->pquery($updateQuery, $params);
+		$marketingFieldResult = $db->pquery('SELECT 1 FROM vtiger_settings_field WHERE name=?', array($fieldName));
+		if (!$db->num_rows($marketingFieldResult)) {
+			$updateQuery = 'INSERT INTO vtiger_settings_field(fieldid,blockid,name,iconpath,description,linkto,sequence,active,pinned) VALUES(?,?,?,?,?,?,?,?,?)';
+			$params = array($db->getUniqueID('vtiger_settings_field'), $marketingSalesBlockId, $fieldName, 'NULL', 'NULL', $linkTo, $marketingSequence++, 0, 1);
+			$db->pquery($updateQuery, $params);
+		}
 	}
 	//End:: marketing sales block
 
@@ -1964,10 +1967,7 @@ if(defined('VTIGER_UPGRADE')) {
 
 	$inventorySequence = 1;
 	foreach ($inventoryFields as $fieldName => $linkTo) {
-		$updateQuery = 'UPDATE vtiger_settings_field SET sequence=?, linkto=?, blockid=? WHERE name=?';
-		$params = array($inventorySequence, $linkTo, $inventoryBlockId, $fieldName);
 		$db->pquery('UPDATE vtiger_settings_field SET sequence=?, linkto=?, blockid=? WHERE name=?', array($inventorySequence++, $linkTo, $inventoryBlockId, $fieldName));
-		$inventorySequence = $inventorySequence+1;
 	}
 	//End:: inventory block
 
@@ -1987,9 +1987,12 @@ if(defined('VTIGER_UPGRADE')) {
 
 	$myPreferenceSequence = 1;
 	foreach ($myPreferenceFields as $fieldName => $linkTo) {
-		$fieldQuery = 'INSERT INTO vtiger_settings_field(fieldid,blockid,name,iconpath,description,linkto,sequence,active,pinned) VALUES(?,?,?,?,?,?,?,?,?)';
-		$params = array($db->getUniqueID('vtiger_settings_field'), $myPreferenceBlockId, $fieldName, 'NULL', 'NULL', $linkTo, $myPreferenceSequence++, 0, 1);
-		$db->pquery($fieldQuery, $params);
+		$myPrefFieldResult = $db->pquery('SELECT 1 FROM vtiger_settings_field WHERE name=?', array($fieldName));
+		if (!$db->num_rows($myPrefFieldResult)) {
+			$fieldQuery = 'INSERT INTO vtiger_settings_field(fieldid,blockid,name,iconpath,description,linkto,sequence,active,pinned) VALUES(?,?,?,?,?,?,?,?,?)';
+			$params = array($db->getUniqueID('vtiger_settings_field'), $myPreferenceBlockId, $fieldName, 'NULL', 'NULL', $linkTo, $myPreferenceSequence++, 0, 1);
+			$db->pquery($fieldQuery, $params);
+		}
 	}
 	//End:: mypreference block
 
@@ -2019,9 +2022,12 @@ if(defined('VTIGER_UPGRADE')) {
 
 	$extSequence = 1;
 	foreach ($extensionFields as $fieldName => $linkTo) {
-		$fieldQuery = 'INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence, active, pinned) VALUES(?,?,?,?,?,?,?,?,?)';
-		$params = array($db->getUniqueID('vtiger_settings_field'), $extensionsBlockId, $fieldName, 'NULL', 'NULL', $linkTo, $extSequence++, 0, 1);
-		$db->pquery($fieldQuery, $params);
+		$extFieldResult = $db->pquery('SELECT 1 FROM vtiger_settings_field WHERE name=?', array($fieldName));
+		if (!$db->num_rows($extFieldResult)) {
+			$fieldQuery = 'INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence, active, pinned) VALUES(?,?,?,?,?,?,?,?,?)';
+			$params = array($db->getUniqueID('vtiger_settings_field'), $extensionsBlockId, $fieldName, 'NULL', 'NULL', $linkTo, $extSequence++, 0, 1);
+			$db->pquery($fieldQuery, $params);
+		}
 	}
 	//End:: extensions block
 
diff --git a/packages/vtiger/mandatory/Mobile.zip b/packages/vtiger/mandatory/Mobile.zip
index ff87287f49ed87e0e7e3db01e1382a601260a1c1..319e22a4ef7ca2e0e28aad7fa5b1e145016f01f7 100644
Binary files a/packages/vtiger/mandatory/Mobile.zip and b/packages/vtiger/mandatory/Mobile.zip differ
diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/api.v1.php b/pkg/vtiger/modules/Mobile/modules/Mobile/api.v1.php
index 59e4d270a8c5219938d49df748097a7f0cad39f3..543da0e3e4fbef4733b4b2e887c2fff93c710692 100644
--- a/pkg/vtiger/modules/Mobile/modules/Mobile/api.v1.php
+++ b/pkg/vtiger/modules/Mobile/modules/Mobile/api.v1.php
@@ -11,32 +11,30 @@
 class Mobile_APIV1_Controller {
 
 	static $opControllers = array(
-		'login'                   => array('file' => '/api/ws/Login.php', 'class' => 'Mobile_WS_Login'),
-		'loginAndFetchModules'    => array('file' => '/api/ws/LoginAndFetchModules.php', 'class' => 'Mobile_WS_LoginAndFetchModules'),
-		'fetchModuleFilters'      => array('file' => '/api/ws/FetchModuleFilters.php'  , 'class' => 'Mobile_WS_FetchModuleFilters'),
-		'filterDetailsWithCount'  => array('file' => '/api/ws/FilterDetailsWithCount.php', 'class' => 'Mobile_WS_FilterDetailsWithCount'),
-		'fetchAllAlerts'          => array('file' => '/api/ws/FetchAllAlerts.php', 'class' => 'Mobile_WS_FetchAllAlerts'),
-		'alertDetailsWithMessage' => array('file' => '/api/ws/AlertDetailsWithMessage.php', 'class' => 'Mobile_WS_AlertDetailsWithMessage'),
-		'listModuleRecords'       => array('file' => '/api/ws/ListModuleRecords.php', 'class' => 'Mobile_WS_ListModuleRecords'),
-		'fetchRecord'             => array('file' => '/api/ws/FetchRecord.php', 'class' => 'Mobile_WS_FetchRecord'),
-		'fetchRecordWithGrouping' => array('file' => '/api/ws/FetchRecordWithGrouping.php', 'class' => 'Mobile_WS_FetchRecordWithGrouping'),
-		'fetchRecordsWithGrouping' => array('file' => '/api/ws/FetchRecordsWithGrouping.php', 'class' => 'Mobile_WS_FetchRecordsWithGrouping'),
-		'describe'                => array('file' => '/api/ws/Describe.php', 'class' => 'Mobile_WS_Describe'),
-		'saveRecord'              => array('file' => '/api/ws/SaveRecord.php', 'class' => 'Mobile_WS_SaveRecord'),
-		'syncModuleRecords'       => array('file' => '/api/ws/SyncModuleRecords.php', 'class' => 'Mobile_WS_SyncModuleRecords'),
-
-		'query'                   => array('file' => '/api/ws/Query.php', 'class' => 'Mobile_WS_Query'),
-		'queryWithGrouping'       => array('file' => '/api/ws/QueryWithGrouping.php', 'class' => 'Mobile_WS_QueryWithGrouping'),
-
-		'relatedRecordsWithGrouping' => array('file' => '/api/ws/RelatedRecordsWithGrouping.php', 'class' => 'Mobile_WS_RelatedRecordsWithGrouping'),
-		'deleteRecords'              => array('file' => '/api/ws/DeleteRecords.php', 'class' => 'Mobile_WS_DeleteRecords'),
-
-		'addRecordComment'           => array('file' => '/api/ws/AddRecordComment.php', 'class' => 'Mobile_WS_AddRecordComment'),
-		'history'                    => array('file' => '/api/ws/History.php', 'class' => 'Mobile_WS_History'),
-        'taxByType'                  => array('file'=>'/api/ws/TaxByType.php','class'=>'Mobile_WS_TaxByType'),
-		'pushNotificationSubscription' => array('file' => '/api/pushnotification/PushNotificationSubscription.php', 'class'=>'Mobile_WS_PushNotificationSubscription'),
-        'fetchModuleOwners'          => array('file' => '/api/ws/FetchModuleOwners.php', 'class'=>'Mobile_WS_FetchModuleOwners'),
-        'fetchCompanyDetails'        => array('file' => '/api/ws/FetchCompanyDetails.php', 'class'=>'Mobile_WS_FetchCompanyDetails')
+		'login'						=> array('file' => '/api/ws/Login.php',						'class' => 'Mobile_WS_Login'),
+		'loginAndFetchModules'		=> array('file' => '/api/ws/LoginAndFetchModules.php',		'class' => 'Mobile_WS_LoginAndFetchModules'),
+		'fetchModuleFilters'		=> array('file' => '/api/ws/FetchModuleFilters.php'  ,		'class' => 'Mobile_WS_FetchModuleFilters'),
+		'filterDetailsWithCount'	=> array('file' => '/api/ws/FilterDetailsWithCount.php',	'class' => 'Mobile_WS_FilterDetailsWithCount'),
+		'fetchAllAlerts'			=> array('file' => '/api/ws/FetchAllAlerts.php',			'class' => 'Mobile_WS_FetchAllAlerts'),
+		'alertDetailsWithMessage'	=> array('file' => '/api/ws/AlertDetailsWithMessage.php',	'class' => 'Mobile_WS_AlertDetailsWithMessage'),
+		'listModuleRecords'			=> array('file' => '/api/ws/ListModuleRecords.php',			'class' => 'Mobile_WS_ListModuleRecords'),
+		'fetchRecord'				=> array('file' => '/api/ws/FetchRecord.php',				'class' => 'Mobile_WS_FetchRecord'),
+		'fetchRecordWithGrouping'	=> array('file' => '/api/ws/FetchRecordWithGrouping.php',	'class' => 'Mobile_WS_FetchRecordWithGrouping'),
+		'fetchRecordsWithGrouping'	=> array('file' => '/api/ws/FetchRecordsWithGrouping.php',	'class' => 'Mobile_WS_FetchRecordsWithGrouping'),
+		'describe'					=> array('file' => '/api/ws/Describe.php',					'class' => 'Mobile_WS_Describe'),
+		'saveRecord'				=> array('file' => '/api/ws/SaveRecord.php',				'class' => 'Mobile_WS_SaveRecord'),
+		'syncModuleRecords'			=> array('file' => '/api/ws/SyncModuleRecords.php',			'class' => 'Mobile_WS_SyncModuleRecords'),
+		'query'						=> array('file' => '/api/ws/Query.php',						'class' => 'Mobile_WS_Query'),
+		'queryWithGrouping'			=> array('file' => '/api/ws/QueryWithGrouping.php',			'class' => 'Mobile_WS_QueryWithGrouping'),
+		'relatedRecordsWithGrouping'=> array('file' => '/api/ws/RelatedRecordsWithGrouping.php','class' => 'Mobile_WS_RelatedRecordsWithGrouping'),
+		'deleteRecords'				=> array('file' => '/api/ws/DeleteRecords.php',				'class' => 'Mobile_WS_DeleteRecords'),
+		'logout'					=> array('file' => '/api/ws/Logout.php',					'class' => 'Mobile_WS_Logout'),
+		'fetchModules'				=> array('file' => '/api/ws/FetchModules.php',				'class' => 'Mobile_WS_FetchModules'),
+		'userInfo'					=> array('file' => '/api/ws/UserInfo.php',					'class' => 'Mobile_WS_UserInfo'),
+		'addRecordComment'			=> array('file' => '/api/ws/AddRecordComment.php',			'class' => 'Mobile_WS_AddRecordComment'),
+		'history'					=> array('file' => '/api/ws/History.php',					'class' => 'Mobile_WS_History'),
+		'taxByType'					=> array('file' => '/api/ws/TaxByType.php',					'class' => 'Mobile_WS_TaxByType'),
+		'fetchModuleOwners'			=> array('file' => '/api/ws/FetchModuleOwners.php',			'class' => 'Mobile_WS_FetchModuleOwners'),
 	);
 
 	protected function initSession(Mobile_API_Request $request) {
diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/Controller.php b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/Controller.php
index c6eb578f49313fee3869d74bb989d502b66221f5..36d47897487fc4e9b59f27189feba8014df0e581 100644
--- a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/Controller.php
+++ b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/Controller.php
@@ -32,6 +32,8 @@ class Mobile_WS_Controller {
 			if(!empty($userid)) {
 				$this->activeUser = CRMEntity::getInstance('Users');
 				$this->activeUser->retrieveCurrentUserInfoFromFile($userid);
+				global $current_user;
+				$current_user = $this->activeUser;
 			}
 		}
 		return $this->activeUser;
diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/DeleteRecords.php b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/DeleteRecords.php
index 694aa1dac4212e0bde13c180e660a9aa8d184c96..0e63306f16ba265467d4dfd43b9e2b1d338719a2 100644
--- a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/DeleteRecords.php
+++ b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/DeleteRecords.php
@@ -15,18 +15,17 @@ class Mobile_WS_DeleteRecords extends Mobile_WS_Controller {
 		global $current_user;
 		
 		$current_user = $this->getActiveUser();
-		
 		$records = $request->get('records');
 		if (empty($records)) {
 			$records = array($request->get('record'));
 		} else {
 			$records = Zend_Json::decode($records);
 		}
-		
 		$deleted = array();
 		foreach($records as $record) {
 			try {
-				vtws_delete($record, $current_user);
+				$recordModel = Vtiger_Record_Model::getInstanceById($record);
+				$recordModel->delete();
 				$result = true;
 			} catch(Exception $e) {
 				$result = false;
diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/Describe.php b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/Describe.php
index 84e134ae49355fea36a1903d24f13d0b2f10301a..f6a6bcc8b031eaee6827fddb3f40ad7f1ee1660f 100644
--- a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/Describe.php
+++ b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/Describe.php
@@ -13,10 +13,23 @@ class Mobile_WS_Describe extends Mobile_WS_Controller {
 	
 	function process(Mobile_API_Request $request) {
 		$current_user = $this->getActiveUser();
-
 		$module = $request->get('module');
 		$describeInfo = vtws_describe($module, $current_user);
-		Mobile_WS_Utils::fixDescribeFieldInfo($module, $describeInfo);
+
+		$fields = $describeInfo['fields'];
+		
+		$moduleModel = Vtiger_Module_Model::getInstance($module);
+		$fieldModels = $moduleModel->getFields();
+		foreach($fields as $index=>$field) {
+			$fieldModel = $fieldModels[$field['name']];
+			if($fieldModel) {
+				$field['headerfield'] = $fieldModel->get('headerfield');
+				$field['summaryfield'] = $fieldModel->get('summaryfield');
+			}
+			$newFields[] = $field;
+		}
+		$fields=null;
+		$describeInfo['fields'] = $newFields;
 		
 		$response = new Mobile_API_Response();
 		$response->setResult(array('describe' => $describeInfo));
diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchModuleFilters.php b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchModuleFilters.php
index e27e175972c5e4ed41671b57ab80076ddd07c943..c064c180916e5e94114beccd334a9c3afb3a6b40 100644
--- a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchModuleFilters.php
+++ b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchModuleFilters.php
@@ -10,29 +10,22 @@
 class Mobile_WS_FetchModuleFilters extends Mobile_WS_Controller {
 	
 	function process(Mobile_API_Request $request) {
-		$response = new Mobile_API_Response();
-
 		$module = $request->get('module');
 		$current_user = $this->getActiveUser();
-		
+
+		$allFilters = CustomView_Record_Model::getAllByGroup($module);
+		unset($allFilters['Public']);
 		$result = array();
-		
-		$filters = $this->getModuleFilters($module, $current_user);
-		$yours = array();
-		$others= array();
-		if(!empty($filters)) {
-			foreach($filters as $filter) {
-				if($filter['userName'] == $current_user->column_fields['user_name']) {
-					$yours[] = $filter;
-				} else {
-					$others[]= $filter;
+		if($allFilters) {
+			foreach($allFilters as $group => $filters) {
+				$result[$group] = array();
+				foreach($filters as $filter) {
+					$result[$group][] = array('id'=>$filter->get('cvid'), 'name'=>$filter->get('viewname'), 'default'=>$filter->isDefault()); 
 				}
 			}
 		}
-		
-		$result['filters'] = array('yours' => $yours, 'others' => $others);
-		$response->setResult($result);
-
+		$response = new Mobile_API_Response();
+		$response->setResult(array('filters'=>$result));
 		return $response;
 	}
 
diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchModules.php b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchModules.php
new file mode 100644
index 0000000000000000000000000000000000000000..edc12351ab7f2f3e7bfdd396994281aa10310621
--- /dev/null
+++ b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchModules.php
@@ -0,0 +1,27 @@
+<?php
+/*+**********************************************************************************
+ * The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+ ************************************************************************************/
+include_once dirname(__FILE__) . '/../../api/ws/LoginAndFetchModules.php';
+
+class Mobile_WS_FetchModules extends Mobile_WS_LoginAndFetchModules {
+
+	function requireLogin() {
+		return true;
+	}
+	
+	function process(Mobile_API_Request $request) {
+		$current_user = $this->getActiveUser();
+		
+		$response = new Mobile_API_Response();
+		$result = array();
+		$result['modules'] = $this->getListing($current_user);
+		$response->setResult($result);
+		return $response;
+	}
+}
\ No newline at end of file
diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchRecord.php b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchRecord.php
index fdb64a54636fbb1fcde6445ddee947c2908d2738..57bdf53f5459fb8b71c8f95841d9ad860576cbd6 100644
--- a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchRecord.php
+++ b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchRecord.php
@@ -10,9 +10,9 @@
 include_once 'include/Webservices/Retrieve.php';
 
 class Mobile_WS_FetchRecord extends Mobile_WS_Controller {
-	
+
 	private $module = false;
-	
+
 	protected $resolvedValueCache = array();
 	
 	protected function detectModuleName($recordid) {
@@ -30,36 +30,53 @@ class Mobile_WS_FetchRecord extends Mobile_WS_Controller {
 		
 		return $record;
 	}
-	
+
 	function process(Mobile_API_Request $request) {
 		$current_user = $this->getActiveUser();
-		$record = $this->processRetrieve($request);
+		$record = $request->get('record');
+		$module = $request->get('module');
 		
-		$this->resolveRecordValues($record, $current_user);
+		$moduleModel = Vtiger_Module_Model::getInstance($module);
+		$recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleModel);
+		$data = $recordModel->getData();
+		
+		$data = $this->resolveRecordValues($data, $moduleModel);
 		
 		$response = new Mobile_API_Response();
-		$response->setResult(array('record' => $record));
+		$response->setResult(array('record' => $data));
 		
 		return $response;
 	}
-	
-	function resolveRecordValues(&$record, $user, $ignoreUnsetFields=false) {
-		if(empty($record)) return $record;
-		
-		$fieldnamesToResolve = Mobile_WS_Utils::detectFieldnamesToResolve(
-			$this->detectModuleName($record['id']) );
+
+	function resolveRecordValues($data, $moduleModel) {
+		$fields = $moduleModel->getFields();
 		
-		if(!empty($fieldnamesToResolve)) {
-			foreach($fieldnamesToResolve as $resolveFieldname) {
-				if ($ignoreUnsetFields === false || isset($record[$resolveFieldname])) {
-					$fieldvalueid = $record[$resolveFieldname];
-					$fieldvalue = $this->fetchRecordLabelForId($fieldvalueid, $user);
-					$record[$resolveFieldname] = array('value' => $fieldvalueid, 'label'=>$fieldvalue);
+		foreach ($data as $fieldName => $value) {
+			if ($fields[$fieldName]) {
+				$fieldModel = $fields[$fieldName];
+				$fieldType = $fieldModel->getFieldDataType();
+				$referenceModules = $fieldModel->getReferenceList();
+				if ($fieldType == 'reference' && !in_array('Users', $referenceModules)) {
+					$data[$fieldName] = array('value' => $value, 'label' => decode_html(Vtiger_Functions::getCRMRecordLabel($value)));
+				} else if ($fieldType == 'reference' && in_array('Users', $referenceModules)) {
+					$data[$fieldName] = array('value' => $value, 'label' => decode_html(Vtiger_Functions::getUserRecordLabel($value)));
+				} else if ($fieldType == 'url') {
+					$data[$fieldName] = array('value' => $value, 'label' => $value);
+				} else if ($fieldType == 'owner') {
+					$ownerName = Vtiger_Functions::getUserRecordLabel($value);
+					if (!empty($ownerName)) {
+						$data[$fieldName] = array('value' => $value, 'label' => decode_html($ownerName));
+					} else {
+						$data[$fieldName] = array('value' => $value, 'label' => decode_html(Vtiger_Functions::getGroupRecordLabel($value)));
+					}
+				} else {
+					$data[$fieldName] = array('value' => $value, 'label' => decode_html($fieldModel->getDisplayValue($value)));
 				}
 			}
 		}
+		return $data;
 	}
-	
+
 	function fetchRecordLabelForId($id, $user) {
 		$value = null;
 		
diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/ListModuleRecords.php b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/ListModuleRecords.php
index 3a438f3cfe2da70b0c234c87b9547293f5e85428..afb585f291d22545c258d0acc797e9cf848a35f3 100644
--- a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/ListModuleRecords.php
+++ b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/ListModuleRecords.php
@@ -12,7 +12,7 @@ include_once dirname(__FILE__) . '/models/SearchFilter.php';
 include_once dirname(__FILE__) . '/models/Paging.php';
 
 class Mobile_WS_ListModuleRecords extends Mobile_WS_Controller {
-	
+
 	function isCalendarModule($module) {
 		return ($module == 'Events' || $module == 'Calendar');
 	}
@@ -25,87 +25,89 @@ class Mobile_WS_ListModuleRecords extends Mobile_WS_Controller {
 		$page = $request->get('page', 0);
 		return Mobile_WS_PagingModel::modelWithPageStart($page);
 	}
-	
+
 	function process(Mobile_API_Request $request) {
-		return $this->processSearchRecordLabel($request);
-	}
-	
-	function processSearchRecordLabel(Mobile_API_Request $request) {
-		global $current_user; // Few core API assumes this variable availability
-		
 		$current_user = $this->getActiveUser();
 		$module = $request->get('module');
-		$alertid = $request->get('alertid');
-		$filterid = $request->get('filterid');
-		$search = $request->get('search');
-		
-		$filterOrAlertInstance = false;
-		if(!empty($alertid)) {
-			$filterOrAlertInstance = Mobile_WS_AlertModel::modelWithId($alertid);
-		}
-		else if(!empty($filterid)) {
-			$filterOrAlertInstance = Mobile_WS_FilterModel::modelWithId($module, $filterid);
-		}
-		else if(!empty($search)) {
-			$filterOrAlertInstance = $this->getSearchFilterModel($module, $search);
+		$filterId = $request->get('filterid');
+		$page = $request->get('page','1');
+		$orderBy = $request->getForSql('orderBy');
+		$sortOrder = $request->getForSql('sortOrder');
+		
+		$moduleModel = Vtiger_Module_Model::getInstance($module);
+		$headerFieldModels = $moduleModel->getHeaderViewFieldsList();
+		
+		$headerFields = array();
+		$fields = array();
+		
+		$nameFields = $moduleModel->getNameFields();
+		if(is_string($nameFields)) {
+			$nameFieldModel = $moduleModel->getField($nameFields);
+			$headerFields[] = $nameFields;
+			$fields = array('name'=>$nameFieldModel->get('name'), 'label'=>$nameFieldModel->get('label'), 'fieldType'=>$nameFieldModel->getFieldDataType());
+		} else if(is_array($nameFields)) {
+			foreach($nameFields as $nameField) {
+				$nameFieldModel = $moduleModel->getField($nameField);
+				$headerFields[] = $nameField;
+				$fields[] = array('name'=>$nameFieldModel->get('name'), 'label'=>$nameFieldModel->get('label'), 'fieldType'=>$nameFieldModel->getFieldDataType());
+			}
 		}
 		
-		if($filterOrAlertInstance && strcmp($module, $filterOrAlertInstance->moduleName)) {
-			$response = new Mobile_API_Response();
-			$response->setError(1001, 'Mistached module information.');
-			return $response;
+		foreach($headerFieldModels as $fieldName => $fieldModel) {
+			$headerFields[] = $fieldName;
+			$fields[] = array('name'=>$fieldName, 'label'=>$fieldModel->get('label'), 'fieldType'=>$fieldModel->getFieldDataType());
 		}
-
-		// Initialize with more information
-		if($filterOrAlertInstance) {
-			$filterOrAlertInstance->setUser($current_user);
+		
+		$listViewModel = Vtiger_ListView_Model::getInstance($module, $filterId, $headerFields);
+		
+		if(!empty($sortOrder)) {
+			$listViewModel->set('orderby', $orderBy);
+			$listViewModel->set('sortorder',$sortOrder);
 		}
 		
-		// Paging model
-		$pagingModel = $this->getPagingModel($request);
-
-		if($this->isCalendarModule($module)) {
-			return $this->processSearchRecordLabelForCalendar($request, $pagingModel);
+		$pagingModel = new Vtiger_Paging_Model();
+		$pageLimit = $pagingModel->getPageLimit();
+		$pagingModel->set('page', $page);
+		$pagingModel->set('limit', $pageLimit+1);
+		
+		$listViewEntries = $listViewModel->getListViewEntries($pagingModel);
+		
+		if(empty($filterId)) {
+			$customView = new CustomView($module);
+			$filterId = $customView->getViewId($module);
 		}
-		$records = $this->fetchRecordLabelsForModule($module, $current_user, array(), $filterOrAlertInstance, $pagingModel);
-
-		$modifiedRecords = array();
-		foreach($records as $record) {
-			if ($record instanceof SqlResultIteratorRow) {
-				$record = $record->data;
-				// Remove all integer indexed mappings
-				for($index = count($record); $index > -1; --$index) {
-					if(isset($record[$index])) {
-						unset($record[$index]);
+		
+		if($listViewEntries) {
+			foreach($listViewEntries as $index => $listViewEntryModel) {
+				$data = $listViewEntryModel->getRawData();
+				$record = array('id'=>$listViewEntryModel->getId());
+				foreach($data as $i => $value) {
+					if(is_string($i)) {
+						$record[$i]= decode_html($value); 
 					}
 				}
+				$records[] = $record;
 			}
-			
-			$recordid = $record['id'];
-			unset($record['id']);
-			
-			$eventstart = '';
-			if($this->isCalendarModule($module)) {
-				$eventstart = $record['date_start'];
-				unset($record['date_start']);
-			}
-
-			$values = array_values($record);
-			$label = implode(' ', $values);
-			
-			$modifiedRecord = array('id' => $recordid, 'label'=>$label); 
-			if(!empty($eventstart)) {
-				$modifiedRecord['eventstart'] = $eventstart;
-			}
-			$modifiedRecords[] = $modifiedRecord;
 		}
 		
+		$moreRecords = false;
+		if(count($listViewEntries) > $pageLimit) {
+			$moreRecords = true;
+			array_pop($records);
+		}
+
 		$response = new Mobile_API_Response();
-		$response->setResult(array('records'=>$modifiedRecords, 'module'=>$module));
-		
+		$response->setResult(array(	'records'=>$records, 
+									'headers'=>$fields, 
+									'selectedFilter'=>$filterId, 
+									'nameFields'=>$nameFields,
+									'moreRecords'=>$moreRecords,
+									'orderBy'=>$orderBy,
+									'sortOrder'=>$sortOrder,
+									'page'=>$page));
 		return $response;
 	}
-	
+
 	function processSearchRecordLabelForCalendar(Mobile_API_Request $request, $pagingModel = false) {
 		$current_user = $this->getActiveUser();
 		
diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/Logout.php b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/Logout.php
new file mode 100644
index 0000000000000000000000000000000000000000..cd20246dc3180e0c4646980e815e9c7541791256
--- /dev/null
+++ b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/Logout.php
@@ -0,0 +1,21 @@
+<?php
+/*+**********************************************************************************
+ * The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+ ************************************************************************************/
+class Mobile_WS_Logout extends Mobile_WS_Controller {
+
+	function process(Mobile_API_Request $request) {
+		Mobile_API_Session::destroy();
+		
+		$response = new Mobile_API_Response();
+		$result = array( 'logout' => true );
+		$response->setResult($result);
+		return $response;
+	}
+	
+}
\ No newline at end of file
diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/SaveRecord.php b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/SaveRecord.php
index f3464896812c9abdbc7e3709dc35663cfa9e4032..1ef7ad42c4646b2bb6cad8dfa7f74b0608a74e02 100644
--- a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/SaveRecord.php
+++ b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/SaveRecord.php
@@ -30,63 +30,64 @@ class Mobile_WS_SaveRecord extends Mobile_WS_FetchRecordWithGrouping {
 		
 		$values = "";
 		if(!empty($valuesJSONString) && is_string($valuesJSONString)) {
-            $values = Zend_Json::decode($valuesJSONString);
-        } else {
-            $values = $valuesJSONString; // Either empty or already decoded.
-        }
+			$values = Zend_Json::decode($valuesJSONString);
+		} else {
+			$values = $valuesJSONString; // Either empty or already decoded.
+		}
 
-        $response = new Mobile_API_Response();
+		$response = new Mobile_API_Response();
 
-        if (empty($values)) {
-            $response->setError(1501, "Values cannot be empty!");
-            return $response;
-        }
+		if (empty($values)) {
+			$response->setError(1501, "Values cannot be empty!");
+			return $response;
+		}
 
+		try {
+			if (vtws_recordExists($recordid)) {
+				// Retrieve or Initalize
+				if (!empty($recordid)) {
+					$recordModel = Vtiger_Record_Model::getInstanceById($recordid, $module);
+				} else {
+					$recordModel = Vtiger_Record_Model::getCleanInstance($module);
+				}
 
-        try {
-           if (vtws_recordExists($recordid)) {
-                // Retrieve or Initalize
-                if (!empty($recordid) && !$this->isTemplateRecordRequest($request)) {
-                    $this->recordValues = vtws_retrieve($recordid, $current_user);
-                } else {
-                    $this->recordValues = array();
-                }
+				// Set the modified values
+				foreach($values as $name => $value) {
+					$recordModel->set($name, $value);
+				}
 
-                // Set the modified values
-                foreach($values as $name => $value) {
-                    $this->recordValues[$name] = $value;
-                }
-
-                // Update or Create
-                if (isset($this->recordValues['id'])) {
-                    $this->recordValues = vtws_update($this->recordValues, $current_user);
-                } else {
-
-                    // Set right target module name for Calendar/Event record
-                    if ($module == 'Calendar') {
-                        if (!empty($this->recordValues['eventstatus']) && $this->recordValues['activitytype'] != 'Task') {
-                            $module = 'Events';
-                        }
-                    }
-					// to save Source of Record while Creating
-                    $this->recordValues['source'] = 'MOBILE';
-                    $this->recordValues = vtws_create($module, $this->recordValues, $current_user);
-                }
-
-                // Update the record id
-                $request->set('record', $this->recordValues['id']);
-
-                // Gather response with full details
-                $response = parent::process($request);
-            } else {
-                $response->setError("RECORD_NOT_FOUND", "Record does not exist");
-                return $response;
-            }
-            
-        } catch(Exception $e) {
-            $response->setError($e->getCode(), $e->getMessage());
-        }
-        return $response;
-    }
+				$moduleModel = Vtiger_Module_Model::getInstance($module);
+				$fieldModelList = $moduleModel->getFields();
+				foreach ($fieldModelList as $fieldName => $fieldModel) {
+					$fieldValue = $values[$fieldName];
+					$fieldDataType = $fieldModel->getFieldDataType();
+					if($fieldDataType == 'time'){
+						$fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
+					}
+					if($fieldValue !== null) {
+						if(!is_array($fieldValue) && $fieldDataType != 'currency') {
+							$fieldValue = trim($fieldValue);
+						}
+						$recordModel->set($fieldName, $fieldValue);
+					}
+				}
+				// Update or Create
+				if (!empty($recordid)) {
+					$recordModel->set('id', $recordid);
+					$recordModel->set('mode', 'edit');
+					$recordModel->save();
+				} else {
+					$recordModel->save();
+				}
+				$response->setResult($recordModel->getData());
+			} else {
+				$response->setError("RECORD_NOT_FOUND", "Record does not exist");
+				return $response;
+			}
+		} catch(Exception $e) {
+			$response->setError($e->getCode(), $e->getMessage());
+		}
+		return $response;
+	}
 
 }
\ No newline at end of file
diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/UserInfo.php b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/UserInfo.php
new file mode 100644
index 0000000000000000000000000000000000000000..09f5c77c400d793963927c70db7d099ea9d71105
--- /dev/null
+++ b/pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/UserInfo.php
@@ -0,0 +1,49 @@
+<?php
+/*+**********************************************************************************
+ * The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+ ************************************************************************************/
+include_once dirname(__FILE__) . '/../../api/ws/LoginAndFetchModules.php';
+
+class Mobile_WS_UserInfo extends Mobile_WS_Controller {
+
+	function process(Mobile_API_Request $request) {
+		$current_user = $this->getActiveUser();
+		
+		$userinfo = array(
+			'username' => $current_user->user_name,
+			'id'       => $current_user->id,
+			'first_name' => $current_user->first_name,
+			'last_name' => $current_user->last_name,
+			'email' => $current_user->email1
+		);
+		
+		$allVisibleModules = Settings_MenuEditor_Module_Model::getAllVisibleModules();
+		$appModulesMap = array();
+		
+		foreach($allVisibleModules as $app => $moduleModels) {
+            $moduleInfo = array();
+			foreach($moduleModels as $moduleModel) {
+				$moduleInfo[] = array('name' => $moduleModel->get('name'), 'label'=>vtranslate($moduleModel->get('label'), $moduleModel->get('name')));
+			}
+			$appModulesMap[$app] = $moduleInfo;
+		}
+		
+		$response = new Mobile_API_Response();
+		$result['userinfo'] = $userinfo;
+		$result['menus'] = $appModulesMap;
+		$result['apps'] = Vtiger_MenuStructure_Model::getAppMenuList();
+		$result['defaultApp'] = $this->_getDefaultApp();
+		
+		$response->setResult($result);
+		return $response;
+	}
+	
+	function _getDefaultApp() {
+		return '';
+	}
+}
\ No newline at end of file