diff --git a/app/code/Magento/Bundle/Setup/InstallSchema.php b/app/code/Magento/Bundle/Setup/InstallSchema.php
index 6f98cd386327a182243b4348fa6dc0d02f56cd4e..5c7d5a47da616e801a3dc0e2fc05ab3d0eb69c04 100644
--- a/app/code/Magento/Bundle/Setup/InstallSchema.php
+++ b/app/code/Magento/Bundle/Setup/InstallSchema.php
@@ -24,7 +24,9 @@ class InstallSchema implements InstallSchemaInterface
         $installer = $setup;
 
         $installer->startSetup();
-
+        $customerGroupTable = $setup->getConnection()->describeTable($setup->getTable('customer_group'));
+        $customerGroupIdType = $customerGroupTable['customer_group_id']['DATA_TYPE'] == 'int'
+            ? \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER : $customerGroupTable['customer_group_id']['DATA_TYPE'];
         /**
          * Create table 'catalog_product_bundle_option'
          */
@@ -340,7 +342,7 @@ class InstallSchema implements InstallSchemaInterface
             )
             ->addColumn(
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+                $customerGroupIdType,
                 null,
                 ['unsigned' => true, 'nullable' => false, 'primary' => true],
                 'Customer Group Id'
diff --git a/app/code/Magento/Bundle/Setup/UpgradeSchema.php b/app/code/Magento/Bundle/Setup/UpgradeSchema.php
old mode 100644
new mode 100755
index e48ad97922dc99540f8e4d9b0fb8450d2d023365..ced66a03a3a865cc14e1050d2df94df5c1762ad0
--- a/app/code/Magento/Bundle/Setup/UpgradeSchema.php
+++ b/app/code/Magento/Bundle/Setup/UpgradeSchema.php
@@ -44,6 +44,24 @@ class UpgradeSchema implements UpgradeSchemaInterface
             }
         }
 
+        if (version_compare($context->getVersion(), '2.0.3', '<')) {
+            $tables = [
+                'catalog_product_index_price_bundle_idx',
+                'catalog_product_index_price_bundle_opt_idx',
+                'catalog_product_index_price_bundle_opt_tmp',
+                'catalog_product_index_price_bundle_sel_idx',
+                'catalog_product_index_price_bundle_sel_tmp',
+                'catalog_product_index_price_bundle_tmp',
+            ];
+            foreach ($tables as $table) {
+                $setup->getConnection()->modifyColumn(
+                    $setup->getTable($table),
+                    'customer_group_id',
+                    ['type' => 'integer', 'nullable' => false]
+                );
+            }
+        }
+
         $setup->endSetup();
     }
 }
diff --git a/app/code/Magento/Bundle/etc/module.xml b/app/code/Magento/Bundle/etc/module.xml
index 982a33d00bc6b9dd94f57a5b3b2e4dbd41d719b9..34a88d4447cc3648a94f52c473831959111f5aed 100644
--- a/app/code/Magento/Bundle/etc/module.xml
+++ b/app/code/Magento/Bundle/etc/module.xml
@@ -6,7 +6,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
-    <module name="Magento_Bundle" setup_version="2.0.2">
+    <module name="Magento_Bundle" setup_version="2.0.3">
         <sequence>
             <module name="Magento_Catalog"/>
         </sequence>
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php
index 8a2b76b1bbd56212f27cb45db587e38fc2bb57c8..c338937ae1be1df330d32c4992f3cb5839ebad05 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php
@@ -16,7 +16,6 @@ use Magento\Eav\Api\Data\AttributeGroupInterfaceFactory;
 use Magento\Eav\Api\Data\AttributeInterface;
 use Magento\Eav\Api\Data\AttributeSetInterface;
 use Magento\Framework\Api\SearchCriteriaBuilder;
-use Magento\Framework\Api\SortOrderBuilder;
 use Magento\Framework\Exception\LocalizedException;
 use Psr\Log\LoggerInterface;
 use Magento\Framework\Api\ExtensionAttributesFactory;
@@ -53,11 +52,6 @@ class AddAttributeToTemplate extends \Magento\Catalog\Controller\Adminhtml\Produ
      */
     protected $searchCriteriaBuilder;
 
-    /**
-     * @var SortOrderBuilder
-     */
-    protected $sortOrderBuilder;
-
     /**
      * @var AttributeGroupInterfaceFactory
      */
@@ -115,7 +109,6 @@ class AddAttributeToTemplate extends \Magento\Catalog\Controller\Adminhtml\Produ
             $attributeGroupSearchCriteria = $this->getSearchCriteriaBuilder()
                 ->addFilter('attribute_set_id', $attributeSet->getAttributeSetId())
                 ->addFilter('attribute_group_code', $groupCode)
-                ->addSortOrder($this->getSortOrderBuilder()->setAscendingDirection()->create())
                 ->setPageSize(1)
                 ->create();
 
@@ -252,18 +245,6 @@ class AddAttributeToTemplate extends \Magento\Catalog\Controller\Adminhtml\Produ
         return $this->searchCriteriaBuilder;
     }
 
-    /**
-     * @return SortOrderBuilder
-     */
-    private function getSortOrderBuilder()
-    {
-        if (null === $this->sortOrderBuilder) {
-            $this->sortOrderBuilder = \Magento\Framework\App\ObjectManager::getInstance()
-                ->get(\Magento\Framework\Api\SortOrderBuilder::class);
-        }
-        return $this->sortOrderBuilder;
-    }
-
     /**
      * @return AttributeManagementInterface
      */
diff --git a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php
index 5ed18d15b2f304cdc9ca6e89a7bcc09e2a5c3590..c1f37eca1c55c7b81cf4b14a034738c5211b7085 100644
--- a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php
+++ b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php
@@ -40,6 +40,11 @@ class Suffix extends \Magento\Framework\App\Config\Value
      */
     protected $resource;
 
+    /**
+     * @var \Magento\Framework\App\Config\ScopePool
+     */
+    private $scopePool;
+
     /**
      * @param \Magento\Framework\Model\Context $context
      * @param \Magento\Framework\Registry $registry
@@ -75,6 +80,22 @@ class Suffix extends \Magento\Framework\App\Config\Value
         $this->resource = $appResource;
     }
 
+    /**
+     * Get instance of ScopePool
+     *
+     * @return \Magento\Framework\App\Config\ScopePool
+     * @deprecated
+     */
+    private function getScopePool()
+    {
+        if ($this->scopePool === null) {
+            $this->scopePool = \Magento\Framework\App\ObjectManager::getInstance()->get(
+                \Magento\Framework\App\Config\ScopePool::class
+            );
+        }
+        return $this->scopePool;
+    }
+
     /**
      * Check url rewrite suffix - whether we can support it
      *
@@ -103,6 +124,24 @@ class Suffix extends \Magento\Framework\App\Config\Value
         return parent::afterSave();
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    public function afterDeleteCommit()
+    {
+        if ($this->isValueChanged()) {
+            $this->updateSuffixForUrlRewrites();
+            if ($this->isCategorySuffixChanged()) {
+                $this->cacheTypeList->invalidate([
+                    \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER,
+                    \Magento\Framework\App\Cache\Type\Collection::TYPE_IDENTIFIER
+                ]);
+            }
+        }
+
+        return parent::afterDeleteCommit();
+    }
+
     /**
      * Check is category suffix changed
      *
@@ -135,7 +174,12 @@ class Suffix extends \Magento\Framework\App\Config\Value
         }
         $entities = $this->urlFinder->findAllByData($dataFilter);
         $oldSuffixPattern = '~' . preg_quote($this->getOldValue()) . '$~';
-        $suffix = $this->getValue();
+        if ($this->getValue() !== null) {
+            $suffix = $this->getValue();
+        } else {
+            $this->getScopePool()->clean();
+            $suffix = $this->_config->getValue($this->getPath());
+        }
         foreach ($entities as $urlRewrite) {
             $bind = $urlRewrite->getIsAutogenerated()
                 ? [UrlRewrite::REQUEST_PATH => preg_replace($oldSuffixPattern, $suffix, $urlRewrite->getRequestPath())]
diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php
index 2ccd8af79a5da7eb51f43aeabfa19a9de14c81c1..171e96efe9b0a1e714e1331fc2ed95a175cd58fb 100644
--- a/app/code/Magento/Catalog/Setup/InstallSchema.php
+++ b/app/code/Magento/Catalog/Setup/InstallSchema.php
@@ -1853,6 +1853,9 @@ class InstallSchema implements InstallSchemaInterface
         $installer->getConnection()
             ->createTable($table);
 
+        $customerGroupTable = $setup->getConnection()->describeTable($setup->getTable('customer_group'));
+        $customerGroupIdType = $customerGroupTable['customer_group_id']['DATA_TYPE'] == 'int'
+            ? \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER : $customerGroupTable['customer_group_id']['DATA_TYPE'];
         /**
          * Create table 'catalog_product_entity_tier_price'
          */
@@ -1883,7 +1886,7 @@ class InstallSchema implements InstallSchemaInterface
             )
             ->addColumn(
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+                $customerGroupIdType,
                 null,
                 ['unsigned' => true, 'nullable' => false, 'default' => '0'],
                 'Customer Group ID'
@@ -2937,7 +2940,7 @@ class InstallSchema implements InstallSchemaInterface
             )
             ->addColumn(
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+                $customerGroupIdType,
                 null,
                 ['unsigned' => true, 'nullable' => false, 'primary' => true],
                 'Customer Group ID'
@@ -3056,7 +3059,7 @@ class InstallSchema implements InstallSchemaInterface
             )
             ->addColumn(
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+                $customerGroupIdType,
                 null,
                 ['unsigned' => true, 'nullable' => false, 'primary' => true],
                 'Customer Group ID'
diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php
old mode 100644
new mode 100755
index 9683632f121b6af18a3397e53bac2943521683c9..cbcce1d427bb6c91fa000bff0b4a069ab02d034f
--- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php
+++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php
@@ -36,6 +36,31 @@ class UpgradeSchema implements UpgradeSchemaInterface
         if (version_compare($context->getVersion(), '2.1.0', '<')) {
             $this->addPercentageValueColumn($setup);
         }
+
+        if (version_compare($context->getVersion(), '2.1.1', '<')) {
+            $tables = [
+                'catalog_product_index_price_cfg_opt_agr_idx',
+                'catalog_product_index_price_cfg_opt_agr_tmp',
+                'catalog_product_index_price_cfg_opt_idx',
+                'catalog_product_index_price_cfg_opt_tmp',
+                'catalog_product_index_price_final_idx',
+                'catalog_product_index_price_final_tmp',
+                'catalog_product_index_price_idx',
+                'catalog_product_index_price_opt_agr_idx',
+                'catalog_product_index_price_opt_agr_tmp',
+                'catalog_product_index_price_opt_idx',
+                'catalog_product_index_price_opt_tmp',
+                'catalog_product_index_price_tmp',
+            ];
+            foreach ($tables as $table) {
+                $setup->getConnection()->modifyColumn(
+                    $setup->getTable($table),
+                    'customer_group_id',
+                    ['type' => 'integer', 'nullable' => false]
+                );
+            }
+        }
+
         $setup->endSetup();
     }
 
diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/AddAttributeToTemplateTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/AddAttributeToTemplateTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..a55766f895b62511ced21eedaacc67f6c29811ae
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/AddAttributeToTemplateTest.php
@@ -0,0 +1,247 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Catalog\Test\Unit\Controller\Adminhtml\Product;
+
+use Magento\Catalog\Controller\Adminhtml\Product\AddAttributeToTemplate;
+use Magento\Framework\Exception\LocalizedException;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use Magento\Backend\App\Action\Context;
+use Magento\Catalog\Controller\Adminhtml\Product\Builder as ProductBuilder;
+use Magento\Framework\Controller\Result\JsonFactory;
+use Magento\Framework\App\RequestInterface;
+use Magento\Catalog\Api\AttributeSetRepositoryInterface;
+use Magento\Eav\Api\Data\AttributeSetInterface;
+use Magento\Framework\Api\SearchCriteriaBuilder;
+use Magento\Framework\Api\SearchCriteria;
+use Magento\Eav\Api\AttributeGroupRepositoryInterface;
+use Magento\Eav\Api\Data\AttributeGroupSearchResultsInterface;
+use Magento\Eav\Api\Data\AttributeGroupInterfaceFactory;
+use Magento\Eav\Api\Data\AttributeGroupInterface;
+use Magento\Framework\Controller\Result\Json;
+
+/**
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
+class AddAttributeToTemplateTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var ObjectManager
+     */
+    private $objectManager;
+
+    /**
+     * @var AddAttributeToTemplate
+     */
+    private $controller;
+
+    /**
+     * @var Context|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $contextMock;
+
+    /**
+     * @var ProductBuilder|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $productBuilderMock;
+
+    /**
+     * @var JsonFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $resultJsonFactoryMock;
+
+    /**
+     * @var RequestInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $requestMock;
+
+    /**
+     * @var AttributeSetRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $attributeSetRepositoryMock;
+
+    /**
+     * @var AttributeSetInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $attributeSetInterfaceMock;
+
+    /**
+     * @var SearchCriteriaBuilder|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $searchCriteriaBuilderMock;
+
+    /**
+     * @var SearchCriteria|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $searchCriteriaMock;
+
+    /**
+     * @var AttributeGroupRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $attributeGroupRepositoryMock;
+
+    /**
+     * @var AttributeGroupSearchResultsInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $attributeGroupSearchResultsMock;
+
+    /**
+     * @var AttributeGroupInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $attributeGroupInterfaceFactoryMock;
+
+    /**
+     * @var AttributeGroupInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $attributeGroupInterfaceMock;
+
+    /**
+     * @var Json|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $jsonMock;
+
+    protected function setUp()
+    {
+        $this->objectManager = new ObjectManager($this);
+        $this->contextMock = $this->getMockBuilder(Context::class)
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->productBuilderMock = $this->getMockBuilder(ProductBuilder::class)
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->resultJsonFactoryMock = $this->getMockBuilder(JsonFactory::class)
+            ->disableOriginalConstructor()
+            ->setMethods(['create'])
+            ->getMock();
+        $this->requestMock = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class)
+            ->setMethods(['getParam', 'setParam'])
+            ->getMockForAbstractClass();
+        $this->contextMock->expects($this->once())
+            ->method('getRequest')
+            ->willReturn($this->requestMock);
+        $this->attributeSetRepositoryMock = $this->getMockBuilder(AttributeSetRepositoryInterface::class)
+            ->setMethods(['get'])
+            ->getMockForAbstractClass();
+        $this->attributeSetInterfaceMock = $this->getMockBuilder(AttributeSetInterface::class)
+            ->getMockForAbstractClass();
+        $this->searchCriteriaBuilderMock = $this->getMockBuilder(SearchCriteriaBuilder::class)
+            ->disableOriginalConstructor()
+            ->setMethods(['addFilter', 'create', 'setPageSize'])
+            ->getMockForAbstractClass();
+        $this->searchCriteriaMock = $this->getMockBuilder(SearchCriteria::class)
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->attributeGroupRepositoryMock = $this->getMockBuilder(AttributeGroupRepositoryInterface::class)
+            ->setMethods(['getList'])
+            ->getMockForAbstractClass();
+        $this->attributeGroupSearchResultsMock = $this->getMockBuilder(AttributeGroupSearchResultsInterface::class)
+            ->setMethods(['getItems'])
+            ->getMockForAbstractClass();
+        $this->attributeGroupInterfaceFactoryMock = $this->getMockBuilder(AttributeGroupInterfaceFactory::class)
+            ->setMethods(['create'])
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->attributeGroupInterfaceMock = $this->getMockBuilder(AttributeGroupInterface::class)
+            ->setMethods(['getExtensionAttributes'])
+            ->getMockForAbstractClass();
+        $this->jsonMock = $this->getMockBuilder(Json::class)
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->controller = $this->objectManager->getObject(
+            AddAttributeToTemplate::class,
+            [
+                'context' => $this->contextMock,
+                'productBuilder' => $this->productBuilderMock,
+                'resultJsonFactory' => $this->resultJsonFactoryMock,
+            ]
+        );
+
+        $this->objectManager->setBackwardCompatibleProperty(
+            $this->controller,
+            'attributeSetRepository',
+            $this->attributeSetRepositoryMock
+        );
+        $this->objectManager->setBackwardCompatibleProperty(
+            $this->controller,
+            'searchCriteriaBuilder',
+            $this->searchCriteriaBuilderMock
+        );
+        $this->objectManager->setBackwardCompatibleProperty(
+            $this->controller,
+            'attributeGroupRepository',
+            $this->attributeGroupRepositoryMock
+        );
+        $this->objectManager->setBackwardCompatibleProperty(
+            $this->controller,
+            'attributeGroupFactory',
+            $this->attributeGroupInterfaceFactoryMock
+        );
+    }
+
+    public function testExecuteWithoutAttributeGroupItems()
+    {
+        $groupCode = 'attributes';
+        $groupName = 'Attributes';
+        $groupSortOrder = '15';
+        $templateId = '4';
+        $attributeIds = [
+            'selected' => ["178"],
+            'total' => '1'
+        ];
+
+        $this->requestMock
+            ->expects($this->any())
+            ->method('getParam')
+            ->willReturnMap(
+                [
+                    ['groupCode', null, $groupCode],
+                    ['groupName', null, $groupName],
+                    ['groupSortOrder', null, $groupSortOrder],
+                    ['templateId', null, $templateId],
+                    ['attributeIds', [], $attributeIds]
+                ]
+            );
+
+        $this->attributeSetRepositoryMock->expects($this->once())
+            ->method('get')
+            ->willReturn($this->attributeSetInterfaceMock);
+
+        $this->searchCriteriaBuilderMock->expects($this->any())
+            ->method('addFilter')
+            ->willReturnSelf();
+        $this->searchCriteriaBuilderMock->expects($this->any())
+            ->method('create')
+            ->willReturn($this->searchCriteriaMock);
+        $this->searchCriteriaBuilderMock->expects($this->once())
+            ->method('setPageSize')
+            ->willReturnSelf();
+        $this->searchCriteriaBuilderMock->expects($this->never())
+            ->method('addSortOrder')
+            ->willReturnSelf();
+
+        $this->attributeGroupRepositoryMock->expects($this->once())
+            ->method('getList')
+            ->willReturn($this->attributeGroupSearchResultsMock);
+        $this->attributeGroupSearchResultsMock->expects($this->once())
+            ->method('getItems')
+            ->willReturn(null);
+
+        $this->attributeGroupInterfaceFactoryMock->expects($this->once())
+            ->method('create')
+            ->willReturn($this->attributeGroupInterfaceMock);
+        $this->attributeGroupInterfaceMock->expects($this->once())
+            ->method('getExtensionAttributes')
+            ->willThrowException(new LocalizedException(__('Could not get extension attributes')));
+
+        $this->resultJsonFactoryMock->expects($this->once())
+            ->method('create')
+            ->willReturn($this->jsonMock);
+        $this->jsonMock->expects($this->once())->method('setJsonData')
+            ->willReturnSelf();
+
+        $this->controller->execute();
+    }
+}
diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml
index 1250b55b968480bf9c1d9f9952da6d864048d98f..c629bf6a180ccc0ec42e51a67352f6eaa673dd86 100644
--- a/app/code/Magento/Catalog/etc/module.xml
+++ b/app/code/Magento/Catalog/etc/module.xml
@@ -6,7 +6,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
-    <module name="Magento_Catalog" setup_version="2.1.0">
+    <module name="Magento_Catalog" setup_version="2.1.1">
         <sequence>
             <module name="Magento_Eav"/>
             <module name="Magento_Cms"/>
diff --git a/app/code/Magento/CatalogRule/Setup/InstallSchema.php b/app/code/Magento/CatalogRule/Setup/InstallSchema.php
index 70c5724d446de5e3cd151e69b9ffc5534fec1cbe..cb36f6efbdcde67cff29f360d2aef0d65a954e6a 100644
--- a/app/code/Magento/CatalogRule/Setup/InstallSchema.php
+++ b/app/code/Magento/CatalogRule/Setup/InstallSchema.php
@@ -25,6 +25,9 @@ class InstallSchema implements InstallSchemaInterface
 
         $installer->startSetup();
 
+        $customerGroupTable = $setup->getConnection()->describeTable($setup->getTable('customer_group'));
+        $customerGroupIdType = $customerGroupTable['customer_group_id']['DATA_TYPE'] == 'int'
+            ? \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER : $customerGroupTable['customer_group_id']['DATA_TYPE'];
         /**
          * Create table 'catalogrule'
          */
@@ -372,7 +375,7 @@ class InstallSchema implements InstallSchemaInterface
             )
             ->addColumn(
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+                $customerGroupIdType,
                 null,
                 ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'],
                 'Customer Group Id'
@@ -477,7 +480,7 @@ class InstallSchema implements InstallSchemaInterface
             )
             ->addColumn(
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+                $customerGroupIdType,
                 null,
                 ['unsigned' => true, 'nullable' => false, 'primary' => true],
                 'Customer Group Id'
diff --git a/app/code/Magento/CatalogRule/Setup/UpgradeSchema.php b/app/code/Magento/CatalogRule/Setup/UpgradeSchema.php
index 1d576e74c4c80caabcac9a53f7d3701ba5d66ded..6bfb927c9c8f5ce33d53e68853554d131e5f188f 100644
--- a/app/code/Magento/CatalogRule/Setup/UpgradeSchema.php
+++ b/app/code/Magento/CatalogRule/Setup/UpgradeSchema.php
@@ -26,6 +26,20 @@ class UpgradeSchema implements UpgradeSchemaInterface
             $this->removeSubProductDiscounts($setup);
         }
 
+        if (version_compare($context->getVersion(), '2.0.2', '<')) {
+            $tables = [
+                'catalogrule_product',
+                'catalogrule_product_price',
+            ];
+            foreach ($tables as $table) {
+                $setup->getConnection()->modifyColumn(
+                    $setup->getTable($table),
+                    'customer_group_id',
+                    ['type' => 'integer']
+                );
+            }
+        }
+
         $setup->endSetup();
     }
 
diff --git a/app/code/Magento/CatalogRule/etc/module.xml b/app/code/Magento/CatalogRule/etc/module.xml
index ea6a730279ed54ba2caf76f1cab17d8fc21f9585..d7db233e1eb06ee815e1c7e71a325b0c0d0f8f92 100644
--- a/app/code/Magento/CatalogRule/etc/module.xml
+++ b/app/code/Magento/CatalogRule/etc/module.xml
@@ -6,7 +6,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
-    <module name="Magento_CatalogRule" setup_version="2.0.1">
+    <module name="Magento_CatalogRule" setup_version="2.0.2">
         <sequence>
             <module name="Magento_Rule"/>
             <module name="Magento_Catalog"/>
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js
index ddb62ceb37b37ef6bc7735c78f81367c5c6d4343..8910e41731d11a9be99bf1777dc13e3550781976 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js
@@ -179,7 +179,7 @@ define(
                     newShippingAddress;
 
                 this.source.set('params.invalid', false);
-                this.source.trigger('shippingAddress.data.validate');
+                this.triggerShippingDataValidateEvent();
 
                 if (!this.source.get('params.invalid')) {
                     addressData = this.source.get('shippingAddress');
@@ -254,12 +254,7 @@ define(
 
                 if (this.isFormInline) {
                     this.source.set('params.invalid', false);
-                    this.source.trigger('shippingAddress.data.validate');
-
-                    if (this.source.get('shippingAddress.custom_attributes')) {
-                        this.source.trigger('shippingAddress.custom_attributes.data.validate');
-                    }
-
+                    this.triggerShippingDataValidateEvent();
                     if (emailValidationResult &&
                         this.source.get('params.invalid') ||
                         !quote.shippingMethod().method_code ||
@@ -304,6 +299,18 @@ define(
                 }
 
                 return true;
+            },
+
+            /**
+             * Trigger Shipping data Validate Event.
+             *
+             * @return {void}
+             */
+            triggerShippingDataValidateEvent: function () {
+                this.source.trigger('shippingAddress.data.validate');
+                if (this.source.get('shippingAddress.custom_attributes')) {
+                    this.source.trigger('shippingAddress.custom_attributes.data.validate');
+                }
             }
         });
     }
diff --git a/app/code/Magento/Customer/Block/Account/AuthorizationLink.php b/app/code/Magento/Customer/Block/Account/AuthorizationLink.php
index f2e2f1d0bd77f24408dc3f9f7492efce5775fe18..9cb3f8fdd94d613747595b3f03e3a492e6c0d342 100644
--- a/app/code/Magento/Customer/Block/Account/AuthorizationLink.php
+++ b/app/code/Magento/Customer/Block/Account/AuthorizationLink.php
@@ -6,13 +6,14 @@
 namespace Magento\Customer\Block\Account;
 
 use Magento\Customer\Model\Context;
+use Magento\Customer\Block\Account\SortLinkInterface;
 
 /**
  * Customer authorization link
  *
  * @SuppressWarnings(PHPMD.DepthOfInheritance)
  */
-class AuthorizationLink extends \Magento\Framework\View\Element\Html\Link
+class AuthorizationLink extends \Magento\Framework\View\Element\Html\Link implements SortLinkInterface
 {
     /**
      * Customer session
@@ -88,4 +89,12 @@ class AuthorizationLink extends \Magento\Framework\View\Element\Html\Link
     {
         return $this->httpContext->getValue(Context::CONTEXT_AUTH);
     }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getSortOrder()
+    {
+        return $this->getData(self::SORT_ORDER);
+    }
 }
diff --git a/app/code/Magento/Customer/Block/Account/Delimiter.php b/app/code/Magento/Customer/Block/Account/Delimiter.php
new file mode 100644
index 0000000000000000000000000000000000000000..31ded827184eb810cbffba562d2e1b388e573c5f
--- /dev/null
+++ b/app/code/Magento/Customer/Block/Account/Delimiter.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Customer\Block\Account;
+
+/**
+ * Class for delimiter.
+ */
+class Delimiter extends \Magento\Framework\View\Element\Template implements SortLinkInterface
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getSortOrder()
+    {
+        return $this->getData(self::SORT_ORDER);
+    }
+}
diff --git a/app/code/Magento/Customer/Block/Account/Link.php b/app/code/Magento/Customer/Block/Account/Link.php
index 59961971a0ca8c697980f621e7b3777bd7569823..d37a9a548d44ffd5ef97ea0da05ee17a7149b38b 100644
--- a/app/code/Magento/Customer/Block/Account/Link.php
+++ b/app/code/Magento/Customer/Block/Account/Link.php
@@ -5,12 +5,14 @@
  */
 namespace Magento\Customer\Block\Account;
 
+use Magento\Customer\Block\Account\SortLinkInterface;
+
 /**
  * Class Link
  *
  * @SuppressWarnings(PHPMD.DepthOfInheritance)
  */
-class Link extends \Magento\Framework\View\Element\Html\Link
+class Link extends \Magento\Framework\View\Element\Html\Link implements SortLinkInterface
 {
     /**
      * @var \Magento\Customer\Model\Url
@@ -38,4 +40,12 @@ class Link extends \Magento\Framework\View\Element\Html\Link
     {
         return $this->_customerUrl->getAccountUrl();
     }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getSortOrder()
+    {
+        return $this->getData(self::SORT_ORDER);
+    }
 }
diff --git a/app/code/Magento/Customer/Block/Account/Navigation.php b/app/code/Magento/Customer/Block/Account/Navigation.php
new file mode 100644
index 0000000000000000000000000000000000000000..d8644f5565f3b6a8a4318c914719bc6c9fec3867
--- /dev/null
+++ b/app/code/Magento/Customer/Block/Account/Navigation.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Customer\Block\Account;
+
+use \Magento\Framework\View\Element\Html\Links;
+use \Magento\Customer\Block\Account\SortLinkInterface;
+
+/**
+ * Class for sorting links in navigation panels.
+ */
+class Navigation extends Links
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getLinks()
+    {
+        $links = $this->_layout->getChildBlocks($this->getNameInLayout());
+        $sortableLink = [];
+        foreach ($links as $key => $link) {
+            if ($link instanceof SortLinkInterface) {
+                $sortableLink[] = $link;
+                unset($links[$key]);
+            }
+        }
+
+        usort($sortableLink, [$this, "compare"]);
+        return array_merge($sortableLink, $links);
+    }
+
+    /**
+     * Compare sortOrder in links.
+     *
+     * @param SortLinkInterface $firstLink
+     * @param SortLinkInterface $secondLink
+     * @return int
+     * @SuppressWarnings(PHPMD.UnusedPrivateMethod)
+     */
+    private function compare(SortLinkInterface $firstLink, SortLinkInterface $secondLink)
+    {
+        return ($firstLink->getSortOrder() < $secondLink->getSortOrder());
+    }
+}
diff --git a/app/code/Magento/Customer/Block/Account/SortLink.php b/app/code/Magento/Customer/Block/Account/SortLink.php
new file mode 100644
index 0000000000000000000000000000000000000000..2c60e804b7b216ebd26f8baefb8a3addd3fd9176
--- /dev/null
+++ b/app/code/Magento/Customer/Block/Account/SortLink.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Customer\Block\Account;
+
+/**
+ * Class for sortable links.
+ */
+class SortLink extends \Magento\Framework\View\Element\Html\Link\Current implements SortLinkInterface
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getSortOrder()
+    {
+        return $this->getData(self::SORT_ORDER);
+    }
+}
diff --git a/app/code/Magento/Customer/Block/Account/SortLinkInterface.php b/app/code/Magento/Customer/Block/Account/SortLinkInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..815f4e5adf2fdc29993ea0bf9743c5049eb84967
--- /dev/null
+++ b/app/code/Magento/Customer/Block/Account/SortLinkInterface.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Customer\Block\Account;
+
+/**
+ * Interface for sortable links.
+ * @api
+ */
+interface SortLinkInterface
+{
+    /**#@+
+     * Constant for confirmation status
+     */
+    const SORT_ORDER = 'sortOrder';
+    /**#@-*/
+
+    /**
+     * Get sort order for block.
+     *
+     * @return int
+     */
+    public function getSortOrder();
+}
diff --git a/app/code/Magento/Customer/Model/ResourceModel/Group.php b/app/code/Magento/Customer/Model/ResourceModel/Group.php
index 7496940fe335067df022976b201e0d4ab85d9211..5fb02997cd73117eda354f2e1bf2617d41b10d77 100644
--- a/app/code/Magento/Customer/Model/ResourceModel/Group.php
+++ b/app/code/Magento/Customer/Model/ResourceModel/Group.php
@@ -129,4 +129,65 @@ class Group extends \Magento\Framework\Model\ResourceModel\Db\VersionControl\Abs
         $group->setCode(substr($group->getCode(), 0, $group::GROUP_CODE_MAX_LENGTH));
         return parent::_beforeSave($group);
     }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
+    {
+        if ($object->getId() == \Magento\Customer\Model\Group::CUST_GROUP_ALL) {
+            $this->skipReservedId($object);
+        }
+
+        return $this;
+    }
+
+    /**
+     * Here we do not allow to save systems reserved ID.
+     *
+     * @param \Magento\Framework\Model\AbstractModel $object
+     * @throws \Magento\Framework\Exception\LocalizedException
+     * @return void
+     */
+    private function skipReservedId(\Magento\Framework\Model\AbstractModel $object)
+    {
+        $tableFieldsWithoutIdField = $this->getTableFieldsWithoutIdField();
+        $select = $this->getConnection()->select();
+        $select->from(
+            [$this->getMainTable()],
+            $tableFieldsWithoutIdField
+        )
+            ->where('customer_group_id = ?', \Magento\Customer\Model\Group::CUST_GROUP_ALL);
+
+        $query = $this->getConnection()->insertFromSelect(
+            $select,
+            $this->getMainTable(),
+            $tableFieldsWithoutIdField
+        );
+        $this->getConnection()->query($query);
+        $lastInsertId = $this->getConnection()->lastInsertId();
+
+        $query = $this->getConnection()->deleteFromSelect(
+            $select,
+            $this->getMainTable()
+        );
+        $this->getConnection()->query($query);
+
+        $object->setId($lastInsertId);
+    }
+
+    /**
+     * Get main table fields except of ID field.
+     *
+     * @return array
+     */
+    private function getTableFieldsWithoutIdField()
+    {
+        $fields = $this->getConnection()->describeTable($this->getMainTable());
+        if (isset($fields['customer_group_id'])) {
+            unset($fields['customer_group_id']);
+        }
+
+        return array_keys($fields);
+    }
 }
diff --git a/app/code/Magento/Customer/Setup/UpgradeSchema.php b/app/code/Magento/Customer/Setup/UpgradeSchema.php
old mode 100644
new mode 100755
index 18fc9b9f8d597bc3789d0053192497292be807b9..33ec2352e865d0b6fd5cbbde5d9646b5dd92975d
--- a/app/code/Magento/Customer/Setup/UpgradeSchema.php
+++ b/app/code/Magento/Customer/Setup/UpgradeSchema.php
@@ -108,6 +108,96 @@ class UpgradeSchema implements UpgradeSchemaInterface
             );
         }
 
+        if (version_compare($context->getVersion(), '2.0.10', '<')) {
+            $foreignKeys = $this->getForeignKeys($setup);
+            $this->dropForeignKeys($setup, $foreignKeys);
+            $this->alterTables($setup, $foreignKeys);
+            $this->createForeignKeys($setup, $foreignKeys);
+        }
+
         $setup->endSetup();
     }
+
+    /**
+     * @param SchemaSetupInterface $setup
+     * @param array $keys
+     * @return void
+     */
+    private function alterTables(SchemaSetupInterface $setup, array $keys)
+    {
+        $setup->getConnection()->modifyColumn(
+            $setup->getTable('customer_group'),
+            'customer_group_id',
+            [
+                'type' => 'integer',
+                'unsigned' => true,
+                'identity' => true,
+                'nullable' => false
+            ]
+        );
+        foreach ($keys as $key) {
+            $setup->getConnection()->modifyColumn(
+                $key['TABLE_NAME'],
+                $key['COLUMN_NAME'],
+                [
+                    'type' => 'integer',
+                    'unsigned' => true,
+                    'nullable' => false
+                ]
+            );
+        }
+    }
+
+    /**
+     * @param SchemaSetupInterface $setup
+     * @param array $keys
+     * @return void
+     */
+    private function dropForeignKeys(SchemaSetupInterface $setup, array $keys)
+    {
+        foreach ($keys as $key) {
+            $setup->getConnection()->dropForeignKey($key['TABLE_NAME'], $key['FK_NAME']);
+        }
+    }
+
+    /**
+     * @param SchemaSetupInterface $setup
+     * @param array $keys
+     * @return void
+     */
+    private function createForeignKeys(SchemaSetupInterface $setup, array $keys)
+    {
+        foreach ($keys as $key) {
+            $setup->getConnection()->addForeignKey(
+                $key['FK_NAME'],
+                $key['TABLE_NAME'],
+                $key['COLUMN_NAME'],
+                $key['REF_TABLE_NAME'],
+                $key['REF_COLUMN_NAME'],
+                $key['ON_DELETE']
+            );
+        }
+    }
+
+    /**
+     * @param SchemaSetupInterface $setup
+     * @return array
+     */
+    private function getForeignKeys(SchemaSetupInterface $setup)
+    {
+        $foreignKeys = [];
+        $keysTree = $setup->getConnection()->getForeignKeysTree();
+        foreach ($keysTree as $indexes) {
+            foreach ($indexes as $index) {
+                if (
+                    $index['REF_TABLE_NAME'] == $setup->getTable('customer_group')
+                    && $index['REF_COLUMN_NAME'] == 'customer_group_id'
+                ) {
+                    $foreignKeys[] = $index;
+                }
+
+            }
+        }
+        return $foreignKeys;
+    }
 }
diff --git a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/GroupTest.php b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/GroupTest.php
index 6520556842a79d5ad4fb44f05c7706e6dfacba69..8305114ad70cd1edfb15f6615b39f12ee41d8ec3 100644
--- a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/GroupTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/GroupTest.php
@@ -9,6 +9,7 @@
 namespace Magento\Customer\Test\Unit\Model\ResourceModel;
 
 use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
+use Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot;
 
 /**
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -36,6 +37,16 @@ class GroupTest extends \PHPUnit_Framework_TestCase
     /** @var \PHPUnit_Framework_MockObject_MockObject */
     protected $relationProcessorMock;
 
+    /**
+     * @var Snapshot|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $snapshotMock;
+
+    /**
+     * Setting up dependencies.
+     *
+     * @return void
+     */
     protected function setUp()
     {
         $this->resource = $this->getMock(\Magento\Framework\App\ResourceConnection::class, [], [], '', false);
@@ -67,10 +78,18 @@ class GroupTest extends \PHPUnit_Framework_TestCase
             false
         );
 
+        $this->snapshotMock = $this->getMock(
+            \Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot::class,
+            [],
+            [],
+            '',
+            false
+        );
+
         $transactionManagerMock = $this->getMock(
             \Magento\Framework\Model\ResourceModel\Db\TransactionManagerInterface::class
         );
-        $transactionManagerMock->expects($this->once())
+        $transactionManagerMock->expects($this->any())
             ->method('start')
             ->willReturn($this->getMock(\Magento\Framework\DB\Adapter\AdapterInterface::class));
         $contextMock->expects($this->once())
@@ -86,10 +105,62 @@ class GroupTest extends \PHPUnit_Framework_TestCase
                 'context' => $contextMock,
                 'groupManagement' => $this->groupManagement,
                 'customersFactory' => $this->customersFactory,
+                'entitySnapshot' => $this->snapshotMock
             ]
         );
     }
 
+    /**
+     * Test for save() method when we try to save entity with system's reserved ID.
+     * 
+     * @return void
+     */
+    public function testSaveWithReservedId()
+    {
+        $expectedId = 55;
+        $this->snapshotMock->expects($this->once())->method('isModified')->willReturn(true);
+        $this->snapshotMock->expects($this->once())->method('registerSnapshot')->willReturnSelf();
+
+        $this->groupModel->expects($this->any())->method('getId')
+            ->willReturn(\Magento\Customer\Model\Group::CUST_GROUP_ALL);
+        $this->groupModel->expects($this->any())->method('getData')
+            ->willReturn([]);
+        $this->groupModel->expects($this->any())->method('isSaveAllowed')
+            ->willReturn(true);
+        $this->groupModel->expects($this->any())->method('getStoredData')
+            ->willReturn([]);
+        $this->groupModel->expects($this->once())->method('setId')
+            ->with($expectedId);
+
+        $dbAdapter = $this->getMockBuilder(\Magento\Framework\DB\Adapter\AdapterInterface::class)
+            ->disableOriginalConstructor()
+            ->setMethods(
+                [
+                    'lastInsertId',
+                    'describeTable',
+                    'update',
+                    'select'
+                ]
+            )
+            ->getMockForAbstractClass();
+        $dbAdapter->expects($this->any())->method('describeTable')->willReturn([]);
+        $dbAdapter->expects($this->any())->method('update')->willReturnSelf();
+        $dbAdapter->expects($this->once())->method('lastInsertId')->willReturn($expectedId);
+        $selectMock = $this->getMockBuilder(\Magento\Framework\DB\Select::class)
+            ->disableOriginalConstructor()
+            ->getMock();
+        $dbAdapter->expects($this->any())->method('select')->willReturn($selectMock);
+        $selectMock->expects($this->any())->method('from')->willReturnSelf();
+        $this->resource->expects($this->any())->method('getConnection')->willReturn($dbAdapter);
+
+        $this->groupResourceModel->save($this->groupModel);
+    }
+
+    /**
+     * Test for delete() method when we try to save entity with system's reserved ID.
+     *
+     * @return void
+     */
     public function testDelete()
     {
         $dbAdapter = $this->getMock(\Magento\Framework\DB\Adapter\AdapterInterface::class);
diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml
index b45d00ad0cdddcc1c46645569b92c7848feb8cff..9113895f2e58a2ead7088b54e32e693bf0c1e975 100644
--- a/app/code/Magento/Customer/etc/di.xml
+++ b/app/code/Magento/Customer/etc/di.xml
@@ -55,6 +55,8 @@
                 type="Magento\Customer\Model\Customer\Source\Group" />
     <preference for="Magento\Customer\Model\Customer\Attribute\Source\GroupSourceLoggedInOnlyInterface"
                 type="Magento\Customer\Model\Customer\Attribute\Source\Group"/>
+    <preference for="Magento\Customer\Block\Account\SortLinkInterface"
+                type="Magento\Customer\Block\Account\SortLink"/>
     <type name="Magento\Customer\Model\Session">
         <arguments>
             <argument name="configShare" xsi:type="object">Magento\Customer\Model\Config\Share\Proxy</argument>
diff --git a/app/code/Magento/Customer/etc/module.xml b/app/code/Magento/Customer/etc/module.xml
index fd8307fc36657d8aacc419b2ad48006969cf68f0..f505adb98a0fab653636175a8e10c755521bd706 100644
--- a/app/code/Magento/Customer/etc/module.xml
+++ b/app/code/Magento/Customer/etc/module.xml
@@ -6,7 +6,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
-    <module name="Magento_Customer" setup_version="2.0.9">
+    <module name="Magento_Customer" setup_version="2.0.10">
         <sequence>
             <module name="Magento_Eav"/>
             <module name="Magento_Directory"/>
diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account.xml
index a96dfcd86e542d3ce3bce5fd9fcc39d434c28bcd..0f95cde6798fef89eb7e12673778b84c505029d3 100644
--- a/app/code/Magento/Customer/view/frontend/layout/customer_account.xml
+++ b/app/code/Magento/Customer/view/frontend/layout/customer_account.xml
@@ -9,24 +9,45 @@
     <body>
         <attribute name="class" value="account"/>
         <referenceContainer name="sidebar.main">
-            <block class="Magento\Framework\View\Element\Html\Links" name="customer_account_navigation" before="-" template="Magento_Customer::account/navigation.phtml">
-                <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-account-link">
+            <block class="Magento\Framework\View\Element\Template" template="Magento_Theme::html/collapsible.phtml" before="-">
+                <arguments>
+                    <argument name="block_css" xsi:type="string">account-nav</argument>
+                </arguments>
+                <block class="Magento\Customer\Block\Account\Navigation" name="customer_account_navigation" before="-">
                     <arguments>
-                        <argument name="label" xsi:type="string" translate="true">Account Dashboard</argument>
-                        <argument name="path" xsi:type="string">customer/account</argument>
-                    </arguments>
-                </block>
-                <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-account-edit-link">
-                    <arguments>
-                        <argument name="label" xsi:type="string" translate="true">Account Information</argument>
-                        <argument name="path" xsi:type="string">customer/account/edit</argument>
-                    </arguments>
-                </block>
-                <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-address-link">
-                    <arguments>
-                        <argument name="label" xsi:type="string" translate="true">Address Book</argument>
-                        <argument name="path" xsi:type="string">customer/address</argument>
+                        <argument name="css_class" xsi:type="string">nav items</argument>
                     </arguments>
+                    <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-account-link">
+                        <arguments>
+                            <argument name="label" xsi:type="string" translate="true">Account Dashboard</argument>
+                            <argument name="path" xsi:type="string">customer/account</argument>
+                            <argument name="sortOrder" xsi:type="number">250</argument>
+                        </arguments>
+                    </block>
+                    <block class="Magento\Customer\Block\Account\Delimiter" name="customer-account-navigation-delimiter-1" template="Magento_Customer::account/navigation-delimiter.phtml">
+                        <arguments>
+                            <argument name="sortOrder" xsi:type="number">200</argument>
+                        </arguments>
+                    </block>
+                    <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-address-link">
+                        <arguments>
+                            <argument name="label" xsi:type="string" translate="true">Address Book</argument>
+                            <argument name="path" xsi:type="string">customer/address</argument>
+                            <argument name="sortOrder" xsi:type="number">190</argument>
+                        </arguments>
+                    </block>
+                    <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-account-edit-link">
+                        <arguments>
+                            <argument name="label" xsi:type="string" translate="true">Account Information</argument>
+                            <argument name="path" xsi:type="string">customer/account/edit</argument>
+                            <argument name="sortOrder" xsi:type="number">180</argument>
+                        </arguments>
+                    </block>
+                    <block class="Magento\Customer\Block\Account\Delimiter" name="customer-account-navigation-delimiter-2" template="Magento_Customer::account/navigation-delimiter.phtml">
+                        <arguments>
+                            <argument name="sortOrder" xsi:type="number">130</argument>
+                        </arguments>
+                    </block>
                 </block>
             </block>
         </referenceContainer>
diff --git a/app/code/Magento/Customer/view/frontend/layout/default.xml b/app/code/Magento/Customer/view/frontend/layout/default.xml
index 50580f73a9d3100dc4e17191f9d30804091e12b2..278c16b324da42c07b47c91d73d215e301af842f 100644
--- a/app/code/Magento/Customer/view/frontend/layout/default.xml
+++ b/app/code/Magento/Customer/view/frontend/layout/default.xml
@@ -11,6 +11,7 @@
             <block class="Magento\Customer\Block\Account\Link" name="my-account-link">
                 <arguments>
                     <argument name="label" xsi:type="string" translate="true">My Account</argument>
+                    <argument name="sortOrder" xsi:type="number">110</argument>
                 </arguments>
             </block>
             <block class="Magento\Customer\Block\Account\RegisterLink" name="register-link">
diff --git a/app/code/Magento/Customer/view/frontend/templates/account/navigation-delimiter.phtml b/app/code/Magento/Customer/view/frontend/templates/account/navigation-delimiter.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..bbc80e6686c4f4345286a185c6156a744b6a52f5
--- /dev/null
+++ b/app/code/Magento/Customer/view/frontend/templates/account/navigation-delimiter.phtml
@@ -0,0 +1,9 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+?>
+<li class="nav item">
+    <span class="delimiter"></span>
+</li>
diff --git a/app/code/Magento/Downloadable/Setup/UpgradeSchema.php b/app/code/Magento/Downloadable/Setup/UpgradeSchema.php
new file mode 100755
index 0000000000000000000000000000000000000000..76ed3f2aae275196993757de9a5a91240773a902
--- /dev/null
+++ b/app/code/Magento/Downloadable/Setup/UpgradeSchema.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Downloadable\Setup;
+
+use Magento\Framework\Setup\UpgradeSchemaInterface;
+use Magento\Framework\Setup\ModuleContextInterface;
+use Magento\Framework\Setup\SchemaSetupInterface;
+
+/**
+ * @codeCoverageIgnore
+ */
+class UpgradeSchema implements UpgradeSchemaInterface
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
+    {
+        $setup->startSetup();
+
+        if (version_compare($context->getVersion(), '2.0.2', '<')) {
+            $tables = [
+                'catalog_product_index_price_downlod_idx',
+                'catalog_product_index_price_downlod_tmp',
+            ];
+            foreach ($tables as $table) {
+                $setup->getConnection()->modifyColumn(
+                    $setup->getTable($table),
+                    'customer_group_id',
+                    ['type' => 'integer', 'nullable' => false]
+                );
+            }
+        }
+
+        $setup->endSetup();
+    }
+}
diff --git a/app/code/Magento/Downloadable/etc/module.xml b/app/code/Magento/Downloadable/etc/module.xml
index a2fa1d9d569ddd6d4f7a42c9bf47bb449c3ac637..c6fd9c6a982e433d555b18ff5c35965550943e7e 100644
--- a/app/code/Magento/Downloadable/etc/module.xml
+++ b/app/code/Magento/Downloadable/etc/module.xml
@@ -6,7 +6,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
-    <module name="Magento_Downloadable" setup_version="2.0.1">
+    <module name="Magento_Downloadable" setup_version="2.0.2">
         <sequence>
             <module name="Magento_Catalog"/>
         </sequence>
diff --git a/app/code/Magento/Downloadable/view/frontend/layout/customer_account.xml b/app/code/Magento/Downloadable/view/frontend/layout/customer_account.xml
index 8d4f13f2bfb160c490ab88f100586d745877d17b..96bcb556edf0dd652b149244ee288f50abff618e 100644
--- a/app/code/Magento/Downloadable/view/frontend/layout/customer_account.xml
+++ b/app/code/Magento/Downloadable/view/frontend/layout/customer_account.xml
@@ -8,10 +8,11 @@
 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
     <body>
         <referenceBlock name="customer_account_navigation">
-            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-downloadable-products-link">
+            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-downloadable-products-link">
                 <arguments>
                     <argument name="path" xsi:type="string">downloadable/customer/products</argument>
                     <argument name="label" xsi:type="string">My Downloadable Products</argument>
+                    <argument name="sortOrder" xsi:type="number">220</argument>
                 </arguments>
             </block>
         </referenceBlock>
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php
index 9c2aeeec4abf5d2817df474c4a7c1cfbb818df6f..2b5bbc406d4690602acff51e79904a82aaad9151 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php
@@ -5,6 +5,9 @@
  */
 namespace Magento\Eav\Model\Entity\Attribute\Source;
 
+use Magento\Framework\App\ObjectManager;
+use Magento\Store\Model\StoreManagerInterface;
+
 class Table extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
 {
     /**
@@ -24,6 +27,11 @@ class Table extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
      */
     protected $_attrOptionFactory;
 
+    /**
+     * @var StoreManagerInterface
+     */
+    private $storeManager;
+
     /**
      * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory
      * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory $attrOptionFactory
@@ -47,24 +55,30 @@ class Table extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
     public function getAllOptions($withEmpty = true, $defaultValues = false)
     {
         $storeId = $this->getAttribute()->getStoreId();
+        if ($storeId === null) {
+            $storeId = $this->getStoreManager()->getStore()->getId();
+        }
         if (!is_array($this->_options)) {
             $this->_options = [];
         }
         if (!is_array($this->_optionsDefault)) {
             $this->_optionsDefault = [];
         }
-        if (!isset($this->_options[$storeId])) {
+        $attributeId = $this->getAttribute()->getId();
+        if (!isset($this->_options[$storeId][$attributeId])) {
             $collection = $this->_attrOptionCollectionFactory->create()->setPositionOrder(
                 'asc'
             )->setAttributeFilter(
-                $this->getAttribute()->getId()
+                $attributeId
             )->setStoreFilter(
-                $this->getAttribute()->getStoreId()
+                $storeId
             )->load();
-            $this->_options[$storeId] = $collection->toOptionArray();
-            $this->_optionsDefault[$storeId] = $collection->toOptionArray('default_value');
+            $this->_options[$storeId][$attributeId] = $collection->toOptionArray();
+            $this->_optionsDefault[$storeId][$attributeId] = $collection->toOptionArray('default_value');
         }
-        $options = $defaultValues ? $this->_optionsDefault[$storeId] : $this->_options[$storeId];
+        $options = $defaultValues
+            ? $this->_optionsDefault[$storeId][$attributeId]
+            : $this->_options[$storeId][$attributeId];
         if ($withEmpty) {
             $options = $this->addEmptyOption($options);
         }
@@ -72,6 +86,20 @@ class Table extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
         return $options;
     }
 
+    /**
+     * Get StoreManager dependency
+     *
+     * @return StoreManagerInterface
+     * @deprecated
+     */
+    private function getStoreManager()
+    {
+        if ($this->storeManager === null) {
+            $this->storeManager = ObjectManager::getInstance()->get(StoreManagerInterface::class);
+        }
+        return $this->storeManager;
+    }
+
     /**
      * Retrieve Option values array by ids
      *
diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php
index fcae389b8e2e3d6d7e312055a305b4b615734c59..9b893bf9017681b584a611939f1332ee50fbc869 100644
--- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php
+++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php
@@ -6,6 +6,11 @@
 namespace Magento\Eav\Test\Unit\Model\Entity\Attribute\Source;
 
 use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
+use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
+use Magento\Store\Model\StoreManagerInterface;
+use Magento\Store\Api\Data\StoreInterface;
+use Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection as AttributeOptionCollection;
 
 /**
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -28,6 +33,31 @@ class TableTest extends \PHPUnit_Framework_TestCase
      */
     private $attrOptionFactory;
 
+    /**
+     * @var AbstractSource | \PHPUnit_Framework_MockObject_MockObject
+     */
+    private $sourceMock;
+
+    /**
+     * @var AbstractAttribute | \PHPUnit_Framework_MockObject_MockObject
+     */
+    private $abstractAttributeMock;
+
+    /**
+     * @var StoreManagerInterface | \PHPUnit_Framework_MockObject_MockObject
+     */
+    private $storeManagerMock;
+
+    /**
+     * @var StoreInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $storeMock;
+
+    /**
+     * @var AttributeOptionCollection|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $attributeOptionCollectionMock;
+
     protected function setUp()
     {
         $objectManager = new ObjectManager($this);
@@ -48,6 +78,11 @@ class TableTest extends \PHPUnit_Framework_TestCase
             false
         );
 
+        $this->attributeOptionCollectionMock = $this->getMockBuilder(AttributeOptionCollection::class)
+            ->setMethods(['toOptionArray'])
+            ->disableOriginalConstructor()
+            ->getMock();
+
         $this->attrOptionFactory = $this->getMockBuilder(
             \Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory::class
         )
@@ -55,6 +90,20 @@ class TableTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->getMockForAbstractClass();
 
+        $this->sourceMock = $this->getMockBuilder(AbstractSource::class)
+            ->disableOriginalConstructor()
+            ->getMockForAbstractClass();
+
+        $this->abstractAttributeMock = $this->getMockBuilder(AbstractAttribute::class)
+            ->setMethods(
+                [
+                    'getFrontend', 'getAttributeCode', '__wakeup', 'getStoreId',
+                    'getId', 'getIsRequired', 'getEntity', 'getBackend'
+                ]
+            )
+            ->disableOriginalConstructor()
+            ->getMockForAbstractClass();
+
         $this->model = $objectManager->getObject(
             \Magento\Eav\Model\Entity\Attribute\Source\Table::class,
             [
@@ -62,6 +111,16 @@ class TableTest extends \PHPUnit_Framework_TestCase
                 'attrOptionFactory' => $this->attrOptionFactory
             ]
         );
+        $this->model->setAttribute($this->abstractAttributeMock);
+
+        $this->storeManagerMock = $this->getMockForAbstractClass(StoreManagerInterface::class);
+        $this->storeMock = $this->getMockForAbstractClass(StoreInterface::class);
+
+        $objectManager->setBackwardCompatibleProperty(
+            $this->model,
+            'storeManager',
+            $this->storeManagerMock
+        );
     }
 
     public function testGetFlatColumns()
@@ -74,25 +133,8 @@ class TableTest extends \PHPUnit_Framework_TestCase
             false
         );
 
-        $abstractAttributeMock = $this->getMock(
-            \Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class,
-            ['getFrontend', 'getAttributeCode', '__wakeup'],
-            [],
-            '',
-            false
-        );
-
-        $abstractAttributeMock->expects(
-            $this->any()
-        )->method(
-            'getFrontend'
-        )->will(
-            $this->returnValue($abstractFrontendMock)
-        );
-
-        $abstractAttributeMock->expects($this->any())->method('getAttributeCode')->will($this->returnValue('code'));
-
-        $this->model->setAttribute($abstractAttributeMock);
+        $this->abstractAttributeMock->expects($this->any())->method('getFrontend')->willReturn(($abstractFrontendMock));
+        $this->abstractAttributeMock->expects($this->any())->method('getAttributeCode')->willReturn('code');
 
         $flatColumns = $this->model->getFlatColumns();
 
@@ -121,25 +163,16 @@ class TableTest extends \PHPUnit_Framework_TestCase
         $storeId = 5;
         $options = [['label' => 'The label', 'value' => 'A value']];
 
-        $attribute = $this->getMock(
-            \Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class,
-            ['getId', 'getStoreId', 'getIsRequired', '__wakeup'],
-            [],
-            '',
-            false
-        );
-        $attribute->expects($this->once())
+        $this->abstractAttributeMock->expects($this->once())
             ->method('getId')
             ->willReturn($attributeId);
-        $attribute->expects($this->once())
+        $this->abstractAttributeMock->expects($this->once())
             ->method('getStoreId')
             ->willReturn($storeId);
-        $attribute->expects($this->any())
+        $this->abstractAttributeMock->expects($this->any())
             ->method('getIsRequired')
             ->willReturn(false);
 
-        $this->model->setAttribute($attribute);
-
         $this->collectionFactory->expects($this->once())
             ->method('create')
             ->willReturnSelf();
@@ -191,22 +224,14 @@ class TableTest extends \PHPUnit_Framework_TestCase
     {
         $attributeId = 1;
         $storeId = 5;
-        $attribute = $this->getMock(
-            \Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class,
-            ['getId', 'getStoreId', '__wakeup'],
-            [],
-            '',
-            false
-        );
-        $attribute->expects($this->once())
+
+        $this->abstractAttributeMock->expects($this->once())
             ->method('getId')
             ->willReturn($attributeId);
-        $attribute->expects($this->once())
+        $this->abstractAttributeMock->expects($this->once())
             ->method('getStoreId')
             ->willReturn($storeId);
 
-        $this->model->setAttribute($attribute);
-
         $this->collectionFactory->expects($this->once())
             ->method('create')
             ->willReturnSelf();
@@ -257,16 +282,13 @@ class TableTest extends \PHPUnit_Framework_TestCase
             ->setMethods([ 'getSelect', 'getStoreId'])
             ->disableOriginalConstructor()
             ->getMockForAbstractClass();
-        $attribute = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class)
-            ->setMethods(['getAttributeCode', 'getEntity', 'getBackend', 'getId'])
-            ->disableOriginalConstructor()
-            ->getMockForAbstractClass();
-        $attribute->expects($this->any())->method('getAttributeCode')->willReturn($attributeCode);
+
+        $this->abstractAttributeMock->expects($this->any())->method('getAttributeCode')->willReturn($attributeCode);
         $entity = $this->getMockBuilder(\Magento\Eav\Model\Entity\AbstractEntity::class)
             ->setMethods(['getLinkField'])
             ->disableOriginalConstructor()
             ->getMockForAbstractClass();
-        $attribute->expects($this->once())->method('getEntity')->willReturn($entity);
+        $this->abstractAttributeMock->expects($this->once())->method('getEntity')->willReturn($entity);
         $entity->expects($this->once())->method('getLinkField')->willReturn('entity_id');
         $select = $this->getMockBuilder(\Magento\Framework\DB\Select::class)
             ->setMethods(['joinLeft', 'getConnection', 'order'])
@@ -278,9 +300,9 @@ class TableTest extends \PHPUnit_Framework_TestCase
             ->setMethods(['getTable'])
             ->disableOriginalConstructor()
             ->getMockForAbstractClass();
-        $attribute->expects($this->any())->method('getBackend')->willReturn($backend);
+        $this->abstractAttributeMock->expects($this->any())->method('getBackend')->willReturn($backend);
         $backend->expects($this->any())->method('getTable')->willReturn('table_name');
-        $attribute->expects($this->any())->method('getId')->willReturn(1);
+        $this->abstractAttributeMock->expects($this->any())->method('getId')->willReturn(1);
         $collection->expects($this->once())->method('getStoreId')->willReturn(1);
         $connection = $this->getMockBuilder(\Magento\Framework\DB\Adapter\AdapterInterface::class)
             ->disableOriginalConstructor()
@@ -294,11 +316,99 @@ class TableTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->getMock();
         $this->attrOptionFactory->expects($this->once())->method('create')->willReturn($attrOption);
-        $attrOption->expects($this->once())->method('addOptionValueToCollection')->with($collection, $attribute, $expr)
+        $attrOption->expects($this->once())->method('addOptionValueToCollection')
+            ->with($collection, $this->abstractAttributeMock, $expr)
             ->willReturnSelf();
         $select->expects($this->once())->method('order')->with("{$attributeCode} {$dir}");
 
-        $this->model->setAttribute($attribute);
         $this->assertEquals($this->model, $this->model->addValueSortToCollection($collection, $dir));
     }
+
+    /**
+     * @param bool $withEmpty
+     * @param bool $defaultValues
+     * @param array $options
+     * @param array $optionsDefault
+     * @param array $expectedResult
+     * @dataProvider getAllOptionsDataProvider
+     */
+    public function testGetAllOptions(
+        $withEmpty,
+        $defaultValues,
+        array $options,
+        array $optionsDefault,
+        array $expectedResult
+    ) {
+        $storeId = '1';
+        $attributeId = '42';
+
+        $this->abstractAttributeMock->expects($this->once())->method('getStoreId')->willReturn(null);
+
+        $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($this->storeMock);
+        $this->storeMock->expects($this->once())->method('getId')->willReturn($storeId);
+
+        $this->abstractAttributeMock->expects($this->once())->method('getId')->willReturn($attributeId);
+
+        $this->collectionFactory->expects($this->once())
+            ->method('create')
+            ->willReturnSelf();
+        $this->collectionFactory->expects($this->once())
+            ->method('setPositionOrder')
+            ->willReturnSelf();
+        $this->collectionFactory->expects($this->once())
+            ->method('setAttributeFilter')
+            ->with($attributeId)
+            ->willReturnSelf();
+        $this->collectionFactory->expects($this->once())
+            ->method('setStoreFilter')
+            ->with($storeId)
+            ->willReturnSelf();
+        $this->collectionFactory->expects($this->once())
+            ->method('load')
+            ->willReturn($this->attributeOptionCollectionMock);
+        $this->attributeOptionCollectionMock->expects($this->any())
+            ->method('toOptionArray')
+            ->willReturnMap(
+                [
+                    ['value', $options],
+                    ['default_value', $optionsDefault]
+                ]
+            );
+
+        $this->assertEquals($expectedResult, $this->model->getAllOptions($withEmpty, $defaultValues));
+    }
+
+    /**
+     * @return array
+     */
+    public function getAllOptionsDataProvider()
+    {
+        return [
+            [
+                false,
+                false,
+                [['value' => '16', 'label' => 'black'], ['value' => '17', 'label' => 'white']],
+                [['value' => '16', 'label' => 'blck'], ['value' => '17', 'label' => 'wht']],
+                [['value' => '16', 'label' => 'black'], ['value' => '17', 'label' => 'white']]
+            ],
+            [
+                false,
+                true,
+                [['value' => '16', 'label' => 'black'], ['value' => '17', 'label' => 'white']],
+                [['value' => '16', 'label' => 'blck'], ['value' => '17', 'label' => 'wht']],
+                [['value' => '16', 'label' => 'blck'], ['value' => '17', 'label' => 'wht']]
+            ],
+            [
+                true,
+                false,
+                [['value' => '16', 'label' => 'black'], ['value' => '17', 'label' => 'white']],
+                [['value' => '16', 'label' => 'blck'], ['value' => '17', 'label' => 'wht']],
+                [
+                    ['label' => ' ', 'value' => ''],
+                    ['value' => '16', 'label' => 'black'],
+                    ['value' => '17', 'label' => 'white']
+                ]
+            ]
+        ];
+    }
 }
diff --git a/app/code/Magento/Eav/etc/di.xml b/app/code/Magento/Eav/etc/di.xml
index 0fcba9907cc4d46b76cf0b7e86c2e0e1bf61da5a..2de184b01d7c4673d49cf73f5fe0a35afa7149e2 100644
--- a/app/code/Magento/Eav/etc/di.xml
+++ b/app/code/Magento/Eav/etc/di.xml
@@ -93,9 +93,32 @@
     </virtualType>
     <type name="Magento\Eav\Model\AttributeRepository">
         <arguments>
-            <argument name="collectionProcessor" xsi:type="object">Magento\Framework\Api\SearchCriteria\CollectionProcessor</argument>
+            <argument name="collectionProcessor" xsi:type="object">Magento\Eav\Model\Api\SearchCriteria\AttributeCollectionProcessor</argument>
         </arguments>
     </type>
+    <virtualType name="Magento\Eav\Model\Api\SearchCriteria\AttributeCollectionProcessor" type="Magento\Framework\Api\SearchCriteria\CollectionProcessor">
+        <arguments>
+            <argument name="processors" xsi:type="array">
+                <item name="filters" xsi:type="object">Magento\Eav\Model\Api\SearchCriteria\CollectionProcessor\AttributeFilterProcessor</item>
+                <item name="sorting" xsi:type="object">Magento\Eav\Model\Api\SearchCriteria\CollectionProcessor\AttributeSortingProcessor</item>
+                <item name="pagination" xsi:type="object">Magento\Framework\Api\SearchCriteria\CollectionProcessor\PaginationProcessor</item>
+            </argument>
+        </arguments>
+    </virtualType>
+    <virtualType name="Magento\Eav\Model\Api\SearchCriteria\CollectionProcessor\AttributeFilterProcessor" type="Magento\Framework\Api\SearchCriteria\CollectionProcessor\FilterProcessor">
+        <arguments>
+            <argument name="fieldMapping" xsi:type="array">
+                <item name="attribute_id" xsi:type="string">main_table.attribute_id</item>
+            </argument>
+        </arguments>
+    </virtualType>
+    <virtualType name="Magento\Eav\Model\Api\SearchCriteria\CollectionProcessor\AttributeSortingProcessor" type="Magento\Framework\Api\SearchCriteria\CollectionProcessor\SortingProcessor">
+        <arguments>
+            <argument name="fieldMapping" xsi:type="array">
+                <item name="attribute_id" xsi:type="string">main_table.attribute_id</item>
+            </argument>
+        </arguments>
+    </virtualType>
     <virtualType name="Magento\Eav\Model\Api\SearchCriteria\CollectionProcessor\AttributeSetFilterProcessor" type="Magento\Framework\Api\SearchCriteria\CollectionProcessor\FilterProcessor">
         <arguments>
             <argument name="customFilters" xsi:type="array">
diff --git a/app/code/Magento/Newsletter/view/frontend/layout/customer_account.xml b/app/code/Magento/Newsletter/view/frontend/layout/customer_account.xml
index 2daee81846c0bfb211aeb453e5727d4a130cb77c..f1b8340b1b88d1d5b519da4305f44992015948b8 100644
--- a/app/code/Magento/Newsletter/view/frontend/layout/customer_account.xml
+++ b/app/code/Magento/Newsletter/view/frontend/layout/customer_account.xml
@@ -8,10 +8,11 @@
 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
     <body>
         <referenceBlock name="customer_account_navigation">
-            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-newsletter-subscriptions-link">
+            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-newsletter-subscriptions-link">
                 <arguments>
                     <argument name="path" xsi:type="string">newsletter/manage</argument>
                     <argument name="label" xsi:type="string" translate="true">Newsletter Subscriptions</argument>
+                    <argument name="sortOrder" xsi:type="number">40</argument>
                 </arguments>
             </block>
         </referenceBlock>
diff --git a/app/code/Magento/Paypal/view/frontend/layout/customer_account.xml b/app/code/Magento/Paypal/view/frontend/layout/customer_account.xml
index 5a355a2c399673ec54e1da9fed67f281c32fa1ab..27fa1511d09be68d350ad74a92146c928cff631c 100644
--- a/app/code/Magento/Paypal/view/frontend/layout/customer_account.xml
+++ b/app/code/Magento/Paypal/view/frontend/layout/customer_account.xml
@@ -11,10 +11,11 @@
     </head>
     <body>
         <referenceBlock name="customer_account_navigation">
-            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-billing-agreements-link">
+            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-billing-agreements-link">
                 <arguments>
                     <argument name="path" xsi:type="string">paypal/billing_agreement</argument>
                     <argument name="label" xsi:type="string" translate="true">Billing Agreements</argument>
+                    <argument name="sortOrder" xsi:type="number">140</argument>
                 </arguments>
             </block>
         </referenceBlock>
diff --git a/app/code/Magento/Persistent/etc/persistent.xml b/app/code/Magento/Persistent/etc/persistent.xml
index fb67e9d976af40adb4b95a5ba145a7d175995e5d..b4b87cb8e765df3e0dab3dad4a1f5b08fd414209 100644
--- a/app/code/Magento/Persistent/etc/persistent.xml
+++ b/app/code/Magento/Persistent/etc/persistent.xml
@@ -18,7 +18,7 @@
                 <name_in_layout>top.links</name_in_layout>
                 <class>Magento\Persistent\Model\Observer</class>
                 <method>emulateTopLinks</method>
-                <block_type>Magento\Theme\Block\Template\Links</block_type>
+                <block_type>Magento\Customer\Block\Account\Navigation</block_type>
             </reference>
         </blocks>
     </instances>
diff --git a/app/code/Magento/Review/view/frontend/layout/customer_account.xml b/app/code/Magento/Review/view/frontend/layout/customer_account.xml
index 9de10e43fa4d148dce5c4b316e93538a830e6d2b..5506a904ce0f76bce2a8552d517a0f31646644fb 100644
--- a/app/code/Magento/Review/view/frontend/layout/customer_account.xml
+++ b/app/code/Magento/Review/view/frontend/layout/customer_account.xml
@@ -8,10 +8,11 @@
 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
     <body>
         <referenceBlock name="customer_account_navigation">
-            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-product-reviews-link">
+            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-product-reviews-link">
                 <arguments>
                     <argument name="path" xsi:type="string">review/customer</argument>
                     <argument name="label" xsi:type="string">My Product Reviews</argument>
+                    <argument name="sortOrder" xsi:type="number">50</argument>
                 </arguments>
             </block>
         </referenceBlock>
diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php
index 5deb24a068de1d0ff8a48bb4cc7f6f916c1c6dde..a0f56d6ea9a73ea02d4c852ef6ac4831be29b574 100644
--- a/app/code/Magento/Sales/Model/Order/Payment.php
+++ b/app/code/Magento/Sales/Model/Order/Payment.php
@@ -632,42 +632,48 @@ class Payment extends Info implements OrderPaymentInterface
             $this->transactionManager->generateTransactionId($this, Transaction::TYPE_REFUND)
         );
 
-        // call refund from gateway if required
         $isOnline = false;
         $gateway = $this->getMethodInstance();
         $invoice = null;
-        if ($gateway->canRefund() && $creditmemo->getDoTransaction()) {
+        if ($gateway->canRefund()) {
             $this->setCreditmemo($creditmemo);
-            $invoice = $creditmemo->getInvoice();
-            if ($invoice) {
-                $isOnline = true;
-                $captureTxn = $this->transactionRepository->getByTransactionId(
-                    $invoice->getTransactionId(),
-                    $this->getId(),
-                    $this->getOrder()->getId()
-                );
-                if ($captureTxn) {
-                    $this->setTransactionIdsForRefund($captureTxn);
-                }
-                $this->setShouldCloseParentTransaction(true);
-                // TODO: implement multiple refunds per capture
-                try {
-                    $gateway->setStore(
-                        $this->getOrder()->getStoreId()
+            if ($creditmemo->getDoTransaction()) {
+                $invoice = $creditmemo->getInvoice();
+                if ($invoice) {
+                    $isOnline = true;
+                    $captureTxn = $this->transactionRepository->getByTransactionId(
+                        $invoice->getTransactionId(),
+                        $this->getId(),
+                        $this->getOrder()->getId()
                     );
-                    $this->setRefundTransactionId($invoice->getTransactionId());
-                    $gateway->refund($this, $baseAmountToRefund);
-
-                    $creditmemo->setTransactionId($this->getLastTransId());
-                } catch (\Magento\Framework\Exception\LocalizedException $e) {
-                    if (!$captureTxn) {
-                        throw new \Magento\Framework\Exception\LocalizedException(
-                            __('If the invoice was created offline, try creating an offline credit memo.'),
-                            $e
+                    if ($captureTxn) {
+                        $this->setTransactionIdsForRefund($captureTxn);
+                    }
+                    $this->setShouldCloseParentTransaction(true);
+                    // TODO: implement multiple refunds per capture
+                    try {
+                        $gateway->setStore(
+                            $this->getOrder()->getStoreId()
                         );
+                        $this->setRefundTransactionId($invoice->getTransactionId());
+                        $gateway->refund($this, $baseAmountToRefund);
+
+                        $creditmemo->setTransactionId($this->getLastTransId());
+                    } catch (\Magento\Framework\Exception\LocalizedException $e) {
+                        if (!$captureTxn) {
+                            throw new \Magento\Framework\Exception\LocalizedException(
+                                __('If the invoice was created offline, try creating an offline credit memo.'),
+                                $e
+                            );
+                        }
+                        throw $e;
                     }
-                    throw $e;
                 }
+            } else if ($gateway->isOffline()) {
+                $gateway->setStore(
+                    $this->getOrder()->getStoreId()
+                );
+                $gateway->refund($this, $baseAmountToRefund);
             }
         }
 
diff --git a/app/code/Magento/Sales/Setup/UpgradeSchema.php b/app/code/Magento/Sales/Setup/UpgradeSchema.php
index b977cb28596eae3ff2e9c5ea0836ba716c54831e..d35825242fb291a41961eb882ad93f7d24c58ee9 100644
--- a/app/code/Magento/Sales/Setup/UpgradeSchema.php
+++ b/app/code/Magento/Sales/Setup/UpgradeSchema.php
@@ -69,6 +69,20 @@ class UpgradeSchema implements UpgradeSchemaInterface
             $this->addColumnBaseGrandTotal($installer);
             $this->addIndexBaseGrandTotal($installer);
         }
+        if (version_compare($context->getVersion(), '2.0.4', '<')) {
+            $tables = [
+                'sales_invoice_grid',
+                'sales_order',
+                'sales_shipment_grid',
+            ];
+            foreach ($tables as $table) {
+                $setup->getConnection()->modifyColumn(
+                    $setup->getTable($table),
+                    'customer_group_id',
+                    ['type' => 'integer']
+                );
+            }
+        }
     }
 
     /**
diff --git a/app/code/Magento/Sales/etc/module.xml b/app/code/Magento/Sales/etc/module.xml
index 88d6e25d31fb6c4ed9777595296e969028b154f2..980395e965e0899695206b7094b72f7f5b396ece 100644
--- a/app/code/Magento/Sales/etc/module.xml
+++ b/app/code/Magento/Sales/etc/module.xml
@@ -6,7 +6,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
-    <module name="Magento_Sales" setup_version="2.0.3">
+    <module name="Magento_Sales" setup_version="2.0.4">
         <sequence>
             <module name="Magento_Rule"/>
             <module name="Magento_Catalog"/>
diff --git a/app/code/Magento/Sales/view/frontend/layout/customer_account.xml b/app/code/Magento/Sales/view/frontend/layout/customer_account.xml
index a3933b8b221109b895f79646f6e0a9d36dc90905..239a38c09f5058c4f30fa86eb9bd0858517ad8b9 100644
--- a/app/code/Magento/Sales/view/frontend/layout/customer_account.xml
+++ b/app/code/Magento/Sales/view/frontend/layout/customer_account.xml
@@ -8,10 +8,11 @@
 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
     <body>
         <referenceBlock name="customer_account_navigation">
-            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-orders-link">
+            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-orders-link">
                 <arguments>
                     <argument name="path" xsi:type="string">sales/order/history</argument>
                     <argument name="label" xsi:type="string" translate="true">My Orders</argument>
+                    <argument name="sortOrder" xsi:type="number">230</argument>
                 </arguments>
             </block>
         </referenceBlock>
diff --git a/app/code/Magento/SalesRule/Setup/InstallSchema.php b/app/code/Magento/SalesRule/Setup/InstallSchema.php
index 577d243cd6e1c0848f78328d26dfbf979216791c..9adf43fc19cce981bb9915bfe614a242cbce013d 100644
--- a/app/code/Magento/SalesRule/Setup/InstallSchema.php
+++ b/app/code/Magento/SalesRule/Setup/InstallSchema.php
@@ -23,7 +23,9 @@ class InstallSchema implements InstallSchemaInterface
     {
         $installer = $setup;
         $installer->startSetup();
-
+        $customerGroupTable = $setup->getConnection()->describeTable($setup->getTable('customer_group'));
+        $customerGroupIdType = $customerGroupTable['customer_group_id']['DATA_TYPE'] == 'int'
+            ? \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER : $customerGroupTable['customer_group_id']['DATA_TYPE'];
         /**
          * Create table 'salesrule'
          */
@@ -441,7 +443,7 @@ class InstallSchema implements InstallSchemaInterface
             'Website Id'
         )->addColumn(
             'customer_group_id',
-            \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+            $customerGroupIdType,
             null,
             ['unsigned' => true, 'nullable' => false, 'primary' => true],
             'Customer Group Id'
@@ -757,7 +759,7 @@ class InstallSchema implements InstallSchemaInterface
             'Rule Id'
         )->addColumn(
             'customer_group_id',
-            \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+            $customerGroupIdType,
             null,
             ['unsigned' => true, 'nullable' => false, 'primary' => true],
             'Customer Group Id'
diff --git a/app/code/Magento/Theme/view/frontend/layout/default.xml b/app/code/Magento/Theme/view/frontend/layout/default.xml
index a2e89afcce1ee0461921678bb1c5888c7dd3151f..0f020db7501ae725b25f0bd8bfda51ae5c74be1c 100644
--- a/app/code/Magento/Theme/view/frontend/layout/default.xml
+++ b/app/code/Magento/Theme/view/frontend/layout/default.xml
@@ -40,7 +40,7 @@
                         </arguments>
                     </block>
                     <block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="switch/languages.phtml"/>
-                    <block class="Magento\Framework\View\Element\Html\Links" name="top.links">
+                    <block class="Magento\Customer\Block\Account\Navigation" name="top.links">
                         <arguments>
                             <argument name="css_class" xsi:type="string">header links</argument>
                         </arguments>
diff --git a/app/code/Magento/Vault/view/frontend/layout/customer_account.xml b/app/code/Magento/Vault/view/frontend/layout/customer_account.xml
index 2042721d9d387ed0354f8163738a83e1f94d1710..01edaa1f093478d0eb0eb03f42bf98815851e16b 100644
--- a/app/code/Magento/Vault/view/frontend/layout/customer_account.xml
+++ b/app/code/Magento/Vault/view/frontend/layout/customer_account.xml
@@ -8,10 +8,11 @@
 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
     <body>
         <referenceBlock name="customer_account_navigation">
-            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-my-credit-cards-link">
+            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-my-credit-cards-link">
                 <arguments>
                     <argument name="path" xsi:type="string">vault/cards/listaction</argument>
                     <argument name="label" xsi:type="string" translate="true">Stored Payment Methods</argument>
+                    <argument name="sortOrder" xsi:type="number">160</argument>
                 </arguments>
             </block>
         </referenceBlock>
diff --git a/app/code/Magento/Wishlist/Block/Link.php b/app/code/Magento/Wishlist/Block/Link.php
index fea2ad5941c5893ceaff7dac1e69bf9c9d133db2..51e59998339d8b809182851b940f4e156c61c0e9 100644
--- a/app/code/Magento/Wishlist/Block/Link.php
+++ b/app/code/Magento/Wishlist/Block/Link.php
@@ -9,12 +9,14 @@
  */
 namespace Magento\Wishlist\Block;
 
+use Magento\Customer\Block\Account\SortLinkInterface;
+
 /**
  * Class Link
  *
  * @SuppressWarnings(PHPMD.DepthOfInheritance)
  */
-class Link extends \Magento\Framework\View\Element\Html\Link
+class Link extends \Magento\Framework\View\Element\Html\Link implements SortLinkInterface
 {
     /**
      * Template name
@@ -68,4 +70,12 @@ class Link extends \Magento\Framework\View\Element\Html\Link
     {
         return __('My Wish List');
     }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getSortOrder()
+    {
+        return $this->getData(self::SORT_ORDER);
+    }
 }
diff --git a/app/code/Magento/Wishlist/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Wishlist/view/frontend/layout/catalog_product_view.xml
index 4c01d341bb68294cae5d48f5ab2dd99d8d5b08d8..a25546b1afc902a563c296a7adc24b1a9787729b 100644
--- a/app/code/Magento/Wishlist/view/frontend/layout/catalog_product_view.xml
+++ b/app/code/Magento/Wishlist/view/frontend/layout/catalog_product_view.xml
@@ -16,7 +16,7 @@
                 </arguments>
             </block>
             <referenceBlock name="product.info.addto">
-                <block class="Magento\Wishlist\Block\Catalog\Product\View\AddTo\Wishlist" name="view.addto.wishlist" after="view.addto.requisition"
+                <block class="Magento\Wishlist\Block\Catalog\Product\View\AddTo\Wishlist" name="view.addto.wishlist"
                        template="Magento_Wishlist::catalog/product/view/addto/wishlist.phtml" />
             </referenceBlock>
         </referenceContainer>
diff --git a/app/code/Magento/Wishlist/view/frontend/layout/customer_account.xml b/app/code/Magento/Wishlist/view/frontend/layout/customer_account.xml
index c1dc653efbe7e2f8877a926073f55744a744a624..9083fcdc8d13280dbb16fb917bc24a2bc577ad2d 100644
--- a/app/code/Magento/Wishlist/view/frontend/layout/customer_account.xml
+++ b/app/code/Magento/Wishlist/view/frontend/layout/customer_account.xml
@@ -8,10 +8,11 @@
 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
     <body>
         <referenceBlock name="customer_account_navigation">
-            <block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="wishlist/general/active" name="customer-account-navigation-wish-list-link">
+            <block class="Magento\Customer\Block\Account\SortLinkInterface" ifconfig="wishlist/general/active" name="customer-account-navigation-wish-list-link">
                 <arguments>
                     <argument name="path" xsi:type="string">wishlist</argument>
                     <argument name="label" xsi:type="string">My Wish List</argument>
+                    <argument name="sortOrder" xsi:type="number">210</argument>
                 </arguments>
             </block>
         </referenceBlock>
diff --git a/app/code/Magento/Wishlist/view/frontend/layout/default.xml b/app/code/Magento/Wishlist/view/frontend/layout/default.xml
index a0fc577547c5ac8ea91bc0b9699edcc6a2d499b3..dffa4ec79d64d3183e732aa043ccefc39fa1062f 100644
--- a/app/code/Magento/Wishlist/view/frontend/layout/default.xml
+++ b/app/code/Magento/Wishlist/view/frontend/layout/default.xml
@@ -11,7 +11,11 @@
             <block class="Magento\Framework\View\Element\Js\Components" name="wishlist_page_head_components" template="Magento_Wishlist::js/components.phtml"/>
         </referenceBlock>
         <referenceBlock name="top.links">
-            <block class="Magento\Wishlist\Block\Link" name="wish-list-link" after="my-account-link"/>
+            <block class="Magento\Wishlist\Block\Link" name="wish-list-link" after="my-account-link">
+                <arguments>
+                    <argument name="sortOrder" xsi:type="number">60</argument>
+                </arguments>
+            </block>
         </referenceBlock>
         <referenceContainer name="sidebar.additional">
             <block class="Magento\Wishlist\Block\Customer\Sidebar" name="wishlist_sidebar" as="wishlist" template="Magento_Wishlist::sidebar.phtml"/>
diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure.xml
index 50ba68940fc9d4027b359fe72ec86b305fb0f69a..02b737b7d5127320207669379ea7e3b09ddb5ac1 100644
--- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure.xml
+++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure.xml
@@ -9,7 +9,7 @@
     <update handle="catalog_product_view"/>
     <body>
         <referenceBlock name="product.info.addto">
-            <block class="Magento\Wishlist\Block\Item\Configure" name="view.addto.wishlist" after="view.addto.requisition"
+            <block class="Magento\Wishlist\Block\Item\Configure" name="view.addto.wishlist"
                 template="item/configure/addto/wishlist.phtml" />
         </referenceBlock>
     </body>
diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_bundle.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_bundle.xml
index b08816a6728eb54b79ec806084f4a4e684702a29..84d0429a29c99ba204ec9d4401b69d2bf68e1abf 100644
--- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_bundle.xml
+++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_bundle.xml
@@ -20,7 +20,7 @@
                 <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart.bundle" as="addtocart" template="product/view/addtocart.phtml" />
                 <block class="Magento\Catalog\Block\Product\View" name="product.info.addto.bundle" as="addto" after="product.info.addtocart.bundle"
                        template="Magento_Catalog::product/view/addto.phtml" cacheable="false">
-                    <block class="Magento\Wishlist\Block\Item\Configure" name="view.addto.wishlist.bundle" after="view.addto.requisition"
+                    <block class="Magento\Wishlist\Block\Item\Configure" name="view.addto.wishlist.bundle"
                            template="item/configure/addto/wishlist.phtml" />
                     <block class="Magento\Catalog\Block\Product\View\AddTo\Compare" name="view.addto.compare.bundle" after="view.addto.wishlist"
                            template="Magento_Catalog::product/view/addto/compare.phtml" />
diff --git a/app/design/frontend/Magento/blank/Magento_Customer/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Customer/web/css/source/_module.less
index 369e100506c4d76dd10347a6ee5ee772d605091f..2d54baf8f8e9f74bd3d764133bcc5a58e30ea2e0 100644
--- a/app/design/frontend/Magento/blank/Magento_Customer/web/css/source/_module.less
+++ b/app/design/frontend/Magento/blank/Magento_Customer/web/css/source/_module.less
@@ -15,6 +15,8 @@
 @account-nav-current-color: false;
 @account-nav-current-font-weight: @font-weight__semibold;
 
+@account-nav-delimiter__border-color: @color-gray82;
+
 @account-nav-item-hover: @color-gray91;
 
 @_password-default: @color-gray-light01;
@@ -219,6 +221,12 @@
                     .lib-css(border-color, @account-nav-current-border-color);
                 }
             }
+
+            .delimiter {
+                border-top: 1px solid @account-nav-delimiter__border-color;
+                display: block;
+                margin: @indent__s 1.8rem;
+            }
         }
     }
 
diff --git a/app/design/frontend/Magento/luma/Magento_Customer/layout/customer_account.xml b/app/design/frontend/Magento/luma/Magento_Customer/layout/customer_account.xml
index 5d02aec14bedc148d2cade4f47b87e496da23b9f..be8aa1200f21b0a861c088666f62828e052a1f7c 100644
--- a/app/design/frontend/Magento/luma/Magento_Customer/layout/customer_account.xml
+++ b/app/design/frontend/Magento/luma/Magento_Customer/layout/customer_account.xml
@@ -13,26 +13,41 @@
                     <argument name="block_title" translate="true" xsi:type="string">Account Dashboard</argument>
                     <argument name="block_css" xsi:type="string">block-collapsible-nav</argument>
                 </arguments>
-                <block class="Magento\Framework\View\Element\Html\Links" name="customer_account_navigation" before="-">
+                <block class="Magento\Customer\Block\Account\Navigation" name="customer_account_navigation" before="-">
                     <arguments>
                         <argument name="css_class" xsi:type="string">nav items</argument>
                     </arguments>
-                    <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-account-link">
+                    <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-account-link">
                         <arguments>
                             <argument name="label" xsi:type="string" translate="true">Account Dashboard</argument>
                             <argument name="path" xsi:type="string">customer/account</argument>
+                            <argument name="sortOrder" xsi:type="number">250</argument>
                         </arguments>
                     </block>
-                    <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-account-edit-link">
+                    <block class="Magento\Customer\Block\Account\Delimiter" name="customer-account-navigation-delimiter-1"
+                           template="Magento_Customer::account/navigation-delimiter.phtml">
                         <arguments>
-                            <argument name="label" xsi:type="string" translate="true">Account Information</argument>
-                            <argument name="path" xsi:type="string">customer/account/edit</argument>
+                            <argument name="sortOrder" xsi:type="number">200</argument>
                         </arguments>
                     </block>
-                    <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-address-link">
+                    <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-address-link">
                         <arguments>
                             <argument name="label" xsi:type="string" translate="true">Address Book</argument>
                             <argument name="path" xsi:type="string">customer/address</argument>
+                            <argument name="sortOrder" xsi:type="number">190</argument>
+                        </arguments>
+                    </block>
+                    <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-account-edit-link">
+                        <arguments>
+                            <argument name="label" xsi:type="string" translate="true">Account Information</argument>
+                            <argument name="path" xsi:type="string">customer/account/edit</argument>
+                            <argument name="sortOrder" xsi:type="number">180</argument>
+                        </arguments>
+                    </block>
+                    <block class="Magento\Customer\Block\Account\Delimiter" name="customer-account-navigation-delimiter-2"
+                           template="Magento_Customer::account/navigation-delimiter.phtml">
+                        <arguments>
+                            <argument name="sortOrder" xsi:type="number">130</argument>
                         </arguments>
                     </block>
                 </block>
diff --git a/app/design/frontend/Magento/luma/Magento_Customer/layout/default.xml b/app/design/frontend/Magento/luma/Magento_Customer/layout/default.xml
index bd1fd91d6d338bd743ae49db05440c38f22e94a9..2592f9def7fa42f0d8e69cf0458d568651843f26 100644
--- a/app/design/frontend/Magento/luma/Magento_Customer/layout/default.xml
+++ b/app/design/frontend/Magento/luma/Magento_Customer/layout/default.xml
@@ -9,7 +9,11 @@
     <body>
         <referenceBlock name="header.links">
             <block class="Magento\Customer\Block\Account\Customer" name="customer" template="account/customer.phtml" before="-"/>
-            <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link-login" template="account/link/authorization.phtml"/>
+            <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link-login" template="account/link/authorization.phtml">
+                <arguments>
+                    <argument name="sortOrder" xsi:type="number">10</argument>
+                </arguments>
+            </block>
         </referenceBlock>
         <block class="Magento\Theme\Block\Html\Header" name="header" as="header">
             <arguments>
diff --git a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/module/_collapsible_navigation.less b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/module/_collapsible_navigation.less
index 95c7ec15ebb33a90e81b03ab553c636f39033fb1..33c0dacb8d99d8e3bb031114a43fd10dc3e767b1 100644
--- a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/module/_collapsible_navigation.less
+++ b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/module/_collapsible_navigation.less
@@ -13,6 +13,7 @@
 @collapsible-nav-current-border-color: @color-orange-red1;
 @collapsible-nav-current-color: @color-black;
 @collapsible-nav-current-font-weight: @font-weight__semibold;
+@collapsible-nav-delimiter__border-color: @color-gray82;
 @collapsible-nav-item-hover: @color-gray91;
 
 //
@@ -64,6 +65,12 @@
                     .lib-css(border-color, @collapsible-nav-current-border-color);
                 }
             }
+
+            .delimiter {
+                border-top: 1px solid @collapsible-nav-delimiter__border-color;
+                display: block;
+                margin: @indent__s 1.8rem;
+            }
         }
     }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php
index d29bad980faca881468ae1cf3a58523e13f7ad83..f2530c016b714bf5af16c2b6d0f0f6d690cc4af0 100644
--- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php
+++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php
@@ -6,13 +6,60 @@
 
 namespace Magento\Checkout\Test\Block\Onepage;
 
+use Magento\Checkout\Test\Block\Onepage\Shipping\AddressModal;
 use Magento\Mtf\Block\Form;
+use Magento\Mtf\Client\Locator;
 
 /**
  * Checkout shipping address block.
  */
 class Shipping extends Form
 {
+    /**
+     * CSS Selector for "New Address" button
+     *
+     * @var string
+     */
+    private $newAddressButton = '[data-bind*="isNewAddressAdded"]';
+
+    /**
+     * Wait element.
+     *
+     * @var string
+     */
+    private $waitElement = '.loading-mask';
+
+    /**
+     * SCC Selector for Address Modal block.
+     *
+     * @var string
+     */
+    private $addressModalBlock = '//*[@id="opc-new-shipping-address"]/../..';
+
+    /**
+     * Click on "New Address" button.
+     *
+     * @return void
+     */
+    public function clickOnNewAddressButton()
+    {
+        $this->waitForElementNotVisible($this->waitElement);
+        $this->_rootElement->find($this->newAddressButton)->click();
+    }
+
+    /**
+     * Get Address Modal Block.
+     *
+     * @return AddressModal
+     */
+    public function getAddressModalBlock()
+    {
+        return $this->blockFactory->create(
+            AddressModal::class,
+            ['element' => $this->browser->find($this->addressModalBlock, Locator::SELECTOR_XPATH)]
+        );
+    }
+
     /**
      * Returns form's required elements
      *
diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/AddressModal.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/AddressModal.php
new file mode 100644
index 0000000000000000000000000000000000000000..8a949c474bc847942f1bd5922d00514cd6133d08
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/AddressModal.php
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Checkout\Test\Block\Onepage\Shipping;
+
+use Magento\Mtf\Block\Form;
+
+/**
+ * Checkout shipping address modal block.
+ */
+class AddressModal extends Form
+{
+    /**
+     * CSS Selector for Save button.
+     *
+     * @var string
+     */
+    private $saveButton = '.action-save-address';
+
+    /**
+     * Selector for field's error message.
+     *
+     * @var string
+     */
+    private $errorMessage = '.field-error';
+
+    /**
+     * Selector for error fields.
+     *
+     * @var string
+     */
+    private $errorField = '._error';
+
+    /**
+     * Selector for field label that have error message.
+     *
+     * @var string
+     */
+    private $fieldLabel = '.label';
+
+    /**
+     * Click on 'Save Address' button.
+     *
+     * @return void
+     */
+    public function save()
+    {
+        $this->_rootElement->find($this->saveButton)->click();
+    }
+
+    /**
+     * Get Error messages for attributes.
+     *
+     * @return array
+     */
+    public function getErrorMessages()
+    {
+        $result = [];
+        foreach ($this->_rootElement->getElements($this->errorField) as $item) {
+            $result[$item->find($this->fieldLabel)->getText()] = $item->find($this->errorMessage)->getText();
+        }
+
+        return $result;
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/AddressModal.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/AddressModal.xml
new file mode 100644
index 0000000000000000000000000000000000000000..13403b792684512c9741bca74a78f7c84036eb48
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/AddressModal.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" ?>
+<!--
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+-->
+<mapping strict="0">
+    <fields>
+        <firstname />
+        <lastname />
+        <company />
+        <street>
+            <selector>input[name="street[0]"]</selector>
+        </street>
+        <city />
+        <region_id>
+            <input>select</input>
+        </region_id>
+        <country_id>
+            <input>select</input>
+        </country_id>
+        <telephone />
+        <postcode />
+    </fields>
+</mapping>
diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/AddNewShippingAddressStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/AddNewShippingAddressStep.php
new file mode 100644
index 0000000000000000000000000000000000000000..a4ae00510a9de0b2e9e7d82ff3285e0ae780a7cc
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/AddNewShippingAddressStep.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Checkout\Test\TestStep;
+
+use Magento\Checkout\Test\Page\CheckoutOnepage;
+use Magento\Customer\Test\Fixture\Address;
+use Magento\Mtf\TestStep\TestStepInterface;
+
+/**
+ * Create customer custom attribute step.
+ */
+class AddNewShippingAddressStep implements TestStepInterface
+{
+    /**
+     * Checkout One page.
+     *
+     * @var CheckoutOnepage
+     */
+    private $checkoutOnepage;
+
+    /**
+     * Shipping Address fixture.
+     *
+     * @var Address
+     */
+    private $address;
+
+    /**
+     * @constructor
+     * @param CheckoutOnepage $checkoutOnepage
+     * @param Address|null $address [optional]
+     */
+    public function __construct(CheckoutOnepage $checkoutOnepage, Address $address = null)
+    {
+        $this->checkoutOnepage = $checkoutOnepage;
+        $this->address = $address;
+    }
+
+    /**
+     * Create customer account.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        $shippingBlock = $this->checkoutOnepage->getShippingBlock();
+        $shippingBlock->clickOnNewAddressButton();
+        if ($this->address) {
+            $shippingBlock->getAddressModalBlock()->fill($this->address);
+        }
+        $shippingBlock->getAddressModalBlock()->save();
+    }
+}
diff --git a/dev/tests/js/jasmine/spec_runner/index.js b/dev/tests/js/jasmine/spec_runner/index.js
index ce57b6c354cb98a4ab48e6043fc8648d8f9f040b..d8329bb35178fefc23ca9d68fc4047a432e98a31 100644
--- a/dev/tests/js/jasmine/spec_runner/index.js
+++ b/dev/tests/js/jasmine/spec_runner/index.js
@@ -13,38 +13,14 @@ function init(grunt, options) {
         stripJsonComments   = require('strip-json-comments'),
         path                = require('path'),
         config,
-        themes;
-        
+        themes,
+        file;
+
     config = grunt.file.read(__dirname + '/settings.json');
     config = stripJsonComments(config);
     config = JSON.parse(config);
 
-    //themes = require(path.resolve(process.cwd(), config.themes));
-    //TODO: MAGETWO-39843
-    themes = {
-        blank: {
-            area: 'frontend',
-            name: 'Magento/blank',
-            locale: 'en_US',
-            files: [
-                'css/styles-m',
-                'css/styles-l',
-                'css/email',
-                'css/email-inline'
-            ],
-            dsl: 'less'
-        },
-        backend: {
-            area: 'adminhtml',
-            name: 'Magento/backend',
-            locale: 'en_US',
-            files: [
-                'css/styles-old',
-                'css/styles'
-            ],
-            dsl: 'less'
-        }
-    }
+    themes = require(path.resolve(process.cwd(), config.themes));
 
     if (options.theme) {
         themes = _.pick(themes, options.theme);
@@ -54,6 +30,12 @@ function init(grunt, options) {
 
     config.themes = themes;
 
+    file = grunt.option('file');
+
+    if (file) {
+        config.singleTest = file;
+    }
+
     enableTasks(grunt, config);
 }
 
diff --git a/dev/tests/js/jasmine/spec_runner/tasks/jasmine.js b/dev/tests/js/jasmine/spec_runner/tasks/jasmine.js
index ccd21fafe33b9220f3203bf4fa0697ad2abc2d2f..99f05198000ec2d3b400c4f8269435e40a7d3fe7 100644
--- a/dev/tests/js/jasmine/spec_runner/tasks/jasmine.js
+++ b/dev/tests/js/jasmine/spec_runner/tasks/jasmine.js
@@ -16,7 +16,6 @@ function init(config) {
     root         = config.root;
     port         = config.port;
     files        = config.files;
-    host         = _.template(config.host)({ port: port });
     themes       = config.themes;
 
     _.each(themes, function (themeData, themeName) {
@@ -26,7 +25,13 @@ function init(config) {
 
         _.extend(themeData, { root: root });
 
+        host    = _.template(config.host)({ port: port++ });
         render  = renderTemplate.bind(null, themeData);
+
+        if (config.singleTest) {
+            files.specs = [config.singleTest];
+        }
+
         specs   = files.specs.map(render);
         specs   = expand(specs).map(cutJsExtension);
         configs = files.requirejsConfigs.map(render);