From b1cebfa0bb34cbe3f41882808266bc2945cfd8e5 Mon Sep 17 00:00:00 2001
From: mage2-team <mage2-team@magento.com>
Date: Fri, 28 Feb 2014 13:11:05 -0800
Subject: [PATCH] 2.0.0.0-dev67 * GitHub requests:   *
 [#235](https://github.com/magento/magento2/issues/235) -- Translation
 escaping   * [#463](https://github.com/magento/magento2/pull/463) -- allow
 _resolveArguments to do sequential lookups * Fixed bugs:   * Fixed an issue
 where nonexistent store views flat tables cleanuper dropped the
 catalog_category_flat_cl table   * Fixed an issue where the Product Flat Data
 indexer used the helpers logic instead of the Flat State logic   * Fixed an
 issue where an exception was thrown when applying a coupon code   * Fixed an
 issue where a Shopping Cart Price Rule was applied to the wrong products   *
 Fixed an issue with the broken Related Orders link on the Recurring Profile
 page   * Fixed an issue with CMS pages preview not working   * Fixed an issue
 with a sales report for a store view returning wrong result   * Fixed an
 issue where shipping did not work for orders containing only bundle products 
  * Fixed an issue where a custom not found page action did not work   * Fixed
 an issue where user configuration for a shopping cart rule to stop further
 rules processing was ignored * Modularity improvements:   * Resolved
 dependencies of the Sales module on the RecurringProfile module   * Resolved
 dependencies of the Email Templates functionality on application modules   *
 Lib-only dependent components of the Core module moved to library   * CSS URL
 resolving logic moved from the publisher to a separate CSS pre-processor   *
 Refactored the View publisher * Customer Service usage:   * Refactored the
 Sales module to use Customer service layer   * Refactored the Checkout module
 to use Customer service layer * Updated various PHPDoc with the parameter and
 return types

---
 CHANGELOG.md                                  |  40 +-
 .../Model/Config/Source/Frequency.php         |   2 +-
 .../Magento/AdminNotification/Model/Feed.php  |   8 +-
 .../Authorizenet/Block/Directpost/Iframe.php  |   6 +-
 .../Authorizenet/Directpost/Payment.php       |   6 +-
 .../Controller/Directpost/Payment.php         |   6 +-
 .../Authorizenet/Model/Authorizenet.php       |   6 +-
 .../Authorizenet/Source/PaymentAction.php     |   2 +-
 .../Magento/Authorizenet/Model/Directpost.php |   4 +-
 .../Model/Directpost/Observer.php             |   8 +-
 app/code/Magento/Authorizenet/i18n/de_DE.csv  |   2 +-
 app/code/Magento/Authorizenet/i18n/en_US.csv  |   2 +-
 app/code/Magento/Authorizenet/i18n/es_ES.csv  |   2 +-
 app/code/Magento/Authorizenet/i18n/fr_FR.csv  |   2 +-
 app/code/Magento/Authorizenet/i18n/nl_NL.csv  |   2 +-
 app/code/Magento/Authorizenet/i18n/pt_BR.csv  |   2 +-
 app/code/Magento/Authorizenet/i18n/zh_CN.csv  |   2 +-
 .../Magento/Authz/Service/AuthorizationV1.php |   2 +-
 app/code/Magento/Authz/etc/module.xml         |   1 -
 .../Backend/App/Router/DefaultRouter.php      |   9 +-
 .../Block/System/Account/Edit/Form.php        |   4 +-
 .../Backend/Block/System/Cache/Form.php       |   4 +-
 .../Backend/Block/System/Config/Form.php      |   4 +-
 .../Backend/Block/System/Design/Edit.php      |   6 +-
 .../Block/System/Design/Edit/Tab/General.php  |   4 +-
 .../Backend/Block/System/Store/Edit.php       |   6 +-
 .../Block/System/Store/Edit/Form/Group.php    |   4 +-
 .../Block/System/Store/Edit/Form/Store.php    |   4 +-
 .../Block/System/Store/Edit/Form/Website.php  |   4 +-
 .../Backend/Block/System/Variable/Edit.php    |   6 +-
 app/code/Magento/Backend/Block/Template.php   |  12 +-
 .../Backend/Block/Template/Context.php        |  20 +-
 .../Urlrewrite/Catalog/Category/Tree.php      |   4 +-
 .../Block/Urlrewrite/Catalog/Edit/Form.php    |   4 +-
 .../Block/Urlrewrite/Cms/Page/Edit/Form.php   |   4 +-
 .../Backend/Block/Urlrewrite/Edit/Form.php    |   4 +-
 .../Backend/Block/Widget/Form/Container.php   |   2 +-
 .../Backend/Block/Widget/Form/Generic.php     |   6 +-
 .../Widget/Grid/Massaction/Additional.php     |   4 +-
 .../Controller/Adminhtml/System/Design.php    |   6 +-
 .../Controller/Adminhtml/System/Store.php     |   6 +-
 .../Controller/Adminhtml/System/Variable.php  |   6 +-
 .../Model/Config/Backend/Admin/Custom.php     |   8 +-
 .../Model/Config/Backend/Admin/Observer.php   |   6 +-
 .../Model/Config/Backend/Admin/Robots.php     |   8 +-
 .../Model/Config/Backend/Admin/Usecustom.php  |   8 +-
 .../Config/Backend/Admin/Usesecretkey.php     |   8 +-
 .../Backend/Model/Config/Backend/Baseurl.php  |   8 +-
 .../Backend/Currency/AbstractCurrency.php     |   8 +-
 .../Model/Config/Backend/Currency/Allow.php   |   8 +-
 .../Model/Config/Backend/Currency/Cron.php    |   8 +-
 .../Model/Config/Backend/Encrypted.php        |   8 +-
 .../Backend/Model/Config/Backend/File.php     |   8 +-
 .../Model/Config/Backend/Image/Adapter.php    |   8 +-
 .../Backend/Model/Config/Backend/Locale.php   |   8 +-
 .../Backend/Model/Config/Backend/Log/Cron.php |   8 +-
 .../Backend/Model/Config/Backend/Secure.php   |   8 +-
 .../Config/Backend/Storage/Media/Database.php |   8 +-
 .../Model/Config/Backend/Translate.php        |   8 +-
 .../Model/Config/Source/Admin/Page.php        |   2 +-
 .../Backend/Model/Config/Source/Checktype.php |   2 +-
 .../Backend/Model/Config/Source/Currency.php  |   2 +-
 .../Model/Config/Source/Date/Short.php        |   2 +-
 .../Model/Config/Source/Design/Robots.php     |   2 +-
 .../Model/Config/Source/Dev/Dbautoup.php      |   2 +-
 .../Model/Config/Source/Email/Identity.php    |   2 +-
 .../Model/Config/Source/Email/Method.php      |   2 +-
 .../Model/Config/Source/Email/Smtpauth.php    |   2 +-
 .../Model/Config/Source/Email/Template.php    |   8 +-
 .../Model/Config/Source/Enabledisable.php     |   2 +-
 .../Model/Config/Source/Image/Adapter.php     |   2 +-
 .../Backend/Model/Config/Source/Locale.php    |   4 +-
 .../Model/Config/Source/Locale/Country.php    |   4 +-
 .../Model/Config/Source/Locale/Currency.php   |   4 +-
 .../Config/Source/Locale/Currency/All.php     |   2 +-
 .../Model/Config/Source/Locale/Timezone.php   |   4 +-
 .../Config/Source/Locale/Weekdaycodes.php     |   2 +-
 .../Model/Config/Source/Locale/Weekdays.php   |   2 +-
 .../Backend/Model/Config/Source/Nooptreq.php  |   2 +-
 .../Model/Config/Source/Reports/Scope.php     |   2 +-
 .../Config/Source/Storage/Media/Database.php  |   2 +-
 .../Config/Source/Storage/Media/Storage.php   |   2 +-
 .../Backend/Model/Config/Source/Store.php     |   2 +-
 .../Model/Config/Source/Web/Protocol.php      |   2 +-
 .../Model/Config/Source/Web/Redirect.php      |   2 +-
 .../Backend/Model/Config/Source/Website.php   |   2 +-
 .../Config/Source/Website/OptionHash.php      |   2 +-
 .../Backend/Model/Config/Source/Yesno.php     |   2 +-
 .../Model/Config/Source/Yesnocustom.php       |   2 +-
 .../Backend/Model/Menu/Filter/Iterator.php    |  10 +
 app/code/Magento/Backend/etc/di.xml           |   4 +-
 .../Backup/Controller/Adminhtml/Index.php     |   6 +-
 .../Backup/Model/Config/Backend/Cron.php      |   8 +-
 .../Backup/Model/Config/Source/Type.php       |   2 +-
 .../Magento/Backup/Model/Grid/Options.php     |   2 +-
 app/code/Magento/Backup/Model/Observer.php    |   6 +-
 .../Product/Edit/Tab/Attributes/Extend.php    |   6 +-
 .../Catalog/Product/Edit/Tab/Bundle.php       |   6 +-
 .../Product/Edit/Tab/Bundle/Option.php        |   6 +-
 .../Edit/Tab/Bundle/Option/Selection.php      |   6 +-
 .../Bundle/Block/Catalog/Product/Price.php    |   4 +-
 .../Catalog/Product/View/Type/Bundle.php      |   6 +-
 .../Product/View/Type/Bundle/Option.php       |   6 +-
 app/code/Magento/Bundle/Model/Price/Index.php |   8 +-
 .../Bundle/Model/Product/CatalogPrice.php     |   6 +-
 .../Magento/Bundle/Model/Product/Type.php     |   4 +-
 .../Sales/Order/Pdf/Items/Creditmemo.php      |   8 +-
 .../Model/Sales/Order/Pdf/Items/Invoice.php   |   8 +-
 .../Model/Sales/Order/Pdf/Items/Shipment.php  |   8 +-
 app/code/Magento/Bundle/Model/Selection.php   |   8 +-
 .../Source/Option/Selection/Price/Type.php    |   2 +-
 .../Bundle/Model/Source/Option/Type.php       |   2 +-
 ...w.xml => adminhtml_order_shipment_new.xml} |   0
 ....xml => adminhtml_order_shipment_view.xml} |   0
 .../Magento/Captcha/Model/Config/Font.php     |   2 +-
 .../Model/Config/Form/AbstractForm.php        |   2 +-
 .../Magento/Captcha/Model/Config/Mode.php     |   2 +-
 .../Adminhtml/Category/AbstractCategory.php   |   6 +-
 .../Block/Adminhtml/Category/Edit/Form.php    |   4 +-
 .../Adminhtml/Category/Tab/Attributes.php     |   4 +-
 .../Block/Adminhtml/Category/Tab/Product.php  |   6 +-
 .../Catalog/Block/Adminhtml/Category/Tabs.php |   6 +-
 .../Catalog/Block/Adminhtml/Category/Tree.php |   4 +-
 .../Adminhtml/Helper/Form/Wysiwyg/Content.php |   4 +-
 .../Adminhtml/Product/Attribute/Edit.php      |   6 +-
 .../Product/Attribute/Edit/Tab/Advanced.php   |   4 +-
 .../Product/Attribute/Edit/Tab/Front.php      |   4 +-
 .../Adminhtml/Product/Attribute/Set/Main.php  |   6 +-
 .../Product/Attribute/Set/Main/Formgroup.php  |   4 +-
 .../Product/Attribute/Set/Main/Formset.php    |   4 +-
 .../Attribute/Set/Toolbar/Main/Filter.php     |   4 +-
 .../Adminhtml/Product/Composite/Configure.php |   6 +-
 .../Adminhtml/Product/Composite/Error.php     |   6 +-
 .../Product/Composite/Fieldset/Qty.php        |   6 +-
 .../Product/Composite/Update/Result.php       |   6 +-
 .../Catalog/Block/Adminhtml/Product/Edit.php  |   6 +-
 .../Edit/Action/Attribute/Tab/Attributes.php  |   4 +-
 .../Adminhtml/Product/Edit/AttributeSet.php   |   6 +-
 .../Block/Adminhtml/Product/Edit/Js.php       |   6 +-
 .../Adminhtml/Product/Edit/NewCategory.php    |   4 +-
 .../Adminhtml/Product/Edit/Tab/Attributes.php |   4 +-
 .../Product/Edit/Tab/Attributes/Search.php    |   6 +-
 .../Adminhtml/Product/Edit/Tab/Crosssell.php  |   8 +-
 .../Adminhtml/Product/Edit/Tab/Inventory.php  |   6 +-
 .../Product/Edit/Tab/Options/Option.php       |   6 +-
 .../Edit/Tab/Price/Group/AbstractGroup.php    |   6 +-
 .../Product/Edit/Tab/Price/Recurring.php      |   6 +-
 .../Adminhtml/Product/Edit/Tab/Related.php    |   8 +-
 .../Adminhtml/Product/Edit/Tab/Upsell.php     |   8 +-
 .../Adminhtml/Product/Edit/Tab/Websites.php   |   6 +-
 .../Block/Adminhtml/Product/Edit/Tabs.php     |   6 +-
 .../Block/Adminhtml/Product/Options/Ajax.php  |   8 +-
 .../Catalog/Block/Adminhtml/Search/Edit.php   |   6 +-
 .../Block/Adminhtml/Search/Edit/Form.php      |   4 +-
 .../Magento/Catalog/Block/Category/View.php   |   6 +-
 app/code/Magento/Catalog/Block/Navigation.php |   6 +-
 .../Catalog/Block/Product/AbstractProduct.php |   6 +-
 .../Block/Product/Compare/ListCompare.php     |   6 +-
 .../Magento/Catalog/Block/Product/Gallery.php |   6 +-
 .../Catalog/Block/Product/ListProduct.php     |   6 +-
 .../Catalog/Block/Product/NewProduct.php      |   6 +-
 .../Magento/Catalog/Block/Product/Price.php   |   8 +-
 .../Block/Product/ProductList/Promotion.php   |   6 +-
 .../Block/Product/ProductList/Random.php      |   6 +-
 .../Block/Product/ProductList/Related.php     |   6 +-
 .../Block/Product/ProductList/Upsell.php      |   6 +-
 .../Magento/Catalog/Block/Product/Send.php    |   6 +-
 .../Block/Product/TemplateSelector.php        |   6 +-
 .../Magento/Catalog/Block/Product/View.php    |   4 +-
 .../Block/Product/View/AbstractView.php       |   6 +-
 .../Catalog/Block/Product/View/Attributes.php |   6 +-
 .../Block/Product/View/Description.php        |   6 +-
 .../Catalog/Block/Product/View/Options.php    |   6 +-
 .../Catalog/Block/Product/View/Price.php      |   6 +-
 .../Catalog/Controller/Adminhtml/Category.php |   4 +-
 .../Controller/Adminhtml/Category/Widget.php  |   6 +-
 .../Catalog/Controller/Adminhtml/Product.php  |   6 +-
 .../Adminhtml/Product/Attribute.php           |   6 +-
 .../Controller/Adminhtml/Product/Builder.php  |   6 +-
 .../Controller/Adminhtml/Product/Review.php   |   6 +-
 .../Controller/Adminhtml/Product/Set.php      |   6 +-
 .../Catalog/Controller/Adminhtml/Search.php   |   6 +-
 .../Magento/Catalog/Controller/Category.php   |   6 +-
 app/code/Magento/Catalog/Helper/Data.php      |   6 +-
 .../Catalog/Helper/Flat/AbstractFlat.php      | 112 ---
 app/code/Magento/Catalog/Helper/Image.php     |  19 +-
 app/code/Magento/Catalog/Helper/Product.php   |   8 +-
 .../Catalog/Helper/Product/Composite.php      |   8 +-
 .../Magento/Catalog/Helper/Product/Flat.php   | 139 ----
 .../Catalog/Helper/Product/Flat/Indexer.php   |  73 +-
 .../Magento/Catalog/Helper/Product/View.php   |   8 +-
 .../Magento/Catalog/Model/AbstractModel.php   |   8 +-
 app/code/Magento/Catalog/Model/Category.php   |  16 +-
 .../Catalog/Model/Config/Backend/Category.php |   8 +-
 .../Model/Config/CatalogClone/Media/Image.php |   8 +-
 .../Catalog/Model/Config/Source/Category.php  |   2 +-
 .../Model/Config/Source/GridPerPage.php       |   2 +-
 .../Catalog/Model/Config/Source/ListMode.php  |   4 +-
 .../Model/Config/Source/ListPerPage.php       |   2 +-
 .../Catalog/Model/Config/Source/ListSort.php  |   2 +-
 .../Model/Config/Source/Price/Scope.php       |   4 +-
 .../Model/Config/Source/Price/Step.php        |   4 +-
 .../Config/Source/Product/Options/Price.php   |   2 +-
 .../Config/Source/Product/Options/Type.php    |   2 +-
 .../Model/Config/Source/Product/Thumbnail.php |   2 +-
 .../Model/Config/Source/TimeFormat.php        |   2 +-
 .../Config/Source/Watermark/Position.php      |   2 +-
 app/code/Magento/Catalog/Model/Design.php     |   8 +-
 .../Catalog/Model/Entity/Attribute.php        |   8 +-
 .../Category/Flat/System/Config/Mode.php      |   8 +-
 .../Indexer/Product/Flat/AbstractAction.php   | 651 +-----------------
 .../Indexer/Product/Flat/Action/Rows.php      |  38 -
 .../Product/Flat/Action/Rows/TableData.php    |  96 +++
 .../Indexer/Product/Flat/FlatTableBuilder.php | 357 ++++++++++
 .../Product/Flat/Plugin/IndexerConfigData.php |  12 +-
 .../Model/Indexer/Product/Flat/Processor.php  |  19 +-
 .../Model/Indexer/Product/Flat/State.php      |  70 ++
 .../Product/Flat/System/Config/Mode.php       |   8 +-
 .../Indexer/Product/Flat/TableBuilder.php     | 353 ++++++++++
 .../Model/Indexer/Product/Flat/TableData.php  |  80 +++
 .../Product/Flat/TableDataInterface.php       |  42 ++
 .../Magento/Catalog/Model/Indexer/Url.php     |   8 +-
 app/code/Magento/Catalog/Model/Layer.php      |   6 +-
 .../Catalog/Model/Layer/Filter/Category.php   |  11 +-
 .../Catalog/Model/Layer/Filter/Price.php      |   6 +-
 app/code/Magento/Catalog/Model/Product.php    |   8 +-
 .../Magento/Catalog/Model/Product/Action.php  |   8 +-
 .../Catalog/Model/Product/Attribute/Group.php |   8 +-
 .../Product/Attribute/Source/Inputtype.php    |   8 +-
 .../Catalog/Model/Product/Compare/Item.php    |   8 +-
 .../Magento/Catalog/Model/Product/Image.php   |   8 +-
 .../Catalog/Model/Product/Indexer/Eav.php     |   8 +-
 .../Magento/Catalog/Model/Product/Link.php    |   8 +-
 .../Magento/Catalog/Model/Product/Option.php  |   8 +-
 .../Catalog/Model/Product/Option/Value.php    |   8 +-
 .../Model/Product/Type/AbstractType.php       |   9 +-
 .../Catalog/Model/Resource/Category/Flat.php  |   4 +-
 .../Catalog/Model/Resource/Eav/Attribute.php  |  22 +-
 .../Catalog/Model/Resource/Product.php        |   3 +-
 .../Model/Resource/Product/Collection.php     |  29 +-
 .../Product/Compare/Item/Collection.php       |   6 +-
 .../Backend/Catalog/Url/Rewrite/Suffix.php    |   8 +-
 app/code/Magento/Catalog/etc/adminhtml/di.xml |   3 +
 app/code/Magento/Catalog/etc/di.xml           |  22 +-
 app/code/Magento/Catalog/etc/frontend/di.xml  |   5 +
 app/code/Magento/Catalog/i18n/de_DE.csv       |  10 +-
 app/code/Magento/Catalog/i18n/en_US.csv       |  10 +-
 app/code/Magento/Catalog/i18n/es_ES.csv       |  10 +-
 app/code/Magento/Catalog/i18n/fr_FR.csv       |  10 +-
 app/code/Magento/Catalog/i18n/nl_NL.csv       |  10 +-
 app/code/Magento/Catalog/i18n/pt_BR.csv       |  10 +-
 app/code/Magento/Catalog/i18n/zh_CN.csv       |  10 +-
 .../CatalogInventory/Block/Qtyincrements.php  |   6 +-
 .../Block/Stockqty/AbstractStockqty.php       |   6 +-
 .../Model/Config/Backend/Managestock.php      |   8 +-
 .../CatalogInventory/Model/Indexer/Stock.php  |   8 +-
 .../Model/Source/Backorders.php               |   2 +-
 .../CatalogInventory/Model/Source/Stock.php   |   2 +-
 .../Magento/CatalogInventory/Model/Stock.php  |   8 +-
 .../CatalogInventory/Model/Stock/Item.php     |   8 +-
 .../CatalogInventory/Model/Stock/Status.php   |   8 +-
 .../System/Config/Backend/Minsaleqty.php      |   8 +-
 .../Block/Adminhtml/Promo/Catalog/Edit.php    |   6 +-
 .../Promo/Catalog/Edit/Tab/Conditions.php     |   4 +-
 .../Adminhtml/Promo/Catalog/Edit/Tab/Main.php |   4 +-
 .../Controller/Adminhtml/Promo/Catalog.php    |   2 +-
 .../Controller/Adminhtml/Promo/Widget.php     |   2 +-
 .../Magento/CatalogRule/Model/Observer.php    |   2 +-
 app/code/Magento/CatalogRule/Model/Rule.php   |   8 +-
 .../Magento/CatalogSearch/Block/Layer.php     |   4 +-
 .../Magento/CatalogSearch/Model/Advanced.php  |   4 +-
 .../Model/Config/Backend/Search/Type.php      |   4 +-
 .../Model/Config/Source/Search/Type.php       |  24 +-
 .../Magento/CatalogSearch/Model/Fulltext.php  |   4 +-
 .../CatalogSearch/Model/Indexer/Fulltext.php  |   4 +-
 .../Magento/CatalogSearch/Model/Layer.php     |   2 +-
 .../Magento/CatalogSearch/Model/Query.php     |   4 +-
 .../Model/Resource/Advanced/Collection.php    |   6 +-
 .../Model/Resource/Fulltext/Collection.php    |   6 +-
 .../Model/Resource/Search/Collection.php      |   6 +-
 .../Block/Authentication/Complete.php         |   6 +-
 .../Centinel/Block/Authentication/Start.php   |   6 +-
 .../Controller/Adminhtml/Centinel/Index.php   |   6 +-
 .../Magento/Centinel/Controller/Index.php     |   6 +-
 app/code/Magento/Centinel/Model/Api.php       |   6 +-
 .../Checkout/Block/Adminhtml/Agreement.php    |   7 +-
 .../Block/Adminhtml/Agreement/Edit.php        |   8 +-
 .../Block/Adminhtml/Agreement/Edit/Form.php   |   9 +-
 .../Block/Adminhtml/Agreement/Grid.php        |  21 +
 app/code/Magento/Checkout/Block/Cart.php      |   8 +-
 .../Checkout/Block/Cart/AbstractCart.php      |  32 +-
 .../Magento/Checkout/Block/Cart/Coupon.php    |   4 +-
 .../Magento/Checkout/Block/Cart/Crosssell.php |   7 +-
 .../Checkout/Block/Cart/Item/Configure.php    |   6 +-
 .../Checkout/Block/Cart/Item/Renderer.php     |  34 +-
 app/code/Magento/Checkout/Block/Cart/Link.php |   3 +-
 .../Magento/Checkout/Block/Cart/Shipping.php  |   5 +-
 .../Magento/Checkout/Block/Cart/Sidebar.php   |  15 +-
 .../Magento/Checkout/Block/Cart/Totals.php    |  31 +-
 app/code/Magento/Checkout/Block/Link.php      |   3 +-
 app/code/Magento/Checkout/Block/Onepage.php   |   3 +-
 .../Block/Onepage/AbstractOnepage.php         |  62 +-
 .../Checkout/Block/Onepage/Billing.php        |  16 +-
 .../Checkout/Block/Onepage/Failure.php        |   9 +-
 .../Magento/Checkout/Block/Onepage/Link.php   |   3 +-
 .../Magento/Checkout/Block/Onepage/Login.php  |  26 +-
 .../Checkout/Block/Onepage/Payment.php        |  42 +-
 .../Checkout/Block/Onepage/Payment/Info.php   |   8 +-
 .../Block/Onepage/Payment/Methods.php         |   5 +-
 .../Checkout/Block/Onepage/Progress.php       |  34 +-
 .../Magento/Checkout/Block/Onepage/Review.php |   6 +-
 .../Checkout/Block/Onepage/Review/Info.php    |   3 +-
 .../Checkout/Block/Onepage/Shipping.php       |   5 +-
 .../Block/Onepage/Shipping/Method.php         |   3 +-
 .../Onepage/Shipping/Method/Additional.php    |   4 +-
 .../Onepage/Shipping/Method/Available.php     |  30 +-
 .../Checkout/Block/Onepage/Success.php        |   8 +-
 .../Checkout/Block/QuoteShortcutButtons.php   |   1 -
 app/code/Magento/Checkout/Block/Success.php   |   1 -
 .../Checkout/Block/Total/DefaultTotal.php     |   9 +-
 .../Magento/Checkout/Block/Total/Nominal.php  |   3 +-
 app/code/Magento/Checkout/Block/Total/Tax.php |   7 +-
 .../Magento/Checkout/Controller/Action.php    |  51 +-
 .../Controller/Adminhtml/Agreement.php        |  27 +-
 app/code/Magento/Checkout/Controller/Cart.php |  43 +-
 .../Magento/Checkout/Controller/Index.php     |   6 +-
 .../Magento/Checkout/Controller/Onepage.php   |  84 ++-
 app/code/Magento/Checkout/Helper/Cart.php     |  13 +-
 app/code/Magento/Checkout/Helper/Data.php     | 106 ++-
 app/code/Magento/Checkout/Helper/Url.php      |   2 +
 app/code/Magento/Checkout/Model/Agreement.php |   6 +-
 app/code/Magento/Checkout/Model/Cart.php      |  73 +-
 .../Checkout/Model/Cart/CartInterface.php     |  23 +-
 .../Model/Config/Source/Cart/Summary.php      |   5 +-
 app/code/Magento/Checkout/Model/Observer.php  |  16 +-
 .../Checkout/Model/Resource/Agreement.php     |  15 +-
 .../Model/Resource/Agreement/Collection.php   |  12 +-
 .../Magento/Checkout/Model/Resource/Cart.php  |   7 +-
 .../Magento/Checkout/Model/Resource/Setup.php |   2 +-
 app/code/Magento/Checkout/Model/Session.php   |  96 ++-
 .../Checkout/Model/Type/AbstractType.php      |  67 +-
 .../Magento/Checkout/Model/Type/Onepage.php   | 425 +++++++-----
 app/code/Magento/Checkout/etc/module.xml      |   1 -
 app/code/Magento/Checkout/i18n/de_DE.csv      |   2 +-
 app/code/Magento/Checkout/i18n/en_US.csv      |   2 +-
 app/code/Magento/Checkout/i18n/es_ES.csv      |   2 +-
 app/code/Magento/Checkout/i18n/fr_FR.csv      |   2 +-
 app/code/Magento/Checkout/i18n/nl_NL.csv      |   2 +-
 app/code/Magento/Checkout/i18n/pt_BR.csv      |   2 +-
 app/code/Magento/Checkout/i18n/zh_CN.csv      |   2 +-
 .../Checkout/view/frontend/onepage.phtml      |  39 +-
 .../Magento/Cms/Block/Adminhtml/Block.php     |   6 -
 .../Cms/Block/Adminhtml/Block/Edit.php        |  10 +-
 .../Cms/Block/Adminhtml/Block/Edit/Form.php   |   8 +-
 .../Block/Adminhtml/Block/Widget/Chooser.php  |   4 -
 app/code/Magento/Cms/Block/Adminhtml/Page.php |   5 -
 .../Magento/Cms/Block/Adminhtml/Page/Edit.php |   6 +-
 .../Block/Adminhtml/Page/Edit/Tab/Content.php |   4 +-
 .../Block/Adminhtml/Page/Edit/Tab/Design.php  |   4 +-
 .../Block/Adminhtml/Page/Edit/Tab/Main.php    |   4 +-
 .../Cms/Block/Adminhtml/Page/Edit/Tabs.php    |   5 -
 .../Adminhtml/Page/Grid/Renderer/Action.php   |  27 +-
 .../Page/Grid/Renderer/Action/UrlBuilder.php  |  59 ++
 .../Adminhtml/Wysiwyg/Images/Content.php      |  10 +-
 .../Block/Adminhtml/Wysiwyg/Images/Tree.php   |   6 +-
 app/code/Magento/Cms/Block/Block.php          |   9 +-
 app/code/Magento/Cms/Block/Page.php           |   6 -
 .../Magento/Cms/Block/Widget/Page/Link.php    |  10 +-
 .../Cms/Controller/Adminhtml/Block.php        |   6 +-
 .../Magento/Cms/Controller/Adminhtml/Page.php |   6 +-
 .../Controller/Adminhtml/Wysiwyg/Images.php   |   8 +-
 app/code/Magento/Cms/Model/Block.php          |  12 +-
 .../Magento/Cms/Model/Config/Source/Page.php  |   5 +-
 .../Model/Config/Source/Wysiwyg/Enabled.php   |   7 +-
 app/code/Magento/Cms/Model/Observer.php       |  10 +-
 app/code/Magento/Cms/Model/Page.php           |  10 +-
 .../Magento/Cms/Model/Page/Urlrewrite.php     |   3 +
 app/code/Magento/Cms/Model/Resource/Block.php |  20 +-
 .../Cms/Model/Resource/Block/Collection.php   |   5 +-
 .../Model/Resource/Block/Grid/Collection.php  |   3 +-
 app/code/Magento/Cms/Model/Resource/Page.php  |  10 +-
 .../Cms/Model/Resource/Page/Collection.php    |   6 +-
 .../Cms/Model/Resource/Page/Service.php       |   3 +-
 .../Cms/Model/Resource/Page/Urlrewrite.php    |   3 +-
 app/code/Magento/Cms/Model/Resource/Setup.php |   1 +
 .../Magento/Cms/Model/Template/Filter.php     |   7 +-
 .../Cms/Model/Template/FilterProvider.php     |   3 +
 app/code/Magento/Cms/Model/Wysiwyg/Config.php |  24 +-
 .../Cms/Model/Wysiwyg/Images/Storage.php      |  20 +-
 .../Wysiwyg/Images/Storage/Collection.php     |   5 +-
 app/code/Magento/Cms/etc/adminhtml/di.xml     |  32 +
 .../NewAttribute/Product/Created.php          |   6 +-
 .../Product/Edit/Tab/Super/Config.php         |   6 +-
 .../Product/Edit/Tab/Super/Config/Matrix.php  |   6 +-
 .../Product/Edit/Tab/Super/Config/Simple.php  |   4 +-
 .../Product/Edit/Tab/Super/Settings.php       |   4 +-
 .../Block/Cart/Item/Renderer/Configurable.php |   1 -
 .../Backend/Grid/ColumnSet.php                |   6 +-
 .../Block/Product/View/Type/Configurable.php  |   4 +-
 .../Group/AttributeMapper/Plugin.php          |   6 +-
 .../Model/Product/Type/Configurable.php       |   4 +-
 .../Product/Collection/AssociatedProduct.php  |  13 +-
 .../Extension/Custom/Edit/Tab/AbstractTab.php |   4 +-
 .../Extension/Custom/Edit/Tab/Authors.php     |   4 +-
 .../Extension/Custom/Edit/Tab/Contents.php    |   4 +-
 .../Magento/Contacts/Controller/Index.php     |  51 +-
 app/code/Magento/Contacts/etc/module.xml      |   1 -
 app/code/Magento/Core/App/Router/Base.php     |  13 +-
 app/code/Magento/Core/Model/AbstractModel.php |  16 +-
 app/code/Magento/Core/Model/App.php           |   4 +-
 app/code/Magento/Core/Model/Config/Value.php  |   8 +-
 app/code/Magento/Core/Model/Design.php        |  10 +-
 .../Core/Model/Design/Backend/Exceptions.php  |   8 +-
 .../Core/Model/Design/Backend/Theme.php       |   8 +-
 app/code/Magento/Core/Model/File/Storage.php  |   8 +-
 .../Core/Model/File/Storage/Database.php      |   8 +-
 .../Storage/Database/AbstractDatabase.php     |   8 +-
 .../Model/File/Storage/Directory/Database.php |   8 +-
 app/code/Magento/Core/Model/Layout/Update.php |   8 +-
 .../Magento/Core/Model/Mview/View/State.php   |   8 +-
 .../Core/Model/Source/Urlrewrite/Options.php  |   4 +-
 .../Core/Model/Source/Urlrewrite/Types.php    |   2 +-
 app/code/Magento/Core/Model/Store.php         |   4 +-
 app/code/Magento/Core/Model/Store/Group.php   |   8 +-
 app/code/Magento/Core/Model/Template.php      |  18 +-
 app/code/Magento/Core/Model/Theme.php         |   8 +-
 app/code/Magento/Core/Model/Theme/File.php    |   8 +-
 app/code/Magento/Core/Model/Url/Rewrite.php   |   8 +-
 app/code/Magento/Core/Model/Variable.php      |   8 +-
 app/code/Magento/Core/Model/Website.php       |   8 +-
 app/code/Magento/Core/etc/di.xml              |  27 +-
 app/code/Magento/Core/i18n/de_DE.csv          |   8 +-
 app/code/Magento/Core/i18n/en_US.csv          |   8 +-
 app/code/Magento/Core/i18n/es_ES.csv          |   8 +-
 app/code/Magento/Core/i18n/fr_FR.csv          |   8 +-
 app/code/Magento/Core/i18n/nl_NL.csv          |   8 +-
 app/code/Magento/Core/i18n/pt_BR.csv          |   8 +-
 app/code/Magento/Core/i18n/zh_CN.csv          |   8 +-
 .../Model/Config/Backend/Product/Alert.php    |   8 +-
 .../Cron/Model/Config/Backend/Sitemap.php     |   8 +-
 .../Cron/Model/Config/Source/Frequency.php    |   2 +-
 app/code/Magento/Cron/Model/Schedule.php      |   8 +-
 .../Controller/Adminhtml/System/Currency.php  |   6 +-
 .../Magento/Customer/Block/Adminhtml/Edit.php |   6 +-
 .../Edit/Renderer/Attribute/Group.php         |   6 +-
 .../Block/Adminhtml/Edit/Tab/Account.php      |   4 +-
 .../Block/Adminhtml/Edit/Tab/Addresses.php    |   4 +-
 .../Block/Adminhtml/Edit/Tab/Cart.php         |   6 +-
 .../Block/Adminhtml/Edit/Tab/Carts.php        |   6 +-
 .../Block/Adminhtml/Edit/Tab/Newsletter.php   |   4 +-
 .../Adminhtml/Edit/Tab/Newsletter/Grid.php    |   6 +-
 .../Tab/Newsletter/Grid/Renderer/Action.php   |   6 +-
 .../Block/Adminhtml/Edit/Tab/Orders.php       |   8 +-
 .../Block/Adminhtml/Edit/Tab/View.php         |   6 +-
 .../Adminhtml/Edit/Tab/View/Accordion.php     |   6 +-
 .../Block/Adminhtml/Edit/Tab/View/Cart.php    |  13 +-
 .../Block/Adminhtml/Edit/Tab/View/Orders.php  |   6 +-
 .../Block/Adminhtml/Edit/Tab/View/Sales.php   |  11 +-
 .../Adminhtml/Edit/Tab/View/Wishlist.php      |   6 +-
 .../Customer/Block/Adminhtml/Edit/Tabs.php    |   6 +-
 .../Customer/Block/Adminhtml/Group/Edit.php   |   6 +-
 .../Block/Adminhtml/Group/Edit/Form.php       |   4 +-
 .../Magento/Customer/Controller/Account.php   |   6 +-
 .../Customer/Controller/Adminhtml/Group.php   |   8 +-
 .../Customer/Controller/Adminhtml/Index.php   |   8 +-
 app/code/Magento/Customer/Helper/Data.php     |  61 +-
 app/code/Magento/Customer/Model/Address.php   |   8 +-
 .../Model/Address/AbstractAddress.php         |  18 +-
 .../Customer/Model/Address/Converter.php      | 163 +++++
 .../Model/Config/Backend/Address/Street.php   |   8 +-
 .../Model/Config/Backend/Show/Customer.php    |   8 +-
 .../Magento/Customer/Model/Config/Share.php   |  12 +-
 .../Model/Config/Source/Address/Type.php      |   2 +-
 .../Customer/Model/Config/Source/Group.php    |   2 +-
 .../Model/Config/Source/Group/Multiselect.php |   2 +-
 app/code/Magento/Customer/Model/Converter.php |  62 +-
 app/code/Magento/Customer/Model/Customer.php  | 155 ++---
 app/code/Magento/Customer/Model/Group.php     |   8 +-
 .../Magento/Customer/Model/Metadata/Form.php  |  13 +-
 .../Customer/Model/Metadata/Form/Text.php     |   2 +-
 .../Customer/Model/Metadata/FormFactory.php   |   8 +-
 .../Customer/Model/Metadata/Validator.php     |  27 +-
 app/code/Magento/Customer/Model/Observer.php  |   6 +-
 .../Customer/CustomersTypeOptions.php         |   2 +-
 app/code/Magento/Customer/Model/Session.php   |  61 +-
 .../Service/V1/CustomerAccountService.php     |  15 +-
 .../Service/V1/CustomerAddressService.php     | 122 +---
 .../Service/V1/CustomerMetadataService.php    |  67 +-
 .../V1/CustomerMetadataServiceInterface.php   |   6 +-
 .../Customer/Service/V1/CustomerService.php   |  22 +-
 .../Service/V1/CustomerServiceInterface.php   |  19 +
 .../Customer/Service/V1/Dto/Address.php       | 107 ++-
 .../Service/V1/Dto/AddressBuilder.php         |  67 +-
 .../Customer/Service/V1/Dto/Customer.php      |  81 ++-
 .../Service/V1/Dto/CustomerBuilder.php        |  25 +-
 .../Customer/Service/V1/Dto/Region.php        |  14 +-
 .../Customer/Service/V1/Dto/RegionBuilder.php |   6 +-
 app/code/Magento/Customer/etc/module.xml      |   1 -
 app/code/Magento/Customer/i18n/de_DE.csv      |   4 +-
 app/code/Magento/Customer/i18n/en_US.csv      |   4 +-
 app/code/Magento/Customer/i18n/es_ES.csv      |   4 +-
 app/code/Magento/Customer/i18n/fr_FR.csv      |   4 +-
 app/code/Magento/Customer/i18n/nl_NL.csv      |   4 +-
 app/code/Magento/Customer/i18n/pt_BR.csv      |   4 +-
 app/code/Magento/Customer/i18n/zh_CN.csv      |   4 +-
 .../Adminhtml/Editor/Tools/Code/Custom.php    |   4 +-
 .../Editor/Tools/Code/ImageSizing.php         |   4 +-
 .../Block/Adminhtml/Editor/Tools/Code/Js.php  |   4 +-
 .../Controller/Varien/Router/Standard.php     |   7 +-
 .../Model/Config/Source/Allregion.php         |   2 +-
 .../Directory/Model/Config/Source/Country.php |   2 +-
 .../Model/Config/Source/Country/Full.php      |   2 +-
 app/code/Magento/Directory/Model/Country.php  |   8 +-
 app/code/Magento/Directory/Model/Currency.php |   8 +-
 .../Model/Currency/Import/Source/Service.php  |   2 +-
 app/code/Magento/Directory/Model/Observer.php |  61 +-
 .../Directory/Model/Resource/Country.php      |   4 +-
 app/code/Magento/Directory/etc/module.xml     |   1 -
 app/code/Magento/Directory/i18n/de_DE.csv     |   2 +-
 app/code/Magento/Directory/i18n/en_US.csv     |   2 +-
 app/code/Magento/Directory/i18n/es_ES.csv     |   2 +-
 app/code/Magento/Directory/i18n/fr_FR.csv     |   2 +-
 app/code/Magento/Directory/i18n/nl_NL.csv     |   2 +-
 app/code/Magento/Directory/i18n/pt_BR.csv     |   2 +-
 app/code/Magento/Directory/i18n/zh_CN.csv     |   2 +-
 .../Catalog/Product/Edit/Tab/Downloadable.php |   6 +-
 .../Product/Edit/Tab/Downloadable/Links.php   |   6 +-
 .../Product/Edit/Tab/Downloadable/Samples.php |   6 +-
 .../Block/Catalog/Product/Links.php           |   6 +-
 app/code/Magento/Downloadable/Model/Link.php  |   8 +-
 .../Downloadable/Model/Product/Type.php       |   4 +-
 .../Sales/Order/Pdf/Items/AbstractItems.php   |   8 +-
 .../Sales/Order/Pdf/Items/Creditmemo.php      |   8 +-
 .../Model/Sales/Order/Pdf/Items/Invoice.php   |   8 +-
 .../Magento/Downloadable/Model/Sample.php     |   8 +-
 .../Config/Source/Contentdisposition.php      |   2 +-
 .../System/Config/Source/Orderitemstatus.php  |   2 +-
 app/code/Magento/Downloadable/i18n/de_DE.csv  |   2 +-
 app/code/Magento/Downloadable/i18n/en_US.csv  |   2 +-
 app/code/Magento/Downloadable/i18n/es_ES.csv  |   2 +-
 app/code/Magento/Downloadable/i18n/fr_FR.csv  |   2 +-
 app/code/Magento/Downloadable/i18n/nl_NL.csv  |   2 +-
 app/code/Magento/Downloadable/i18n/pt_BR.csv  |   2 +-
 app/code/Magento/Downloadable/i18n/zh_CN.csv  |   2 +-
 .../Attribute/Edit/Main/AbstractMain.php      |   4 +-
 .../Attribute/Edit/Options/Labels.php         |   6 +-
 .../Attribute/Edit/Options/Options.php        |   6 +-
 app/code/Magento/Eav/Helper/Data.php          |  31 +-
 .../System/Config/Source/Inputtype.php        |   2 +-
 .../Magento/Eav/Model/Attribute/Data/Text.php |   2 +-
 .../Magento/Eav/Model/Entity/Attribute.php    |   8 +-
 .../Entity/Attribute/AbstractAttribute.php    |   8 +-
 .../Eav/Model/Entity/Attribute/Set.php        |   8 +-
 .../Attribute/Source/AbstractSource.php       |   2 +-
 .../Entity/Collection/AbstractCollection.php  |  36 +-
 app/code/Magento/Eav/Model/Entity/Type.php    |   8 +-
 app/code/Magento/Eav/Model/Form/Element.php   |   8 +-
 app/code/Magento/Eav/Model/Form/Fieldset.php  |   8 +-
 app/code/Magento/Eav/Model/Form/Type.php      |   8 +-
 .../Entity/Attribute/Grid/Collection.php      |   6 +-
 .../Entity/Attribute/Option/Collection.php    |   4 +-
 app/code/Magento/Eav/i18n/de_DE.csv           |   4 +-
 app/code/Magento/Eav/i18n/en_US.csv           |   4 +-
 app/code/Magento/Eav/i18n/es_ES.csv           |   4 +-
 app/code/Magento/Eav/i18n/fr_FR.csv           |   4 +-
 app/code/Magento/Eav/i18n/nl_NL.csv           |   4 +-
 app/code/Magento/Eav/i18n/pt_BR.csv           |   4 +-
 app/code/Magento/Eav/i18n/zh_CN.csv           |   4 +-
 .../Email/Block/Adminhtml/Template/Edit.php   |   6 +-
 .../Block/Adminhtml/Template/Edit/Form.php    |   4 +-
 .../Adminhtml/Template/Grid/Filter/Type.php   |   4 +-
 .../Adminhtml/Template/Grid/Renderer/Type.php |   4 +-
 .../Block/Adminhtml/Template/Preview.php      |   6 +-
 .../Controller/Adminhtml/Email/Template.php   |   8 +-
 .../Magento/Email/Model/BackendTemplate.php   |   8 +-
 app/code/Magento/Email/Model/Info.php         | 139 ----
 app/code/Magento/Email/Model/Sender.php       |  88 ---
 .../Magento/Email/Model/Source/Variables.php  |   2 +-
 app/code/Magento/Email/Model/Template.php     | 267 +++----
 .../Magento/Email/Model/Template/Mailer.php   | 195 ------
 .../Email/Model/Template/SenderResolver.php   |  67 ++
 app/code/Magento/Email/etc/di.xml             |   8 +-
 .../Block/Adminhtml/Sales/Order/View/Form.php |   6 +-
 .../Magento/GiftMessage/Model/Message.php     |   8 +-
 .../Magento/GoogleAdwords/Helper/Data.php     |   6 +-
 .../Config/Backend/AbstractConversion.php     |   8 +-
 .../Model/Config/Source/Language.php          |   2 +-
 .../Model/Config/Source/ValueType.php         |   2 +-
 .../Magento/GoogleAdwords/Model/Observer.php  |   4 +-
 app/code/Magento/GoogleCheckout/Model/Api.php |   2 +-
 .../Magento/GoogleCheckout/Model/Payment.php  |   2 +-
 .../Model/Source/Checkout/Image.php           |   2 +-
 .../GoogleCheckout/Model/Source/Locale.php    |   2 +-
 .../Model/Source/Shipping/Carrier.php         |   2 +-
 .../Model/Source/Shipping/Category.php        |   2 +-
 .../Model/Source/Shipping/Units.php           |   2 +-
 .../Model/Source/Shipping/Virtual/Method.php  |   2 +-
 .../Source/Shipping/Virtual/Schedule.php      |   2 +-
 .../GoogleOptimizer/Block/AbstractCode.php    |   6 +-
 .../Block/Adminhtml/AbstractTab.php           |   6 +-
 .../Category/Edit/Tab/Googleoptimizer.php     |   6 +-
 .../GoogleOptimizer/Block/Code/Page.php       |   4 +-
 .../Block/Adminhtml/Types/Edit.php            |   6 +-
 .../Block/Adminhtml/Types/Edit/Form.php       |   6 +-
 .../Adminhtml/Googleshopping/Types.php        |   6 +-
 .../GoogleShopping/Model/Attribute.php        |   8 +-
 .../Model/Attribute/ContentLanguage.php       |   8 +-
 .../Model/Attribute/Destinations.php          |   8 +-
 .../Model/Attribute/GoogleProductCategory.php |   8 +-
 .../Model/Attribute/ImageLink.php             |   8 +-
 .../GoogleShopping/Model/Attribute/Link.php   |   8 +-
 .../GoogleShopping/Model/Attribute/Price.php  |   8 +-
 .../Model/Attribute/ProductType.php           |   8 +-
 .../Model/Attribute/TargetCountry.php         |   8 +-
 .../GoogleShopping/Model/Attribute/Tax.php    |   8 +-
 .../Magento/GoogleShopping/Model/Item.php     |   8 +-
 .../Magento/GoogleShopping/Model/Service.php  |  12 +-
 .../GoogleShopping/Model/Service/Item.php     |   8 +-
 .../Model/Source/Accounttype.php              |   2 +-
 .../GoogleShopping/Model/Source/Authtype.php  |   2 +-
 .../GoogleShopping/Model/Source/Country.php   |   2 +-
 .../Model/Source/Destinationstates.php        |   2 +-
 .../Magento/GoogleShopping/Model/Type.php     |   8 +-
 .../Magento/GoogleShopping/i18n/en_US.csv     |  12 +-
 .../Product/Composite/Fieldset/Grouped.php    |   6 +-
 .../ListAssociatedProducts.php                |   6 +-
 .../Controller/Adminhtml/Edit.php             |   8 +-
 .../Model/Product/Type/Grouped.php            |   4 +-
 .../Grouped/AssociatedProductsCollection.php  |  14 +-
 .../Block/Adminhtml/Export/Edit/Form.php      |   4 +-
 .../Block/Adminhtml/Form/After.php            |   6 +-
 .../Block/Adminhtml/Import/Edit/Form.php      |   4 +-
 .../ImportExport/Model/AbstractModel.php      |  10 +-
 .../Magento/ImportExport/Model/Export.php     |   4 +-
 .../Magento/ImportExport/Model/Import.php     |   4 +-
 .../Model/Source/Export/Entity.php            |   2 +-
 .../Model/Source/Export/Format.php            |   2 +-
 .../Model/Source/Import/AbstractBehavior.php  |   2 +-
 .../Model/Source/Import/Entity.php            |   2 +-
 .../Index/Block/Adminhtml/Process/Edit.php    |   6 +-
 .../Index/Controller/Adminhtml/Process.php    |   6 +-
 app/code/Magento/Index/Model/Event.php        |   8 +-
 app/code/Magento/Index/Model/Process.php      |   8 +-
 app/code/Magento/Index/Model/Shell.php        |   2 +-
 .../Magento/Indexer/Model/Indexer/State.php   |   8 +-
 app/code/Magento/Indexer/Model/Shell.php      |   2 +-
 app/code/Magento/Install/i18n/de_DE.csv       |   4 +-
 app/code/Magento/Install/i18n/en_US.csv       |   4 +-
 app/code/Magento/Install/i18n/es_ES.csv       |   4 +-
 app/code/Magento/Install/i18n/fr_FR.csv       |   4 +-
 app/code/Magento/Install/i18n/nl_NL.csv       |   4 +-
 app/code/Magento/Install/i18n/pt_BR.csv       |   4 +-
 app/code/Magento/Install/i18n/zh_CN.csv       |   4 +-
 .../Install/view/install/css/validate.css     |   2 +-
 .../Block/Adminhtml/Integration/Edit.php      |   6 +-
 .../Controller/Adminhtml/Integration.php      |   6 +-
 .../Magento/Integration/Model/Integration.php |   8 +-
 .../Model/Integration/Source/Status.php       |   2 +-
 .../Integration/Model/Oauth/Consumer.php      |   8 +-
 .../Magento/Integration/Model/Oauth/Nonce.php |   8 +-
 .../Magento/Integration/Model/Oauth/Token.php |   8 +-
 app/code/Magento/Log/Model/Aggregation.php    |   8 +-
 app/code/Magento/Log/Model/Cron.php           |  43 +-
 app/code/Magento/Log/Model/Customer.php       |   8 +-
 app/code/Magento/Log/Model/Log.php            |   8 +-
 app/code/Magento/Log/Model/Shell.php          |   2 +-
 app/code/Magento/Log/Model/Visitor.php        |   8 +-
 app/code/Magento/Log/Model/Visitor/Online.php |   8 +-
 app/code/Magento/Log/etc/module.xml           |   1 -
 .../Block/Checkout/Address/Select.php         | 114 ++-
 .../Multishipping/Block/Checkout/Shipping.php |   3 +
 .../Multishipping/Controller/Checkout.php     |  49 +-
 .../Controller/Checkout/Address.php           |  35 +-
 .../Model/Checkout/Type/Multishipping.php     |  57 +-
 .../frontend/checkout/address/select.phtml    |   5 +-
 .../Newsletter/Block/Adminhtml/Queue/Edit.php |   6 +-
 .../Block/Adminhtml/Queue/Edit/Form.php       |  13 +-
 .../Subscriber/Grid/Filter/Website.php        |   6 +-
 .../Block/Adminhtml/Template/Edit.php         |   6 +-
 .../Block/Adminhtml/Template/Edit/Form.php    |   4 +-
 .../Grid/Options/GroupOptionHash.php          |  10 +-
 .../Grid/Options/StoreOptionHash.php          |  10 +-
 .../Newsletter/Controller/Adminhtml/Queue.php |   6 +-
 .../Controller/Adminhtml/Template.php         |   6 +-
 app/code/Magento/Newsletter/Helper/Data.php   |   4 +-
 app/code/Magento/Newsletter/Model/Problem.php |   8 +-
 app/code/Magento/Newsletter/Model/Queue.php   |  94 +--
 .../Newsletter/Model/Queue/Options/Status.php |   2 +-
 .../Model/Queue/TransportBuilder.php          |  60 ++
 .../Magento/Newsletter/Model/Subscriber.php   | 188 ++---
 .../Magento/Newsletter/Model/Template.php     |   8 +-
 app/code/Magento/Ogone/Model/Api.php          |   4 +-
 .../Ogone/Model/Source/PaymentAction.php      |   2 +-
 .../Magento/Ogone/Model/Source/Pmlist.php     |   2 +-
 .../Magento/Ogone/Model/Source/Template.php   |   2 +-
 app/code/Magento/Ogone/i18n/de_DE.csv         |   4 +-
 app/code/Magento/Ogone/i18n/en_US.csv         |   4 +-
 app/code/Magento/Ogone/i18n/es_ES.csv         |   4 +-
 app/code/Magento/Ogone/i18n/fr_FR.csv         |   4 +-
 app/code/Magento/Ogone/i18n/nl_NL.csv         |   4 +-
 app/code/Magento/Ogone/i18n/pt_BR.csv         |   4 +-
 app/code/Magento/Ogone/i18n/zh_CN.csv         |   4 +-
 .../Model/System/Config/Backend/Varnish.php   | 146 ++--
 .../System/Config/Source/Application.php      |  96 +--
 .../adminhtml/page_cache_validation.phtml     |  62 +-
 app/code/Magento/Payment/Helper/Data.php      |  18 +
 .../Model/Config/Source/Allmethods.php        |   2 +-
 .../Config/Source/Allspecificcountries.php    |   2 +-
 .../Payment/Model/Config/Source/Cctype.php    |   2 +-
 app/code/Magento/Payment/Model/Info.php       |   8 +-
 .../Payment/Model/Method/AbstractMethod.php   |  33 +-
 app/code/Magento/Payment/Model/Method/Cc.php  |   4 +-
 .../Magento/Payment/Model/Method/Free.php     |   4 +-
 .../Magento/Payment/Model/Source/Cctype.php   |   2 +-
 .../Magento/Payment/Model/Source/Invoice.php  |   2 +-
 app/code/Magento/Payment/etc/payment.xsd      |   1 +
 app/code/Magento/Payment/etc/payment_file.xsd |   1 +
 .../Block/Adminhtml/Billing/Agreement.php     |   4 +-
 .../Adminhtml/Billing/Agreement/Grid.php      |   9 +-
 .../Adminhtml/Billing/Agreement/View.php      |  10 +-
 .../Adminhtml/Billing/Agreement/View/Form.php |   6 +-
 .../Billing/Agreement/View/Tab/Info.php       |  34 +-
 .../Billing/Agreement/View/Tab/Orders.php     |  20 +-
 .../Adminhtml/Billing/Agreement/View/Tabs.php |   1 +
 .../Adminhtml/Customer/Edit/Tab/Agreement.php |  33 +-
 .../Block/Adminhtml/Settlement/Details.php    |   8 +-
 .../Adminhtml/Settlement/Details/Form.php     |   9 +-
 .../Block/Adminhtml/Settlement/Report.php     |   5 +-
 .../Adminhtml/System/Config/ApiWizard.php     |   5 +-
 .../System/Config/Fieldset/Expanded.php       |   9 +-
 .../Adminhtml/System/Config/Fieldset/Hint.php |   7 +-
 .../System/Config/Fieldset/Payment.php        |   5 +-
 .../System/Config/Fieldset/Store.php          |   4 +-
 .../Paypal/Block/Billing/Agreement/View.php   |  11 +-
 .../Paypal/Block/Billing/Agreements.php       |   7 +-
 .../Onepage/Success/BillingAgreement.php      |   3 +-
 .../Magento/Paypal/Block/Express/Form.php     |   5 +-
 .../Magento/Paypal/Block/Express/Review.php   |  15 +-
 .../Paypal/Block/Express/Review/Details.php   |  10 +-
 .../Magento/Paypal/Block/Express/Shortcut.php |  15 +-
 .../Magento/Paypal/Block/Hosted/Pro/Form.php  |   6 +-
 .../Paypal/Block/Hosted/Pro/Iframe.php        |   4 +-
 app/code/Magento/Paypal/Block/Iframe.php      |   7 +-
 .../Paypal/Block/Payflow/Advanced/Form.php    |   6 +-
 .../Paypal/Block/Payflow/Advanced/Iframe.php  |   5 +-
 .../Paypal/Block/Payflow/Link/Form.php        |   6 +-
 .../Paypal/Block/Payflow/Link/Iframe.php      |   5 +-
 .../Block/Payment/Form/Billing/Agreement.php  |  11 +-
 .../Magento/Paypal/Block/Payment/Info.php     |   5 +-
 .../Block/Payment/Info/Billing/Agreement.php  |   3 +-
 .../Magento/Paypal/Block/Standard/Form.php    |   5 +-
 .../Adminhtml/Billing/Agreement.php           |  21 +-
 .../Controller/Adminhtml/Paypal/Reports.php   |  20 +-
 .../Paypal/Controller/Billing/Agreement.php   |  21 +-
 .../Magento/Paypal/Controller/Express.php     |   5 +-
 .../Controller/Express/AbstractExpress.php    |  36 +-
 .../Magento/Paypal/Controller/Hostedpro.php   |   9 +-
 app/code/Magento/Paypal/Controller/Ipn.php    |   6 +-
 .../Magento/Paypal/Controller/Payflow.php     |  14 +-
 .../Paypal/Controller/Payflowadvanced.php     |  13 +-
 .../Magento/Paypal/Controller/Standard.php    |  23 +-
 app/code/Magento/Paypal/Helper/Checkout.php   |   3 +-
 app/code/Magento/Paypal/Helper/Data.php       |  13 +-
 app/code/Magento/Paypal/Helper/Hss.php        |   7 +-
 .../Magento/Paypal/Model/Api/AbstractApi.php  |  36 +-
 app/code/Magento/Paypal/Model/Api/Nvp.php     | 259 +++++--
 .../Magento/Paypal/Model/Api/PayflowNvp.php   | 146 ++--
 .../Magento/Paypal/Model/Api/Standard.php     |  30 +-
 .../Model/Billing/AbstractAgreement.php       |  15 +-
 .../Paypal/Model/Billing/Agreement.php        |  29 +-
 .../Billing/Agreement/MethodInterface.php     |   3 +-
 .../Model/Billing/Agreement/OrdersUpdater.php |  14 +-
 app/code/Magento/Paypal/Model/Cart.php        |  10 +-
 app/code/Magento/Paypal/Model/Cert.php        |  22 +-
 app/code/Magento/Paypal/Model/Config.php      |  45 +-
 .../Magento/Paypal/Model/Config/Factory.php   |   3 +-
 app/code/Magento/Paypal/Model/Direct.php      | 130 +++-
 app/code/Magento/Paypal/Model/Express.php     | 213 ++++--
 .../Magento/Paypal/Model/Express/Checkout.php | 110 +--
 .../Paypal/Model/Express/Checkout/Factory.php |   3 +-
 app/code/Magento/Paypal/Model/Hostedpro.php   |  45 +-
 .../Paypal/Model/Hostedpro/Request.php        |  12 +-
 app/code/Magento/Paypal/Model/Info.php        |  20 +-
 app/code/Magento/Paypal/Model/Ipn.php         |  56 +-
 .../Magento/Paypal/Model/Method/Agreement.php | 121 +++-
 .../Paypal/Model/Method/ProTypeFactory.php    |   5 +-
 app/code/Magento/Paypal/Model/Observer.php    |  41 +-
 app/code/Magento/Paypal/Model/Payflow/Pro.php |  14 +-
 .../Magento/Paypal/Model/Payflow/Request.php  |  15 +-
 .../Magento/Paypal/Model/PayflowDirect.php    |   9 +-
 .../Magento/Paypal/Model/PayflowExpress.php   |  23 +-
 .../Paypal/Model/PayflowExpress/Checkout.php  |   5 +-
 app/code/Magento/Paypal/Model/Payflowlink.php |  59 +-
 app/code/Magento/Paypal/Model/Payflowpro.php  | 132 +++-
 .../Method/Billing/AbstractAgreement.php      |  27 +-
 .../Paypal/Model/Payment/Transaction.php      |  42 +-
 app/code/Magento/Paypal/Model/Pro.php         |  48 +-
 .../Paypal/Model/Report/Settlement.php        |  18 +-
 .../Paypal/Model/Report/Settlement/Row.php    |  18 +-
 .../Model/Resource/Billing/Agreement.php      |   7 +-
 .../Resource/Billing/Agreement/Collection.php |  39 +-
 .../Magento/Paypal/Model/Resource/Cert.php    |   5 +-
 .../Model/Resource/Payment/Transaction.php    |  14 +-
 .../Payment/Transaction/Collection.php        |  11 +-
 .../Model/Resource/Report/Settlement.php      |   9 +-
 .../Settlement/Options/TransactionEvents.php  |   9 +-
 .../Model/Resource/Report/Settlement/Row.php  |   8 +-
 .../Report/Settlement/Row/Collection.php      |   5 +-
 app/code/Magento/Paypal/Model/Standard.php    |  24 +-
 .../Model/System/Config/Backend/Cert.php      |  15 +-
 .../Model/System/Config/Backend/Cron.php      |  11 +-
 .../System/Config/Backend/MerchantCountry.php |  13 +-
 .../Config/Source/AuthorizationAmounts.php    |   9 +-
 .../System/Config/Source/BuyerCountry.php     |   8 +-
 .../System/Config/Source/FetchingSchedule.php |   8 +-
 .../Model/System/Config/Source/Logo.php       |   7 +-
 .../System/Config/Source/MerchantCountry.php  |   8 +-
 .../System/Config/Source/PaymentActions.php   |   8 +-
 .../Config/Source/PaymentActions/Express.php  |   9 +-
 .../Config/Source/RequireBillingAddress.php   |   9 +-
 .../Model/System/Config/Source/UrlMethod.php  |   9 +-
 app/code/Magento/Paypal/etc/module.xml        |   1 +
 app/code/Magento/Paypal/etc/payment.xml       |   5 +
 app/code/Magento/Paypal/i18n/de_DE.csv        |  10 +-
 app/code/Magento/Paypal/i18n/en_US.csv        |  10 +-
 app/code/Magento/Paypal/i18n/es_ES.csv        |  10 +-
 app/code/Magento/Paypal/i18n/fr_FR.csv        |  10 +-
 app/code/Magento/Paypal/i18n/nl_NL.csv        |  10 +-
 app/code/Magento/Paypal/i18n/pt_BR.csv        |  10 +-
 app/code/Magento/Paypal/i18n/zh_CN.csv        |  10 +-
 .../Magento/Persistent/Model/Observer.php     |   2 +-
 app/code/Magento/Persistent/Model/Session.php |   8 +-
 app/code/Magento/Persistent/i18n/de_DE.csv    |   2 +-
 app/code/Magento/Persistent/i18n/en_US.csv    |   2 +-
 app/code/Magento/Persistent/i18n/es_ES.csv    |   2 +-
 app/code/Magento/Persistent/i18n/fr_FR.csv    |   2 +-
 app/code/Magento/Persistent/i18n/nl_NL.csv    |   2 +-
 app/code/Magento/Persistent/i18n/pt_BR.csv    |   2 +-
 app/code/Magento/Persistent/i18n/zh_CN.csv    |   2 +-
 .../ProductAlert/Block/Product/View.php       |   6 +-
 app/code/Magento/ProductAlert/Helper/Data.php |   8 +-
 app/code/Magento/ProductAlert/Model/Email.php |  43 +-
 .../Magento/ProductAlert/Model/Observer.php   |  35 +-
 app/code/Magento/ProductAlert/Model/Price.php |   8 +-
 app/code/Magento/ProductAlert/Model/Stock.php |   8 +-
 app/code/Magento/ProductAlert/etc/module.xml  |   1 -
 .../Magento/Rating/Block/Adminhtml/Edit.php   |   6 +-
 .../Rating/Block/Adminhtml/Edit/Tab/Form.php  |   4 +-
 .../Block/Adminhtml/Edit/Tab/Options.php      |   4 +-
 .../Rating/Controller/Adminhtml/Index.php     |   6 +-
 app/code/Magento/Rating/Model/Rating.php      |   8 +-
 .../Model/Resource/Rating/Grid/Collection.php |   6 +-
 .../Customer/Edit/Tab/RecurringProfile.php    |  12 +-
 .../Block/Adminhtml/Profile/Grid.php          |  29 +-
 .../Block/Adminhtml/Profile/View.php          |   6 +-
 .../Adminhtml/Profile/View/Getawayinfo.php    |   6 +-
 .../Block/Adminhtml/Profile/View/Info.php     |   6 +-
 .../Adminhtml/Profile/View/Tab/Orders.php     |  25 +-
 .../Block/Catalog/Product/View/Profile.php    |   6 +-
 .../RecurringProfile/Block/Plugin/Payment.php |  61 ++
 .../RecurringProfile/Block/Profile/Grid.php   |   6 +-
 .../Block/Profile/Related/Orders/Grid.php     |  21 +-
 .../RecurringProfile/Block/Profile/View.php   |   6 +-
 .../Block/Profile/View/Address.php            |   4 +-
 .../Block/Profile/View/Fees.php               |   4 +-
 .../Block/Profile/View/Item.php               |   6 +-
 .../Block/Profile/View/Reference.php          |   4 +-
 .../Block/Profile/View/Schedule.php           |   4 +-
 .../Controller/Adminhtml/RecurringProfile.php |   6 +-
 .../RecurringProfile/Controller/Download.php  |  89 +++
 .../Controller/RecurringProfile.php           |  14 +-
 .../Model/Method/PaymentMethodsList.php       |  63 ++
 .../Method/RecurringPaymentSpecification.php  |  47 ++
 .../RecurringProfile/Model/Observer.php       |  57 +-
 .../Observer/PaymentAvailabilityObserver.php  |  69 ++
 .../RecurringProfile/Model/PeriodUnits.php    |   4 +-
 .../RecurringProfile/Model/Profile.php        |   8 +-
 .../RecurringProfile/Model/Quote/Filter.php   |  49 ++
 .../Model/Quote/Total}/AbstractRecurring.php  |   7 +-
 .../Model/Quote/Total}/Initial.php            |   6 +-
 .../Model/Quote/Total}/Trial.php              |   6 +-
 .../RecurringProfile/Model/QuoteImporter.php  |  71 ++
 .../Model/RecurringProfile.php                |   8 +-
 .../Model/Resource/Order/CollectionFilter.php |  51 ++
 .../Magento/RecurringProfile/Model/States.php |   4 +-
 app/code/Magento/RecurringProfile/etc/di.xml  |   3 +
 .../Magento/RecurringProfile/etc/events.xml   |  39 ++
 .../etc/frontend/page_types.xml}              |   9 +-
 .../Magento/RecurringProfile/etc/module.xml   |   1 +
 .../Magento/RecurringProfile/etc/sales.xml    |  33 +
 .../Reports/Block/Product/AbstractProduct.php |   6 +-
 app/code/Magento/Reports/Model/Event.php      |   8 +-
 .../Model/Product/Index/AbstractIndex.php     |   8 +-
 .../Reports/Model/Product/Index/Compared.php  |   8 +-
 .../Model/Resource/Product/Collection.php     |   6 +-
 .../Index/Collection/AbstractCollection.php   |   6 +-
 .../Resource/Product/Lowstock/Collection.php  |   6 +-
 .../Report/Collection/AbstractCollection.php  |  12 +-
 .../Review/Block/Adminhtml/Add/Form.php       |   4 +-
 .../Magento/Review/Block/Adminhtml/Edit.php   |   6 +-
 .../Review/Block/Adminhtml/Edit/Form.php      |   4 +-
 .../Magento/Review/Block/Adminhtml/Grid.php   |   6 +-
 .../Magento/Review/Block/Adminhtml/Main.php   |   6 +-
 .../Block/Adminhtml/Rating/Detailed.php       |   6 +-
 .../Review/Block/Adminhtml/Rating/Summary.php |   6 +-
 .../Magento/Review/Block/Customer/View.php    |   6 +-
 .../Magento/Review/Block/Product/View.php     |   4 +-
 .../Review/Block/Product/View/Other.php       |   7 +-
 app/code/Magento/Review/Block/View.php        |   6 +-
 .../Magento/Review/Controller/Product.php     |   6 +-
 .../Resource/Review/Product/Collection.php    |   6 +-
 app/code/Magento/Review/Model/Review.php      |   8 +-
 .../Magento/Review/Model/Review/Status.php    |   8 +-
 .../Magento/Review/Model/Review/Summary.php   |   8 +-
 app/code/Magento/Review/i18n/de_DE.csv        |   8 +-
 app/code/Magento/Review/i18n/en_US.csv        |   8 +-
 app/code/Magento/Review/i18n/es_ES.csv        |   8 +-
 app/code/Magento/Review/i18n/fr_FR.csv        |   8 +-
 app/code/Magento/Review/i18n/nl_NL.csv        |   8 +-
 app/code/Magento/Review/i18n/pt_BR.csv        |   8 +-
 app/code/Magento/Review/i18n/zh_CN.csv        |   8 +-
 app/code/Magento/Rss/Block/Order/Status.php   |   6 +-
 app/code/Magento/Rss/Block/Wishlist.php       |   6 +-
 app/code/Magento/Rss/Controller/Order.php     |   6 +-
 .../Rss/Model/System/Config/Backend/Links.php |   8 +-
 app/code/Magento/Rss/i18n/de_DE.csv           |   2 +-
 app/code/Magento/Rss/i18n/en_US.csv           |   2 +-
 app/code/Magento/Rss/i18n/es_ES.csv           |   2 +-
 app/code/Magento/Rss/i18n/fr_FR.csv           |   2 +-
 app/code/Magento/Rss/i18n/nl_NL.csv           |   2 +-
 app/code/Magento/Rss/i18n/pt_BR.csv           |   2 +-
 app/code/Magento/Rss/i18n/zh_CN.csv           |   2 +-
 app/code/Magento/Rule/Model/AbstractModel.php |   8 +-
 app/code/Magento/Rule/Model/Rule.php          |   8 +-
 .../Block/Adminhtml/Items/AbstractItems.php   |   6 +-
 .../Block/Adminhtml/Order/AbstractOrder.php   |   6 +-
 .../Sales/Block/Adminhtml/Order/Address.php   |   6 +-
 .../Block/Adminhtml/Order/Address/Form.php    |   6 +-
 .../Block/Adminhtml/Order/Create/Form.php     |   2 +-
 .../Adminhtml/Order/Create/Form/Account.php   |   2 +-
 .../Adminhtml/Order/Create/Form/Address.php   |   4 +-
 .../Order/Create/Giftmessage/Form.php         |   4 +-
 .../Adminhtml/Order/Creditmemo/Create.php     |   6 +-
 .../Order/Creditmemo/Create/Items.php         |   4 +-
 .../Block/Adminhtml/Order/Creditmemo/View.php |   6 +-
 .../Order/Creditmemo/View/Comments.php        |   6 +-
 .../Block/Adminhtml/Order/Invoice/Create.php  |   6 +-
 .../Adminhtml/Order/Invoice/Create/Items.php  |   4 +-
 .../Block/Adminhtml/Order/Invoice/View.php    |   6 +-
 .../Adminhtml/Order/Invoice/View/Comments.php |   6 +-
 .../Adminhtml/Order/Status/Assign/Form.php    |   4 +-
 .../Sales/Block/Adminhtml/Order/View.php      |   6 +-
 .../Adminhtml/Order/View/Giftmessage.php      |   6 +-
 .../Block/Adminhtml/Order/View/History.php    |   8 +-
 .../Sales/Block/Adminhtml/Order/View/Info.php |   4 +-
 .../View/Items/Renderer/DefaultRenderer.php   |   4 +-
 .../Block/Adminhtml/Order/View/Messages.php   |   6 +-
 .../Adminhtml/Order/View/Tab/Creditmemos.php  |   6 +-
 .../Adminhtml/Order/View/Tab/History.php      |   6 +-
 .../Adminhtml/Order/View/Tab/Invoices.php     |   6 +-
 .../Adminhtml/Order/View/Tab/Shipments.php    |   6 +-
 .../Sales/Block/Adminhtml/Order/View/Tabs.php |   6 +-
 .../Block/Adminhtml/Report/Filter/Form.php    |   4 +-
 .../Adminhtml/Report/Filter/Form/Coupon.php   |   4 +-
 .../Magento/Sales/Block/Adminhtml/Totals.php  |   4 +-
 .../Block/Adminhtml/Transactions/Detail.php   |   6 +-
 .../Adminhtml/Transactions/Detail/Grid.php    |   6 +-
 .../Block/Adminhtml/Transactions/Grid.php     |   8 +-
 .../Magento/Sales/Block/Order/Creditmemo.php  |   4 +-
 .../Sales/Block/Order/Creditmemo/Items.php    |   6 +-
 .../Sales/Block/Order/Creditmemo/Totals.php   |   4 +-
 app/code/Magento/Sales/Block/Order/Info.php   |   6 +-
 .../Sales/Block/Order/Info/Buttons.php        |   6 +-
 .../Magento/Sales/Block/Order/Invoice.php     |   4 +-
 .../Sales/Block/Order/Invoice/Items.php       |   6 +-
 .../Sales/Block/Order/Invoice/Totals.php      |   4 +-
 app/code/Magento/Sales/Block/Order/Items.php  |   6 +-
 app/code/Magento/Sales/Block/Order/Link.php   |   6 +-
 .../Block/Order/PrintOrder/Creditmemo.php     |   6 +-
 .../Sales/Block/Order/PrintOrder/Invoice.php  |   6 +-
 .../Sales/Block/Order/PrintOrder/Shipment.php |   6 +-
 .../Sales/Block/Order/PrintShipment.php       |   6 +-
 app/code/Magento/Sales/Block/Order/Totals.php |   6 +-
 app/code/Magento/Sales/Block/Order/View.php   |   6 +-
 .../Sales/Controller/AbstractController.php   |   6 +-
 .../Sales/Controller/Adminhtml/Order.php      |   6 +-
 .../Controller/Adminhtml/Order/Creditmemo.php |   2 +-
 .../Controller/Adminhtml/Order/Invoice.php    |   6 +-
 .../Controller/Adminhtml/Order/Status.php     |   6 +-
 .../Controller/Adminhtml/Transactions.php     |   6 +-
 .../Magento/Sales/Controller/Download.php     | 168 +----
 app/code/Magento/Sales/Helper/Guest.php       |   6 +-
 .../Magento/Sales/Model/AbstractModel.php     |   8 +-
 app/code/Magento/Sales/Model/AdminOrder.php   | 107 ---
 .../Magento/Sales/Model/AdminOrder/Create.php | 620 ++++++++++-------
 .../Magento/Sales/Model/AdminOrder/Random.php | 216 ------
 .../Model/Config/Source/Order/Status.php      |   2 +-
 app/code/Magento/Sales/Model/Download.php     | 127 ++++
 app/code/Magento/Sales/Model/Observer.php     |  24 +-
 .../Model/Observer/Backend/CustomerQuote.php  |  41 +-
 .../Frontend/Quote/Address/CollectTotals.php  |   2 +
 .../Frontend/Quote/Address/VatValidator.php   |   6 +-
 app/code/Magento/Sales/Model/Order.php        | 138 ++--
 .../Magento/Sales/Model/Order/Address.php     |  18 +-
 .../Magento/Sales/Model/Order/Creditmemo.php  | 151 ++--
 .../Sales/Model/Order/Creditmemo/Comment.php  |   8 +-
 .../Sales/Model/Order/Creditmemo/Item.php     |   8 +-
 .../Magento/Sales/Model/Order/Invoice.php     | 152 ++--
 .../Sales/Model/Order/Invoice/Comment.php     |   8 +-
 .../Sales/Model/Order/Invoice/Item.php        |   8 +-
 app/code/Magento/Sales/Model/Order/Item.php   |   8 +-
 .../Magento/Sales/Model/Order/Payment.php     |   8 +-
 .../Sales/Model/Order/Payment/Transaction.php |   8 +-
 .../Model/Order/Pdf/Items/AbstractItems.php   |   8 +-
 .../Items/Creditmemo/DefaultCreditmemo.php    |   8 +-
 .../Pdf/Items/Invoice/DefaultInvoice.php      |  10 +-
 .../Pdf/Items/Shipment/DefaultShipment.php    |   8 +-
 .../Magento/Sales/Model/Order/Shipment.php    | 144 ++--
 .../Sales/Model/Order/Shipment/Comment.php    |   8 +-
 .../Sales/Model/Order/Shipment/Item.php       |   8 +-
 .../Sales/Model/Order/Shipment/Track.php      |   8 +-
 app/code/Magento/Sales/Model/Order/Status.php |   8 +-
 .../Sales/Model/Order/Status/History.php      |   8 +-
 app/code/Magento/Sales/Model/Quote.php        | 437 +++++++-----
 .../Magento/Sales/Model/Quote/Address.php     | 280 +++++---
 app/code/Magento/Sales/Model/Quote/Item.php   |   8 +-
 .../Sales/Model/Quote/Item/AbstractItem.php   |  32 +-
 .../Sales/Model/Resource/Order/Collection.php |  18 +
 .../Resource/Order/Grid/StatusesArray.php     |   2 +-
 .../Sales/Model/Resource/Sale/Collection.php  |  22 +-
 .../Magento/Sales/Model/Service/Quote.php     | 261 ++++++-
 .../Magento/Sales/etc/adminhtml/events.xml    |   2 +-
 app/code/Magento/Sales/etc/fieldset.xml       |  12 +-
 .../Magento/Sales/etc/frontend/page_types.xml |   2 -
 app/code/Magento/Sales/etc/module.xml         |   1 -
 app/code/Magento/Sales/etc/sales.xml          |   2 -
 app/code/Magento/Sales/i18n/de_DE.csv         |  10 +-
 app/code/Magento/Sales/i18n/en_US.csv         |  10 +-
 app/code/Magento/Sales/i18n/es_ES.csv         |  10 +-
 app/code/Magento/Sales/i18n/fr_FR.csv         |  10 +-
 app/code/Magento/Sales/i18n/nl_NL.csv         |  10 +-
 app/code/Magento/Sales/i18n/pt_BR.csv         |  10 +-
 app/code/Magento/Sales/i18n/zh_CN.csv         |  10 +-
 .../Block/Adminhtml/Promo/Quote/Edit.php      |   6 +-
 .../Promo/Quote/Edit/Tab/Actions.php          |   4 +-
 .../Promo/Quote/Edit/Tab/Conditions.php       |   4 +-
 .../Promo/Quote/Edit/Tab/Coupons.php          |   6 +-
 .../Promo/Quote/Edit/Tab/Coupons/Form.php     |   4 +-
 .../Promo/Quote/Edit/Tab/Coupons/Grid.php     |   6 +-
 .../Adminhtml/Promo/Quote/Edit/Tab/Main.php   |   4 +-
 .../Controller/Adminhtml/Promo/Quote.php      |   6 +-
 app/code/Magento/SalesRule/Model/Coupon.php   |   7 +-
 .../SalesRule/Model/Coupon/Massgenerator.php  |   8 +-
 .../SalesRule/Model/Quote/Discount.php        |   1 +
 .../Model/Resource/Rule/Collection.php        |  31 +-
 app/code/Magento/SalesRule/Model/Rule.php     |  17 +-
 .../Rule/Action/Discount/AbstractDiscount.php |  70 ++
 .../Model/Rule/Action/Discount/BuyXGetY.php   |  69 ++
 .../Model/Rule/Action/Discount/ByFixed.php    |  63 ++
 .../Model/Rule/Action/Discount/ByPercent.php  |  94 +++
 .../Action/Discount/CalculatorFactory.php     |  70 ++
 .../Model/Rule/Action/Discount/CartFixed.php  | 128 ++++
 .../Model/Rule/Action/Discount/Data.php       | 134 ++++
 .../Action/Discount/DiscountInterface.php     |  45 ++
 .../Model/Rule/Action/Discount/ToFixed.php    |  59 ++
 .../Model/Rule/Action/Discount/ToPercent.php  |  44 ++
 .../System/Config/Source/Coupon/Format.php    |   2 +-
 .../Magento/SalesRule/Model/Validator.php     | 553 ++++++++-------
 app/code/Magento/SalesRule/i18n/de_DE.csv     |   2 +-
 app/code/Magento/SalesRule/i18n/en_US.csv     |   2 +-
 app/code/Magento/SalesRule/i18n/es_ES.csv     |   2 +-
 app/code/Magento/SalesRule/i18n/fr_FR.csv     |   2 +-
 app/code/Magento/SalesRule/i18n/nl_NL.csv     |   2 +-
 app/code/Magento/SalesRule/i18n/pt_BR.csv     |   2 +-
 app/code/Magento/SalesRule/i18n/zh_CN.csv     |   2 +-
 app/code/Magento/Sendfriend/Block/Send.php    |   6 +-
 .../Magento/Sendfriend/Controller/Product.php |   6 +-
 .../Magento/Sendfriend/Model/Sendfriend.php   |  93 +--
 app/code/Magento/Sendfriend/etc/module.xml    |   1 -
 .../Shipping/Block/Adminhtml/Create.php       |   6 +-
 .../Shipping/Block/Adminhtml/Create/Items.php |   4 +-
 .../Block/Adminhtml/Order/Packaging.php       |   6 +-
 .../Block/Adminhtml/Order/Packaging/Grid.php  |   6 +-
 .../Block/Adminhtml/Order/Tracking.php        |   6 +-
 .../Block/Adminhtml/Order/Tracking/View.php   |   4 +-
 .../Magento/Shipping/Block/Adminhtml/View.php |   6 +-
 .../Block/Adminhtml/View/Comments.php         |   6 +-
 .../Shipping/Block/Adminhtml/View/Form.php    |   4 +-
 app/code/Magento/Shipping/Block/Items.php     |   6 +-
 .../Magento/Shipping/Block/Order/Shipment.php |   6 +-
 .../Magento/Shipping/Block/Tracking/Link.php  |   6 +-
 .../Magento/Shipping/Block/Tracking/Popup.php |   6 +-
 .../Controller/Adminhtml/Order/Shipment.php   |   6 +-
 .../Magento/Shipping/Controller/Tracking.php  |   6 +-
 .../Model/Carrier/AbstractCarrier.php         |   4 +-
 .../Shipping/Model/Carrier/Flatrate.php       |   4 +-
 .../Shipping/Model/Carrier/Freeshipping.php   |   4 +-
 .../Magento/Shipping/Model/Carrier/Pickup.php |   4 +-
 .../Shipping/Model/Carrier/Tablerate.php      |   4 +-
 .../Model/Config/Backend/Tablerate.php        |   8 +-
 .../Model/Config/Source/Allmethods.php        |   2 +-
 .../Config/Source/Allspecificcountries.php    |   2 +-
 .../Shipping/Model/Config/Source/Flatrate.php |   2 +-
 .../Model/Config/Source/Tablerate.php         |   2 +-
 .../Magento/Shipping/Model/Order/Track.php    |   8 +-
 .../Shipping/Model/Source/HandlingAction.php  |   2 +-
 .../Shipping/Model/Source/HandlingType.php    |   2 +-
 .../Magento/Sitemap/Block/Adminhtml/Edit.php  |   6 +-
 .../Sitemap/Block/Adminhtml/Edit/Form.php     |   4 +-
 .../Sitemap/Controller/Adminhtml/Sitemap.php  |   6 +-
 .../Sitemap/Model/Config/Source/Frequency.php |   2 +-
 app/code/Magento/Sitemap/Model/Observer.php   |  48 +-
 app/code/Magento/Sitemap/Model/Sitemap.php    |   8 +-
 .../Source/Product/Image/IncludeImage.php     |   2 +-
 app/code/Magento/Sitemap/etc/module.xml       |   1 -
 .../Magento/Tax/Block/Adminhtml/Rate/Form.php |   4 +-
 .../Magento/Tax/Block/Adminhtml/Rule/Edit.php |   6 +-
 .../Tax/Block/Adminhtml/Rule/Edit/Form.php    |   6 +-
 .../Magento/Tax/Controller/Adminhtml/Rule.php |   6 +-
 app/code/Magento/Tax/Helper/Data.php          |   6 +-
 app/code/Magento/Tax/Model/Calculation.php    |   8 +-
 .../Magento/Tax/Model/Calculation/Rate.php    |   8 +-
 .../Magento/Tax/Model/Calculation/Rule.php    |   8 +-
 app/code/Magento/Tax/Model/ClassModel.php     |   8 +-
 .../Tax/Model/Config/Price/IncludePrice.php   |   8 +-
 .../Tax/Model/Config/Source/Apply/On.php      |   2 +-
 .../Tax/Model/Config/Source/Basedon.php       |   2 +-
 .../Tax/Model/Config/Source/Catalog.php       |   2 +-
 .../Model/Config/Source/TaxClass/Customer.php |   2 +-
 .../Model/Config/Source/TaxClass/Product.php  |   2 +-
 .../Rule/Grid/Options/CustomerTaxClass.php    |   2 +-
 .../Rule/Grid/Options/HashOptimized.php       |   2 +-
 .../Rule/Grid/Options/ProductTaxClass.php     |   2 +-
 .../Model/System/Config/Source/Algorithm.php  |   2 +-
 .../Tax/Model/System/Config/Source/Apply.php  |   2 +-
 .../Model/System/Config/Source/PriceType.php  |   2 +-
 .../System/Config/Source/Tax/Display/Type.php |   2 +-
 .../Model/System/Config/Source/Tax/Region.php |   2 +-
 .../Adminhtml/System/Design/Theme/Edit.php    |   6 +-
 .../System/Design/Theme/Edit/AbstractTab.php  |   6 +-
 .../System/Design/Theme/Edit/Tab/Css.php      |   4 +-
 .../System/Design/Theme/Edit/Tab/General.php  |   4 +-
 .../Adminhtml/System/Design/Theme.php         |   6 +-
 .../Theme/Model/Layout/Source/Layout.php      |   2 +-
 .../Shipping/Carrier/AbstractCarrier.php      |   6 +-
 .../Carrier/AbstractCarrier/Source/Mode.php   |   2 +-
 .../AbstractCarrier/Source/Requesttype.php    |   2 +-
 .../Usa/Model/Shipping/Carrier/Dhl.php        |   6 +-
 .../Shipping/Carrier/Dhl/International.php    |   4 +-
 .../Dhl/International/Source/Contenttype.php  |   2 +-
 .../Shipping/Carrier/Dhl/Source/Generic.php   |   4 +-
 .../Usa/Model/Shipping/Carrier/Fedex.php      |   6 +-
 .../Shipping/Carrier/Fedex/Source/Generic.php |   4 +-
 .../Usa/Model/Shipping/Carrier/Ups.php        |   6 +-
 .../Shipping/Carrier/Ups/Source/Generic.php   |   4 +-
 .../Shipping/Carrier/Ups/Source/Mode.php      |   2 +-
 .../Shipping/Carrier/Ups/Source/Type.php      |   2 +-
 .../Usa/Model/Shipping/Carrier/Usps.php       |   6 +-
 .../Shipping/Carrier/Usps/Source/Generic.php  |   4 +-
 app/code/Magento/User/Block/Buttons.php       |   6 +-
 app/code/Magento/User/Block/Role/Edit.php     |   6 +-
 .../Magento/User/Block/Role/Grid/User.php     |   6 +-
 app/code/Magento/User/Block/Role/Tab/Edit.php |   6 +-
 app/code/Magento/User/Block/User/Edit.php     |   6 +-
 .../Magento/User/Block/User/Edit/Tab/Main.php |   6 +-
 .../User/Block/User/Edit/Tab/Roles.php        |   6 +-
 .../User/Controller/Adminhtml/User.php        |   6 +-
 .../User/Controller/Adminhtml/User/Role.php   |   8 +-
 .../Magento/User/Model/Acl/Loader/Rule.php    |   4 +-
 .../Magento/User/Model/Resource/Rules.php     |   6 +-
 app/code/Magento/User/Model/Role.php          |   8 +-
 app/code/Magento/User/Model/Rules.php         |   8 +-
 app/code/Magento/User/Model/User.php          | 126 ++--
 app/code/Magento/User/etc/di.xml              |   6 +-
 .../User/view/email/password_reset.html       |   2 +-
 .../Activate/Permissions/Tab/Webapi.php       |  10 +-
 .../Adminhtml/Integration/Edit/Tab/Webapi.php |  10 +-
 app/code/Magento/Webapi/Helper/Data.php       |  12 +-
 .../Magento/Weee/Block/Renderer/Weee/Tax.php  |   6 +-
 app/code/Magento/Weee/Helper/Data.php         |   6 +-
 .../Weee/Model/Config/Source/Display.php      |   2 +-
 app/code/Magento/Weee/Model/Observer.php      |   8 +-
 app/code/Magento/Weee/Model/Tax.php           |   8 +-
 .../Weee/view/adminhtml/renderer/tax.phtml    |  17 +-
 .../Widget/Block/Adminhtml/Widget/Form.php    |   4 +-
 .../Block/Adminhtml/Widget/Instance/Edit.php  |   6 +-
 .../Widget/Instance/Edit/Tab/Main.php         |   4 +-
 .../Widget/Instance/Edit/Tab/Settings.php     |   6 +-
 .../Widget/Block/Adminhtml/Widget/Options.php |  12 +-
 .../Widget/Controller/Adminhtml/Widget.php    |   6 +-
 .../Controller/Adminhtml/Widget/Instance.php  |   6 +-
 .../Widget/Instance/Options/ThemeId.php       |   2 +-
 .../Widget/Instance/Options/Types.php         |   2 +-
 .../Magento/Widget/Model/Widget/Instance.php  |  10 +-
 .../Model/Widget/Instance/OptionsFactory.php  |   2 +-
 .../Magento/Wishlist/Block/AbstractBlock.php  |   6 +-
 .../Wishlist/Block/Customer/Wishlist.php      |   4 +-
 .../Block/Customer/Wishlist/Item/Options.php  |   6 +-
 .../Magento/Wishlist/Block/Item/Configure.php |   6 +-
 .../Magento/Wishlist/Block/Share/Wishlist.php |   6 +-
 .../Magento/Wishlist/Controller/Index.php     |  50 +-
 .../Magento/Wishlist/Controller/Shared.php    |   6 +-
 app/code/Magento/Wishlist/Helper/Data.php     |   6 +-
 .../Wishlist/Model/Config/Source/Summary.php  |   2 +-
 app/code/Magento/Wishlist/Model/Item.php      |   8 +-
 app/code/Magento/Wishlist/Model/Observer.php  |   8 +-
 .../Model/Resource/Item/Collection/Grid.php   |   8 +-
 app/code/Magento/Wishlist/Model/Wishlist.php  |  10 +-
 app/code/Magento/Wishlist/etc/module.xml      |   1 -
 app/code/Magento/Wishlist/i18n/de_DE.csv      |   8 +-
 app/code/Magento/Wishlist/i18n/en_US.csv      |   8 +-
 app/code/Magento/Wishlist/i18n/es_ES.csv      |   8 +-
 app/code/Magento/Wishlist/i18n/fr_FR.csv      |   8 +-
 app/code/Magento/Wishlist/i18n/nl_NL.csv      |   8 +-
 app/code/Magento/Wishlist/i18n/pt_BR.csv      |   8 +-
 app/code/Magento/Wishlist/i18n/zh_CN.csv      |   8 +-
 app/etc/di.xml                                |   5 +-
 .../Magento/TestFramework/Db/Mysql.php        |  59 +-
 .../Magento/TestFramework/Helper/Api.php      |   8 +-
 .../Magento/TestFramework/ObjectManager.php   |   2 +-
 .../Backend/App/Router/DefaultRouterTest.php  |  61 +-
 .../System/Design/Edit/Tab/GeneralTest.php    |   2 +-
 .../System/Store/Edit/Form/GroupTest.php      |   8 +-
 .../System/Store/Edit/Form/StoreTest.php      |   8 +-
 .../System/Store/Edit/Form/WebsiteTest.php    |   8 +-
 .../Backend/Block/System/Store/EditTest.php   |   8 +-
 .../Block/System/Variable/EditTest.php        |   2 +-
 .../Magento/Backend/Block/Widget/TabsTest.php |   2 +-
 .../Block/Adminhtml/Product/Edit/TabsTest.php |   2 +-
 .../Block/Adminhtml/Product/EditTest.php      |   2 +-
 .../Adminhtml/Product/Options/AjaxTest.php    |   2 +-
 .../Product/ProductList/CrosssellTest.php     |   2 +-
 .../Block/Product/ProductList/RelatedTest.php |   2 +-
 .../Block/Product/View/OptionsTest.php        |   4 +-
 .../Catalog/Block/Product/ViewTest.php        |   6 +-
 .../Catalog/Controller/CategoryTest.php       |   4 +-
 .../Catalog/Controller/ProductTest.php        |   4 +-
 .../Magento/Catalog/Helper/CategoryTest.php   |   4 +-
 .../Magento/Catalog/Helper/DataTest.php       |  24 +-
 .../Catalog/Helper/Product/FlatTest.php       |  19 +-
 .../Catalog/Helper/Product/ViewTest.php       |   2 +-
 .../Magento/Catalog/Helper/ProductTest.php    |  10 +-
 .../Model/Category/CategoryImageTest.php      |   2 +-
 .../_files/category_without_image.php         |   2 +-
 .../Indexer/Product/Flat/Action/FullTest.php  |  14 +-
 .../Indexer/Product/Flat/Action/RowTest.php   |  40 +-
 .../Indexer/Product/Flat/Action/RowsTest.php  |   4 +-
 .../Indexer/Product/Flat/ProcessorTest.php    |  10 +-
 .../Model/Layer/Filter/CategoryTest.php       |   4 +-
 .../Magento/Catalog/Model/LayerTest.php       |   6 +-
 .../Model/Product/Type/AbstractTest.php       |   2 +-
 .../Catalog/Model/ProductExternalTest.php     |  19 +-
 .../Magento/Catalog/Model/ProductTest.php     |   2 +-
 .../Magento/Catalog/_files/categories.php     |  62 +-
 .../Promo/Catalog/Edit/Tab/MainTest.php       |   2 +-
 .../Magento/Checkout/Controller/CartTest.php  |  50 ++
 .../Magento/Checkout/Model/SessionTest.php    | 151 ++++
 .../Checkout/Model/Type/OnepageTest.php       | 483 ++++++++++++-
 .../Magento/Checkout/_files/cart.php          |  10 +-
 .../quote_with_check_payment_rollback.php     |   2 +-
 .../_files/quote_with_product_and_payment.php |   3 +-
 .../Adminhtml/Page/Edit/Tab/DesignTest.php    |   2 +-
 .../Edit/Tab/Super/Config/MatrixTest.php      |   2 +-
 .../Product/Edit/Tab/Super/ConfigTest.php     |   4 +-
 .../Product/Edit/Tab/Super/SettingsTest.php   |   2 +-
 .../Backend/Grid/ColumnSetTest.php            |   2 +-
 .../Controller/Adminhtml/ProductTest.php      |   2 +-
 .../Collection/AssociatedProductTest.php      |   4 +-
 .../Magento/Core/Model/StoreTest.php          |   6 +-
 .../Magento/Css/PreProcessor/CacheTest.php    |  65 +-
 .../Adminhtml/Edit/Tab/View/AccordionTest.php |   2 +-
 .../Block/Adminhtml/Edit/Tab/ViewTest.php     |   4 +-
 .../Block/Adminhtml/Group/Edit/FormTest.php   |   4 +-
 .../Block/Adminhtml/Group/EditTest.php        |   4 +-
 .../Controller/Adminhtml/IndexTest.php        |   4 +-
 .../Model/Metadata/FormFactoryTest.php        |   1 +
 .../Customer/Model/Metadata/FormTest.php      |   1 +
 .../Service/V1/CustomerAccountServiceTest.php |   4 +-
 .../Service/V1/CustomerAddressServiceTest.php |  18 +-
 .../V1/CustomerMetadataServiceTest.php        |   7 +-
 .../Service/V1/CustomerServiceTest.php        | 144 +++-
 .../Customer/_files/customer_address.php      |   5 +-
 .../_files/customer_two_addresses.php         |   5 +-
 .../Edit/Tab/Downloadable/LinksTest.php       |   4 +-
 .../Edit/Tab/Downloadable/SamplesTest.php     |   4 +-
 .../Attribute/Edit/Main/AbstractTest.php      |   4 +-
 .../Magento/Email/Model/TemplateTest.php      |  74 +-
 .../AssociatedProductsCollectionTest.php      |   2 +-
 .../Model => }/Image/Adapter/ConfigTest.php   |   4 +-
 .../Entity/Eav/Customer/AddressTest.php       |   4 +-
 .../Model/Export/Entity/Eav/CustomerTest.php  |   4 +-
 .../Entity/Eav/Customer/AddressTest.php       |   6 +-
 .../Import/Entity/Eav/CustomerImportTest.php  |   2 +-
 .../Model/Resource/Import/DataTest.php        |   6 +-
 .../Magento/ImportExport/_files/customer.php  |   4 +-
 .../_files/customer_with_addresses.php        |   4 +-
 .../Magento/ImportExport/_files/customers.php |   4 +-
 .../ImportExport/_files/import_data.php       |   4 +-
 .../Magento/Less/PreProcessorTest.php         |  51 +-
 .../Magento_Test/magento_import.less          |   3 -
 .../import_dir/import_in_magento_import.less  |   3 +
 .../Magento_Test/some_dir/magento_import.less |   4 +
 .../{ => some_dir}/magento_import.less        |   0
 .../circular_dependency/import1.less          |   1 +
 .../circular_dependency/import2.less          |   1 +
 .../circular_dependency/import3.less          |   1 +
 .../import_dir/import_in_magento_import.less  |   3 +
 .../frontend/test_pre_process/source.css      |   6 +
 .../test_pre_process/source/source.less       |   2 +-
 .../Less/_files/lib/magento_import.less       |   3 -
 .../import_dir/import_in_magento_import.less  |   3 +
 .../_files/lib/some_dir/magento_import.less   |   4 +
 .../Block/Checkout/Address/SelectTest.php     |  64 ++
 .../Model/Checkout/Type/MultishippingTest.php | 188 +++++
 .../Block/Adminhtml/Queue/Edit/FormTest.php   |  17 +-
 .../Magento/Newsletter/Model/QueueTest.php    | 132 ++--
 .../Block/Billing/Agreement/ViewTest.php      |   2 +-
 .../Payment/Form/Billing/AgreementTest.php    |  65 ++
 .../Method/Billing/AbstractAgreementTest.php  |  94 +++
 .../Billing/Agreement/CollectionTest.php      |  66 ++
 .../Magento/Paypal/Model/VoidTest.php         |   2 +-
 .../Catalog/Product/View/ProfileTest.php      |   4 +-
 .../Block/Profile/ViewTest.php                |   4 +-
 .../Magento/Rss/Block/Order/StatusTest.php    |   2 +-
 .../Block/Adminhtml/Order/Create/FormTest.php |   5 +-
 .../Block/Adminhtml/Order/View/InfoTest.php   |   4 +-
 .../Block/Order/PrintOrder/CreditmemoTest.php |   2 +-
 .../Block/Order/PrintOrder/InvoiceTest.php    |   2 +-
 .../Sales/Model/AdminOrder/CreateTest.php     | 566 ++++++++++++++-
 .../Observer/Backend/CustomerQuoteTest.php    |  73 ++
 .../Magento/Sales/Model/Quote/AddressTest.php | 123 +++-
 .../Magento/Sales/Model/QuoteTest.php         |  68 ++
 .../Resource/Report/Order/CollectionTest.php  |   1 +
 .../Model/Resource/Sale/CollectionTest.php    |  41 ++
 .../Magento/Sales/Model/Service/QuoteTest.php | 349 ++++++++++
 .../_files/invoice_fixture_store_order.php    |  37 +
 .../testsuite/Magento/Sales/_files/order.php  |  20 +-
 .../Sales/_files/order_fixture_store.php      |  64 ++
 .../Sales/_files/order_with_customer.php      |  30 +
 .../Sales/_files/quote_with_customer.php      |  32 +
 .../Promo/Quote/Edit/Tab/MainTest.php         |   2 +-
 .../Model/Resource/Rule/CollectionTest.php    |  65 ++
 .../Magento/SalesRule/_files/coupons.php      |  71 ++
 .../Magento/SalesRule/_files/rules.php        |  88 +++
 .../Tax/Model/Calculation/RuleTest.php        |  10 +-
 .../testsuite/Magento/Tax/Model/ClassTest.php |   8 +-
 .../Tax/Model/Resource/CalculationTest.php    |   4 +-
 .../Magento/Tax/_files/tax_classes.php        |   4 +-
 .../Controller/Adminhtml/Index.php            |  38 +
 .../Design/Theme/Edit/Tab/GeneralTest.php     |   2 +-
 .../User/Block/User/Edit/Tab/MainTest.php     |   6 +-
 .../testsuite/Magento/User/Model/UserTest.php |  17 -
 .../Magento/View/PublicationTest.php          | 145 ++--
 .../Magento/View/RelatedFileTest.php          |   7 -
 .../Magento/Weee/Model/ObserverTest.php       |   4 +-
 .../Widget/Instance/Edit/Tab/MainTest.php     |   2 +-
 .../Adminhtml/Widget/Instance/EditTest.php    |   2 +-
 .../Magento/Wishlist/Block/AbstractTest.php   |   2 +-
 .../Test/Integrity/Library/DependencyTest.php |   2 +-
 .../Integrity/_files/classes/blacklist.txt    |   3 +-
 .../Test/Legacy/_files/obsolete_classes.php   |  33 +-
 .../Legacy/_files/obsolete_config_nodes.php   |   4 +-
 .../Test/Legacy/_files/obsolete_constants.php |  15 +
 .../Test/Legacy/_files/obsolete_methods.php   | 102 ++-
 .../Legacy/_files/obsolete_properties.php     |   4 +-
 .../Php/_files/phpcpd/blacklist/common.txt    |   1 +
 .../Test/Php/_files/whitelist/common.txt      |   2 +-
 .../{Core/Model => App}/AbstractShellTest.php |   9 +-
 .../Model/Directpost/ObserverTest.php         |   4 +-
 .../Authz/Service/AuthorizationV1Test.php     |   2 +-
 .../Model/Config/Backend/BaseurlTest.php      |   4 +-
 .../Model/Config/Backend/EncryptedTest.php    |   2 +-
 .../Model/Config/Backend/SecureTest.php       |   4 +-
 .../Config/Source/Email/TemplateTest.php      |   4 +-
 .../Config/Structure/Element/FieldTest.php    |   2 +-
 .../Bundle/Model/Product/CatalogPriceTest.php |   2 +-
 .../Catalog/Block/Product/ViewTest.php        |   2 +-
 .../Adminhtml/Product/BuilderTest.php         |   2 +-
 .../Helper/Product/Flat/IndexerTest.php       | 132 +++-
 .../Indexer/Product/Flat/Action/RowTest.php   |   6 +-
 .../Flat/Action/Rows/TableDataTest.php        | 170 +++++
 .../Indexer/Product/Flat/Action/RowsTest.php  |   6 +-
 .../Flat/Plugin/IndexerConfigDataTest.php     |  14 +-
 .../Indexer/Product/Flat/ProcessorTest.php    |  49 +-
 .../Model/Indexer/Product/Flat/StateTest.php  |  63 ++
 .../Indexer/Product/Flat/TableDataTest.php    | 114 +++
 .../Catalog/Model/Product/Type/SimpleTest.php |   2 +-
 .../Model/Product/Type/VirtualTest.php        |   2 +-
 .../Magento/Catalog/Model/ProductTest.php     |   4 +-
 .../Model/Resource/Eav/AttributeTest.php      |   6 +-
 .../Resource/Product/Option/ValueTest.php     |   4 +-
 .../Model/Adminhtml/Stock/ItemTest.php        |   4 +-
 .../Checkout/Block/Onepage/PaymentTest.php    |  59 --
 .../Magento/Checkout/Helper/DataTest.php      |  48 +-
 .../Magento/Code/NameBuilderTest.php          |  82 +++
 .../Model/Product/Type/ConfigurableTest.php   |   2 +-
 .../Magento/Core/Helper/StringTest.php        | 108 ---
 .../File/Storage/Directory/DatabaseTest.php   |   8 +-
 .../PreProcessor/Cache/CacheManagerTest.php   | 251 -------
 .../PreProcessor/Cache/Import/CacheTest.php   | 329 +++++++++
 .../Cache/Import/ImportEntityTest.php         |  68 +-
 .../Cache/Import/Map/StorageTest.php          |  10 +
 .../{PluginTest.php => Plugin/LessTest.php}   | 153 ++--
 .../Css/PreProcessor/CompositeTest.php        |  67 +-
 .../Magento/Customer/Model/CustomerTest.php   |  85 ++-
 .../Customer/Model/Metadata/ValidatorTest.php |  11 +-
 .../Service/V1/CustomerAccountServiceTest.php |  32 +-
 .../Service/V1/CustomerAddressServiceTest.php |  15 +-
 .../V1/CustomerMetadataServiceTest.php        |  63 +-
 .../Service/V1/CustomerServiceTest.php        |   2 +-
 .../Customer/Service/V1/Dto/AddressTest.php   |  38 +-
 .../Service/V1/Dto/CustomerBuilderTest.php    |  94 +++
 .../Customer/Service/V1/Dto/CustomerTest.php  |   7 +-
 .../Controller/Varien/Router/StandardTest.php |  22 +-
 .../Model/Resource/Country/CollectionTest.php |   2 -
 .../Downloadable/Model/Product/TypeTest.php   |   2 +-
 .../Sales/Order/Pdf/Items/CreditmemoTest.php  |   6 -
 .../Collection/AbstractCollectionStub.php     |  51 ++
 .../Collection/AbstractCollectionTest.php     | 218 ++++++
 .../Attribute/Option/CollectionTest.php       | 162 +++++
 .../Block/Adminhtml/Template/EditTest.php     |   4 +-
 .../Magento/Email/Model/SenderTest.php        | 116 ----
 .../Magento/Email/Model/TemplateTest.php      |  72 ++
 .../Magento/GoogleAdwords/Helper/DataTest.php |   2 +-
 .../GoogleAdwords/Model/ObserverTest.php      |   2 +-
 .../GoogleShopping/Model/ServiceTest.php      |   2 +-
 .../Composite/Fieldset/GroupedTest.php        |   2 +-
 .../ListAssociatedProductsTest.php            |   2 +-
 .../Controller/Adminhtml/EditTest.php         |   2 +-
 .../Model/Product/Type/GroupedTest.php        |   2 +-
 .../Magento/Image/AdapterFactoryTest.php      |   2 +-
 .../Entity/Eav/Customer/AddressTest.php       |   2 -
 .../Magento/ImportExport/Model/ExportTest.php |   2 +-
 .../Import/Entity/CustomerCompositeTest.php   |   2 +-
 .../Entity/Eav/Customer/AddressTest.php       |   6 +-
 .../Model/Import/Entity/EavAbstractTest.php   |  10 +-
 .../Controller/Adminhtml/IntegrationTest.php  |   4 +-
 .../Mail/Template/TransportBuilderTest.php    |  49 +-
 .../Model/Queue/TransportBuilderTest.php      | 119 ++++
 .../Magento/Newsletter/Model/TemplateTest.php |   4 +-
 .../testsuite/Magento/Ogone/Model/ApiTest.php |   7 +-
 .../Block/Info/ContainerAbstractTest.php      |   2 +-
 .../Payment/Model/Method/BanktransferTest.php |   2 +-
 .../Model/Method/CashondeliveryTest.php       |   2 +-
 .../Controller/Billing/AgreementTest.php      |   4 +-
 .../Billing/Agreement/OrdersUpdaterTest.php   |   4 +-
 .../Block/Product/View/PriceTest.php          |   4 +-
 .../Block/Product/View/StockTest.php          |   4 +-
 .../Block/Plugin/PaymentTest.php              |  71 ++
 .../Block/Profile/GridTest.php                |   2 +-
 .../Block/Profile/Related/Orders/GridTest.php |  17 +-
 .../Block/Profile/View/AddressTest.php        |   2 +-
 .../Block/Profile/View/DataTest.php           |   2 +-
 .../Block/Profile/View/FeesTest.php           |   2 +-
 .../Block/Profile/View/ItemTest.php           |   2 +-
 .../Block/Profile/View/ReferenceTest.php      |   2 +-
 .../Block/Profile/View/ScheduleTest.php       |   2 +-
 .../Controller/RecurringProfileTest.php       |  44 ++
 .../RecurringPaymentSpecificationTest.php     |  67 ++
 .../PaymentAvailabilityObserverTest.php       |  82 +++
 .../RecurringProfile/Model/ObserverTest.php   |  85 ++-
 .../Adminhtml/Order/CreditmemoTest.php        |   4 +-
 .../Sales/Model/AdminOrder/CreateTest.php     | 188 +++++
 .../Observer/Backend/CustomerQuoteTest.php    | 152 ----
 .../Order/Invoice/Total/ShippingTest.php      |  16 +-
 .../Magento/Sales/Model/Order/InvoiceTest.php |   8 +-
 .../Rule/Action/Discount/ByPercentTest.php    | 199 ++++++
 .../Rule/Action/Discount/CartFixedTest.php    | 121 ++++
 .../Rule/Action/Discount/ToPercentTest.php    | 170 +++++
 .../Magento/SalesRule/Model/ValidatorTest.php | 340 +++++++--
 .../Block/Adminhtml/Order/TrackingTest.php    |   2 +-
 .../testsuite/Magento/Stdlib/StringTest.php   |  62 ++
 .../I18n/Code/Dictionary/Writer/CsvTest.php   |  24 +-
 .../Tools/I18n/Code/Parser/Adapter/JsTest.php |   3 +
 .../I18n/Code/Parser/Adapter/PhpTest.php      |   1 +
 .../I18n/Code/Parser/Adapter/XmlTest.php      |   3 +
 .../System/Design/Theme/TabAbstractTest.php   |   2 +-
 .../User/Model/Acl/Loader/RuleTest.php        |   4 +-
 .../testsuite/Magento/User/Model/UserTest.php | 200 +++++-
 .../View/Asset/PreProcessor/CompositeTest.php |  98 +--
 .../View/Layout/File/FileList/FactoryTest.php |  41 +-
 .../Magento/View/Publisher/CssFileTest.php    | 276 ++++++++
 .../View/Publisher/FileAbstractTest.php       | 285 ++++++++
 .../View/Publisher/FileFactoryTest.php        | 125 ++++
 .../Magento/View/Publisher/FileTest.php       | 261 +++++++
 .../testsuite/Magento/View/PublisherTest.php  | 349 ++++++++++
 .../Wishlist/Block/Item/ConfigureTest.php     |   2 +-
 .../Magento/Wishlist/Controller/IndexTest.php |   2 +-
 .../Tools/I18n/Code/Dictionary/Phrase.php     |  49 +-
 .../Tools/I18n/Code/Dictionary/Writer/Csv.php |  19 +
 dev/tools/Magento/Tools/I18n/Code/Factory.php |   3 +-
 .../Code/Parser/Adapter/AbstractAdapter.php   |  18 +-
 .../Tools/I18n/Code/Parser/Contextual.php     |   1 +
 .../app/Magento/Downloader/Controller.php     |   2 +-
 .../Core/Model => lib/Magento}/Acl/Cache.php  |   8 +-
 .../Magento}/Acl/RootResource.php             |   4 +-
 .../Magento/App}/AbstractShell.php            |  13 +-
 lib/Magento/App/TemplateTypesInterface.php    |  49 ++
 .../Magento/Code/NameBuilder.php              |  14 +-
 ...cheManagerFactory.php => CacheFactory.php} |  34 +-
 ...anagerInterface.php => CacheInterface.php} |  17 +-
 .../Css/PreProcessor/Cache/CacheManager.php   | 130 +---
 .../Css/PreProcessor/Cache/Import/Cache.php   | 212 ++++++
 .../Cache/Import/ImportEntity.php             |  82 +--
 .../Cache/Import/ImportEntityFactory.php      |  31 +-
 .../Cache/Import/ImportEntityInterface.php    |  11 +-
 .../PreProcessor/Cache/Import/Map/Storage.php |   9 +
 .../Cache/Plugin/ImportCleaner.php            |  58 ++
 .../Cache/Plugin/InstructionPreProcessor.php  |  61 ++
 .../Cache/{Plugin.php => Plugin/Less.php}     |  59 +-
 lib/Magento/Css/PreProcessor/Composite.php    |  17 +-
 lib/Magento/Css/PreProcessor/Less.php         | 102 +--
 lib/Magento/Css/PreProcessor/UrlResolver.php  | 164 +++++
 lib/Magento/Data/Collection.php               |   4 +-
 .../Magento/Filter/Input.php                  |  15 +-
 .../Magento/Filter/Input}/MaliciousCode.php   |   2 +-
 .../Magento}/Image/Adapter/Config.php         |   4 +-
 lib/Magento/Less/File/Source/Library.php      |   2 +-
 lib/Magento/Less/PreProcessor.php             | 138 ++--
 .../Less/PreProcessor/File/FileList.php       | 153 ++++
 .../PreProcessor/File/FileListFactory.php     |  77 +++
 lib/Magento/Less/PreProcessor/File/Less.php   | 201 ++++++
 .../Less/PreProcessor/File/LessFactory.php    |  77 +++
 .../Less/PreProcessor/Instruction/Import.php  |  65 +-
 .../Instruction/MagentoImport.php             |  44 +-
 .../Less/PreProcessor/InstructionFactory.php  |  11 +-
 lib/Magento/Less/PreProcessorInterface.php    |   5 +-
 .../Log => lib/Magento/Logger}/Adapter.php    |  15 +-
 .../Magento/Mail/Exception.php                |   7 +-
 lib/Magento/Mail/Message.php                  |  45 +-
 lib/Magento/Mail/MessageInterface.php         |  31 -
 lib/Magento/Mail/Template/Factory.php         |  60 ++
 .../Mail/Template/FactoryInterface.php        |   2 +-
 .../Mail/Template/SenderResolverInterface.php |  38 +
 .../Mail/Template/TransportBuilder.php        | 117 +++-
 .../Mail/{Template => }/TemplateInterface.php |  21 +-
 lib/Magento/Mail/Transport.php                |  29 +-
 lib/Magento/Mail/TransportInterface.php       |   4 +-
 .../Model => lib/Magento/Math}/Calculator.php |  28 +-
 .../Core => lib/Magento}/Model/Context.php    |   2 +-
 .../Magento}/Option/ArrayInterface.php        |   5 +-
 .../Magento}/Option/ArrayPool.php             |  10 +-
 lib/Magento/Pear.php                          |  24 +-
 .../Core/Model => lib/Magento}/Registry.php   |   4 +-
 lib/Magento/Service/Entity/AbstractDto.php    |   3 +-
 .../Service/Entity/AbstractDtoBuilder.php     |  28 +-
 .../View/Asset/PreProcessor/Composite.php     |  16 +-
 .../PreProcessor/PreProcessorInterface.php    |  10 +-
 lib/Magento/View/FileSystem.php               |  34 +-
 .../View/Layout/File/FileList/Factory.php     |  14 +-
 lib/Magento/View/Publisher.php                | 374 ++--------
 lib/Magento/View/Publisher/CssFile.php        |  64 ++
 lib/Magento/View/Publisher/File.php           |  68 ++
 lib/Magento/View/Publisher/FileAbstract.php   | 345 ++++++++++
 lib/Magento/View/Publisher/FileFactory.php    | 107 +++
 lib/Magento/View/Publisher/FileInterface.php  |  89 +++
 lib/Magento/View/RelatedFile.php              |  43 +-
 lib/Magento/View/Url/CssResolver.php          |   4 +-
 lib/googlecheckout/googlerequest.php          |   6 +-
 1559 files changed, 22945 insertions(+), 11474 deletions(-)
 rename app/code/Magento/Bundle/view/adminhtml/layout/{sales_order_shipment_new.xml => adminhtml_order_shipment_new.xml} (100%)
 rename app/code/Magento/Bundle/view/adminhtml/layout/{sales_order_shipment_view.xml => adminhtml_order_shipment_view.xml} (100%)
 delete mode 100644 app/code/Magento/Catalog/Helper/Flat/AbstractFlat.php
 delete mode 100644 app/code/Magento/Catalog/Helper/Product/Flat.php
 create mode 100644 app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows/TableData.php
 create mode 100644 app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php
 create mode 100644 app/code/Magento/Catalog/Model/Indexer/Product/Flat/State.php
 create mode 100644 app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php
 create mode 100644 app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableData.php
 create mode 100644 app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableDataInterface.php
 create mode 100644 app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action/UrlBuilder.php
 create mode 100644 app/code/Magento/Cms/etc/adminhtml/di.xml
 create mode 100644 app/code/Magento/Customer/Model/Address/Converter.php
 delete mode 100644 app/code/Magento/Email/Model/Info.php
 delete mode 100644 app/code/Magento/Email/Model/Sender.php
 delete mode 100644 app/code/Magento/Email/Model/Template/Mailer.php
 create mode 100644 app/code/Magento/Email/Model/Template/SenderResolver.php
 create mode 100644 app/code/Magento/Newsletter/Model/Queue/TransportBuilder.php
 create mode 100644 app/code/Magento/RecurringProfile/Block/Plugin/Payment.php
 create mode 100644 app/code/Magento/RecurringProfile/Controller/Download.php
 create mode 100644 app/code/Magento/RecurringProfile/Model/Method/PaymentMethodsList.php
 create mode 100644 app/code/Magento/RecurringProfile/Model/Method/RecurringPaymentSpecification.php
 create mode 100644 app/code/Magento/RecurringProfile/Model/Observer/PaymentAvailabilityObserver.php
 create mode 100644 app/code/Magento/RecurringProfile/Model/Quote/Filter.php
 rename app/code/Magento/{Sales/Model/Quote/Address/Total/Nominal => RecurringProfile/Model/Quote/Total}/AbstractRecurring.php (94%)
 rename app/code/Magento/{Sales/Model/Quote/Address/Total/Nominal/Recurring => RecurringProfile/Model/Quote/Total}/Initial.php (86%)
 rename app/code/Magento/{Sales/Model/Quote/Address/Total/Nominal/Recurring => RecurringProfile/Model/Quote/Total}/Trial.php (89%)
 create mode 100644 app/code/Magento/RecurringProfile/Model/QuoteImporter.php
 create mode 100644 app/code/Magento/RecurringProfile/Model/Resource/Order/CollectionFilter.php
 create mode 100644 app/code/Magento/RecurringProfile/etc/events.xml
 rename app/code/Magento/{Cms/etc/events.xml => RecurringProfile/etc/frontend/page_types.xml} (83%)
 create mode 100644 app/code/Magento/RecurringProfile/etc/sales.xml
 delete mode 100644 app/code/Magento/Sales/Model/AdminOrder.php
 delete mode 100644 app/code/Magento/Sales/Model/AdminOrder/Random.php
 create mode 100644 app/code/Magento/Sales/Model/Download.php
 create mode 100644 app/code/Magento/SalesRule/Model/Rule/Action/Discount/AbstractDiscount.php
 create mode 100644 app/code/Magento/SalesRule/Model/Rule/Action/Discount/BuyXGetY.php
 create mode 100644 app/code/Magento/SalesRule/Model/Rule/Action/Discount/ByFixed.php
 create mode 100644 app/code/Magento/SalesRule/Model/Rule/Action/Discount/ByPercent.php
 create mode 100644 app/code/Magento/SalesRule/Model/Rule/Action/Discount/CalculatorFactory.php
 create mode 100644 app/code/Magento/SalesRule/Model/Rule/Action/Discount/CartFixed.php
 create mode 100644 app/code/Magento/SalesRule/Model/Rule/Action/Discount/Data.php
 create mode 100644 app/code/Magento/SalesRule/Model/Rule/Action/Discount/DiscountInterface.php
 create mode 100644 app/code/Magento/SalesRule/Model/Rule/Action/Discount/ToFixed.php
 create mode 100644 app/code/Magento/SalesRule/Model/Rule/Action/Discount/ToPercent.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php
 rename dev/tests/integration/testsuite/Magento/{Core/Model => }/Image/Adapter/ConfigTest.php (91%)
 delete mode 100644 dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test/magento_import.less
 create mode 100644 dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test/some_dir/import_dir/import_in_magento_import.less
 create mode 100644 dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test/some_dir/magento_import.less
 rename dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test2/{ => some_dir}/magento_import.less (100%)
 create mode 100644 dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/circular_dependency/import1.less
 create mode 100644 dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/circular_dependency/import2.less
 create mode 100644 dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/circular_dependency/import3.less
 create mode 100644 dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/some_dir/import_dir/import_in_magento_import.less
 delete mode 100644 dev/tests/integration/testsuite/Magento/Less/_files/lib/magento_import.less
 create mode 100644 dev/tests/integration/testsuite/Magento/Less/_files/lib/some_dir/import_dir/import_in_magento_import.less
 create mode 100644 dev/tests/integration/testsuite/Magento/Less/_files/lib/some_dir/magento_import.less
 create mode 100644 dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/Address/SelectTest.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Multishipping/Model/Checkout/Type/MultishippingTest.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Paypal/Block/Payment/Form/Billing/AgreementTest.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreementTest.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Paypal/Model/Resource/Billing/Agreement/CollectionTest.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Sales/Model/Observer/Backend/CustomerQuoteTest.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Sales/Model/Resource/Sale/CollectionTest.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Sales/Model/Service/QuoteTest.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/order_with_customer.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_customer.php
 create mode 100644 dev/tests/integration/testsuite/Magento/SalesRule/Model/Resource/Rule/CollectionTest.php
 create mode 100644 dev/tests/integration/testsuite/Magento/SalesRule/_files/coupons.php
 create mode 100644 dev/tests/integration/testsuite/Magento/SalesRule/_files/rules.php
 create mode 100644 dev/tests/integration/testsuite/Magento/TestFixture/Controller/Adminhtml/Index.php
 rename dev/tests/unit/testsuite/Magento/{Core/Model => App}/AbstractShellTest.php (91%)
 create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows/TableDataTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/StateTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/TableDataTest.php
 delete mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/PaymentTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/Code/NameBuilderTest.php
 delete mode 100644 dev/tests/unit/testsuite/Magento/Core/Helper/StringTest.php
 delete mode 100644 dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/CacheManagerTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Import/CacheTest.php
 rename dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/{PluginTest.php => Plugin/LessTest.php} (56%)
 create mode 100644 dev/tests/unit/testsuite/Magento/Customer/Service/V1/Dto/CustomerBuilderTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Collection/AbstractCollectionStub.php
 create mode 100644 dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Collection/AbstractCollectionTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php
 delete mode 100644 dev/tests/unit/testsuite/Magento/Email/Model/SenderTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/Email/Model/TemplateTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/Newsletter/Model/Queue/TransportBuilderTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Plugin/PaymentTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/RecurringProfile/Controller/RecurringProfileTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/RecurringProfile/Model/Method/RecurringPaymentSpecificationTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/RecurringProfile/Model/Observer/PaymentAvailabilityObserverTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
 delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Backend/CustomerQuoteTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/ByPercentTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/CartFixedTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/ToPercentTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/View/Publisher/CssFileTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/View/Publisher/FileAbstractTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/View/Publisher/FileFactoryTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/View/Publisher/FileTest.php
 create mode 100644 dev/tests/unit/testsuite/Magento/View/PublisherTest.php
 rename {app/code/Magento/Core/Model => lib/Magento}/Acl/Cache.php (92%)
 rename {app/code/Magento/Core/Model => lib/Magento}/Acl/RootResource.php (97%)
 rename {app/code/Magento/Core/Model => lib/Magento/App}/AbstractShell.php (95%)
 create mode 100644 lib/Magento/App/TemplateTypesInterface.php
 rename app/code/Magento/Core/Helper/String.php => lib/Magento/Code/NameBuilder.php (87%)
 rename lib/Magento/Css/PreProcessor/Cache/{CacheManagerFactory.php => CacheFactory.php} (65%)
 rename lib/Magento/Css/PreProcessor/Cache/{CacheManagerInterface.php => CacheInterface.php} (76%)
 create mode 100644 lib/Magento/Css/PreProcessor/Cache/Import/Cache.php
 create mode 100644 lib/Magento/Css/PreProcessor/Cache/Plugin/ImportCleaner.php
 create mode 100644 lib/Magento/Css/PreProcessor/Cache/Plugin/InstructionPreProcessor.php
 rename lib/Magento/Css/PreProcessor/Cache/{Plugin.php => Plugin/Less.php} (58%)
 create mode 100644 lib/Magento/Css/PreProcessor/UrlResolver.php
 rename app/code/Magento/Core/Model/Input/Filter.php => lib/Magento/Filter/Input.php (95%)
 rename {app/code/Magento/Core/Model/Input/Filter => lib/Magento/Filter/Input}/MaliciousCode.php (98%)
 rename {app/code/Magento/Core/Model => lib/Magento}/Image/Adapter/Config.php (97%)
 create mode 100644 lib/Magento/Less/PreProcessor/File/FileList.php
 create mode 100644 lib/Magento/Less/PreProcessor/File/FileListFactory.php
 create mode 100644 lib/Magento/Less/PreProcessor/File/Less.php
 create mode 100644 lib/Magento/Less/PreProcessor/File/LessFactory.php
 rename {app/code/Magento/Core/Model/Log => lib/Magento/Logger}/Adapter.php (93%)
 rename app/code/Magento/Email/Model/Transport.php => lib/Magento/Mail/Exception.php (86%)
 create mode 100644 lib/Magento/Mail/Template/Factory.php
 create mode 100644 lib/Magento/Mail/Template/SenderResolverInterface.php
 rename lib/Magento/Mail/{Template => }/TemplateInterface.php (81%)
 rename {app/code/Magento/Core/Model => lib/Magento/Math}/Calculator.php (73%)
 rename {app/code/Magento/Core => lib/Magento}/Model/Context.php (98%)
 rename {app/code/Magento/Core/Model => lib/Magento}/Option/ArrayInterface.php (96%)
 rename {app/code/Magento/Core/Model => lib/Magento}/Option/ArrayPool.php (82%)
 rename {app/code/Magento/Core/Model => lib/Magento}/Registry.php (96%)
 create mode 100644 lib/Magento/View/Publisher/CssFile.php
 create mode 100644 lib/Magento/View/Publisher/File.php
 create mode 100644 lib/Magento/View/Publisher/FileAbstract.php
 create mode 100644 lib/Magento/View/Publisher/FileFactory.php
 create mode 100644 lib/Magento/View/Publisher/FileInterface.php

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9de4035df58..80e7697127d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,30 @@
+2.0.0.0-dev67
+=============
+* GitHub requests:
+  * [#235](https://github.com/magento/magento2/issues/235) -- Translation escaping
+  * [#463](https://github.com/magento/magento2/pull/463) -- allow _resolveArguments to do sequential lookups
+* Fixed bugs:
+  * Fixed an issue where nonexistent store views flat tables cleanuper dropped the catalog_category_flat_cl table
+  * Fixed an issue where the Product Flat Data indexer used the helpers logic instead of the Flat State logic
+  * Fixed an issue where an exception was thrown when applying a coupon code
+  * Fixed an issue where a Shopping Cart Price Rule was applied to the wrong products
+  * Fixed an issue with the broken Related Orders link on the Recurring Profile page
+  * Fixed an issue with CMS pages preview not working
+  * Fixed an issue with a sales report for a store view returning wrong result
+  * Fixed an issue where shipping did not work for orders containing only bundle products
+  * Fixed an issue where a custom not found page action did not work
+  * Fixed an issue where user configuration for a shopping cart rule to stop further rules processing was ignored
+* Modularity improvements:
+  * Resolved dependencies of the Sales module on the RecurringProfile module
+  * Resolved dependencies of the Email Templates functionality on application modules
+  * Lib-only dependent components of the Core module moved to library
+  * CSS URL resolving logic moved from the publisher to a separate CSS pre-processor
+  * Refactored the View publisher
+* Customer Service usage:
+  * Refactored the Sales module to use Customer service layer
+  * Refactored the Checkout module to use Customer service layer
+* Updated various PHPDoc with the parameter and return types
+
 2.0.0.0-dev66
 =============
 * GitHub requests:
@@ -17,8 +44,8 @@
   * Moved the Billing Agreements functionality to the PayPal module
   * Finalized the work on resolving dependencies between the Multishipping module, and all other modules. Module can be removed without any impact on the system
 * Customer Service usage:
- * Updated Customer Group Grid to use Customer Service for data retrieving and filtering
- * Updated CustomerMetadataService::getAttributeMetadata to throw an exception if invalid code is provided
+  * Updated Customer Group Grid to use Customer Service for data retrieving and filtering
+  * Updated CustomerMetadataService::getAttributeMetadata to throw an exception if invalid code is provided
 * Unified the format of specifying arguments for class constructors in DI and in Layout configuration:
   * A common xsd schema is being used for defining simple types. Layout and DI customize common types with their specific ones
   * Argument processing is unified, and moved to library
@@ -50,9 +77,12 @@
  * [#319] (https://github.com/magento/magento2/issues/319) No message was displayed when product added to shopping cart.
  * [#367] (https://github.com/magento/magento2/issues/367) Improve the error message from the contact form
  * [#469] (https://github.com/magento/magento2/issues/469) Can't change prices on different websites for custom options
-* Updated the Customer service exception handling, and added tests
-* Added usage of the Customer service to the Customer module, replacing some direct usage of the Customer model
-* Updated various PHPDoc with the parameter and return types
+ * [#484] (https://github.com/magento/magento2/pull/484) Calling clear / removeAllItems / removeItemByKey on Magento\Eav\Model\Entity\Collection\AbstractCollection does not remove model from protected _itemsById array
+ * [#474] (https://github.com/magento/magento2/pull/474) Change for Options Collection class
+ * [#483] (https://github.com/magento/magento2/pull/483) Update Category.php
+* Update Customer Service Exception handling and add tests
+* Add usage of Customer Service to Customer Module, replacing some direct usage of Customer Model
+* Updated various PHPDoc with parameter and return types
 
 2.0.0.0-dev64
 =============
diff --git a/app/code/Magento/AdminNotification/Model/Config/Source/Frequency.php b/app/code/Magento/AdminNotification/Model/Config/Source/Frequency.php
index 88c6cb31ee8..9e2b9c268d9 100644
--- a/app/code/Magento/AdminNotification/Model/Config/Source/Frequency.php
+++ b/app/code/Magento/AdminNotification/Model/Config/Source/Frequency.php
@@ -32,7 +32,7 @@ namespace Magento\AdminNotification\Model\Config\Source;
  * @package    Magento_AdminNotification
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-class Frequency implements \Magento\Core\Model\Option\ArrayInterface
+class Frequency implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/AdminNotification/Model/Feed.php b/app/code/Magento/AdminNotification/Model/Feed.php
index 89b351fe4f0..0e99af975a3 100644
--- a/app/code/Magento/AdminNotification/Model/Feed.php
+++ b/app/code/Magento/AdminNotification/Model/Feed.php
@@ -57,8 +57,8 @@ class Feed extends \Magento\Core\Model\AbstractModel
     protected $_inboxFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Backend\App\ConfigInterface $backendConfig
      * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -66,8 +66,8 @@ class Feed extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Backend\App\ConfigInterface $backendConfig,
         \Magento\AdminNotification\Model\InboxFactory $inboxFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Authorizenet/Block/Directpost/Iframe.php b/app/code/Magento/Authorizenet/Block/Directpost/Iframe.php
index 17b6b1540db..001d9d8bb6a 100644
--- a/app/code/Magento/Authorizenet/Block/Directpost/Iframe.php
+++ b/app/code/Magento/Authorizenet/Block/Directpost/Iframe.php
@@ -38,18 +38,18 @@ class Iframe extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php
index a9994d45ae2..4b8ea95ba96 100644
--- a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php
+++ b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php
@@ -31,19 +31,19 @@ class Payment
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
      * @param \Magento\Catalog\Helper\Product $productHelper
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
         \Magento\Catalog\Helper\Product $productHelper,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context, $productHelper);
diff --git a/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php b/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php
index d563f7c4bbd..1dfcd5c9052 100644
--- a/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php
+++ b/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php
@@ -35,17 +35,17 @@ class Payment extends \Magento\App\Action\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Authorizenet/Model/Authorizenet.php b/app/code/Magento/Authorizenet/Model/Authorizenet.php
index cf9d760eb61..25dd3b95184 100644
--- a/app/code/Magento/Authorizenet/Model/Authorizenet.php
+++ b/app/code/Magento/Authorizenet/Model/Authorizenet.php
@@ -245,7 +245,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Logger $logger
      * @param \Magento\Module\ModuleListInterface $moduleList
      * @param \Magento\Core\Model\LocaleInterface $locale
@@ -257,14 +257,14 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc
      * @param \Magento\Session\SessionManagerInterface $session
      * @param \Magento\Authorizenet\Helper\Data $authorizenetData
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Logger $logger,
         \Magento\Module\ModuleListInterface $moduleList,
         \Magento\Core\Model\LocaleInterface $locale,
diff --git a/app/code/Magento/Authorizenet/Model/Authorizenet/Source/PaymentAction.php b/app/code/Magento/Authorizenet/Model/Authorizenet/Source/PaymentAction.php
index 76c21f7be48..3314eeef73e 100644
--- a/app/code/Magento/Authorizenet/Model/Authorizenet/Source/PaymentAction.php
+++ b/app/code/Magento/Authorizenet/Model/Authorizenet/Source/PaymentAction.php
@@ -31,7 +31,7 @@ namespace Magento\Authorizenet\Model\Authorizenet\Source;
  *
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-class PaymentAction implements \Magento\Core\Model\Option\ArrayInterface
+class PaymentAction implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Authorizenet/Model/Directpost.php b/app/code/Magento/Authorizenet/Model/Directpost.php
index 42bf804b6aa..a5e807c840b 100644
--- a/app/code/Magento/Authorizenet/Model/Directpost.php
+++ b/app/code/Magento/Authorizenet/Model/Directpost.php
@@ -84,7 +84,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Logger $logger
      * @param \Magento\Module\ModuleListInterface $moduleList
      * @param \Magento\Core\Model\LocaleInterface $locale
@@ -108,7 +108,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Logger $logger,
         \Magento\Module\ModuleListInterface $moduleList,
         \Magento\Core\Model\LocaleInterface $locale,
diff --git a/app/code/Magento/Authorizenet/Model/Directpost/Observer.php b/app/code/Magento/Authorizenet/Model/Directpost/Observer.php
index 208d052a0fd..72ac7ec31dd 100644
--- a/app/code/Magento/Authorizenet/Model/Directpost/Observer.php
+++ b/app/code/Magento/Authorizenet/Model/Directpost/Observer.php
@@ -35,10 +35,10 @@ class Observer
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
-    
+
     /**
      * Core helper
      *
@@ -71,7 +71,7 @@ class Observer
     /**
      * @param \Magento\Authorizenet\Helper\Data $authorizenetData
      * @param \Magento\Core\Helper\Data $coreData
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Authorizenet\Model\Directpost $payment
      * @param \Magento\Authorizenet\Model\Directpost\Session $session
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -79,7 +79,7 @@ class Observer
     public function __construct(
         \Magento\Authorizenet\Helper\Data $authorizenetData,
         \Magento\Core\Helper\Data $coreData,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Authorizenet\Model\Directpost $payment,
         \Magento\Authorizenet\Model\Directpost\Session $session,
         \Magento\Core\Model\StoreManagerInterface $storeManager
diff --git a/app/code/Magento/Authorizenet/i18n/de_DE.csv b/app/code/Magento/Authorizenet/i18n/de_DE.csv
index 67ff79e8b55..f38994b8eec 100644
--- a/app/code/Magento/Authorizenet/i18n/de_DE.csv
+++ b/app/code/Magento/Authorizenet/i18n/de_DE.csv
@@ -57,7 +57,7 @@
 "Payment canceling error.","Fehler bei Zahlungsabbruch."
 "Payment capturing error.","Fehler bei Zahlungserfassung."
 "Payment error. Order was not found.","Zahlungsfehler. Bestellung konnte nicht gefunden werden."
-"Payment error. Paid amount doesn\'t match the order amount.","Zahlungsfehler. Gezahlter Betrag entspricht nicht dem Rechnungsbetrag."
+"Payment error. Paid amount doesn't match the order amount.","Zahlungsfehler. Gezahlter Betrag entspricht nicht dem Rechnungsbetrag."
 "Payment from Applicable Countries","Bezahlung aus den entsprechenden Ländern"
 "Payment from Applicable Countries","Zahlung aus geeigneten Ländern"
 "Payment from Specific Countries","Zahlung  aus spezifischen Ländern"
diff --git a/app/code/Magento/Authorizenet/i18n/en_US.csv b/app/code/Magento/Authorizenet/i18n/en_US.csv
index a9125d4bedd..1a3d5e3762a 100644
--- a/app/code/Magento/Authorizenet/i18n/en_US.csv
+++ b/app/code/Magento/Authorizenet/i18n/en_US.csv
@@ -47,7 +47,7 @@
 "Payment canceling error.","Payment canceling error."
 "Payment capturing error.","Payment capturing error."
 "Payment error. Order was not found.","Payment error. Order was not found."
-"Payment error. Paid amount doesn\'t match the order amount.","Payment error. Paid amount doesn\'t match the order amount."
+"Payment error. Paid amount doesn't match the order amount.","Payment error. Paid amount doesn't match the order amount."
 "Payment from Applicable Countries","Payment from Applicable Countries"
 "Payment from Specific Countries","Payment from Specific Countries"
 "Payment partial authorization error.","Payment partial authorization error."
diff --git a/app/code/Magento/Authorizenet/i18n/es_ES.csv b/app/code/Magento/Authorizenet/i18n/es_ES.csv
index efd2121126e..9d3e547329d 100644
--- a/app/code/Magento/Authorizenet/i18n/es_ES.csv
+++ b/app/code/Magento/Authorizenet/i18n/es_ES.csv
@@ -58,7 +58,7 @@
 "Payment canceling error.","Error en el pago de cancelación."
 "Payment capturing error.","Error en el pago de retención."
 "Payment error. Order was not found.","Error de pago. No se encontró el pedido."
-"Payment error. Paid amount doesn\'t match the order amount.","Error de pago. El importe pagado no coincide con el importe del pedido."
+"Payment error. Paid amount doesn't match the order amount.","Error de pago. El importe pagado no coincide con el importe del pedido."
 "Payment from Applicable Countries","Pago desde países aceptados"
 "Payment from Applicable Countries","Pago desde países aplicables"
 "Payment from Specific Countries","Pago desde países específicos"
diff --git a/app/code/Magento/Authorizenet/i18n/fr_FR.csv b/app/code/Magento/Authorizenet/i18n/fr_FR.csv
index f5d73e48bde..27f8c38ee27 100644
--- a/app/code/Magento/Authorizenet/i18n/fr_FR.csv
+++ b/app/code/Magento/Authorizenet/i18n/fr_FR.csv
@@ -57,7 +57,7 @@
 "Payment canceling error.","Erreur dans l'annulation du paiement."
 "Payment capturing error.","Erreur lors de la saisie du paiement"
 "Payment error. Order was not found.","Erreur de paiement. La commande n'a pas été trouvée."
-"Payment error. Paid amount doesn\'t match the order amount.","Erreur de paiement. Le montant payé ne correspond pas au montant de la commande."
+"Payment error. Paid amount doesn't match the order amount.","Erreur de paiement. Le montant payé ne correspond pas au montant de la commande."
 "Payment from Applicable Countries","Paiement depuis les pays applicables"
 "Payment from Applicable Countries","Paiement depuis les pays disponibles."
 "Payment from Specific Countries","Paiement depuis les pays spécifiques"
diff --git a/app/code/Magento/Authorizenet/i18n/nl_NL.csv b/app/code/Magento/Authorizenet/i18n/nl_NL.csv
index f0317f80d31..ab578fc138a 100644
--- a/app/code/Magento/Authorizenet/i18n/nl_NL.csv
+++ b/app/code/Magento/Authorizenet/i18n/nl_NL.csv
@@ -59,7 +59,7 @@
 "Payment canceling error.","Probleem met het annuleren van de betaling."
 "Payment capturing error.","Fout in het ophalen van de betaling."
 "Payment error. Order was not found.","Betalingsfout. Bestelling is niet gevonden."
-"Payment error. Paid amount doesn\'t match the order amount.","Betalingsfout. Betaalde bedrag is niet hetzelfde als bedrag van bestelling."
+"Payment error. Paid amount doesn't match the order amount.","Betalingsfout. Betaalde bedrag is niet hetzelfde als bedrag van bestelling."
 "Payment from Applicable Countries","Betaling vanuit toegestane landen"
 "Payment from Applicable Countries","Betaling van Geëigende Landen"
 "Payment from Specific Countries","Betaling van Specifieke Landen"
diff --git a/app/code/Magento/Authorizenet/i18n/pt_BR.csv b/app/code/Magento/Authorizenet/i18n/pt_BR.csv
index b659f4fb655..94cbdd747e3 100644
--- a/app/code/Magento/Authorizenet/i18n/pt_BR.csv
+++ b/app/code/Magento/Authorizenet/i18n/pt_BR.csv
@@ -47,7 +47,7 @@
 "Payment canceling error.","Erro de cancelamento de pagamento."
 "Payment capturing error.","Erro de captura de pagamento."
 "Payment error. Order was not found.","Erro de pagamento. Ordem não foi encontrada."
-"Payment error. Paid amount doesn\'t match the order amount.","Erro de pagamento. Valor pago não corresponde ao valor da ordem."
+"Payment error. Paid amount doesn't match the order amount.","Erro de pagamento. Valor pago não corresponde ao valor da ordem."
 "Payment from Applicable Countries","Pagamento de Países Aplicáveis"
 "Payment from Specific Countries","Pagamento de Países Específicos"
 "Payment partial authorization error.","Erro de autorização de pagamento parcial."
diff --git a/app/code/Magento/Authorizenet/i18n/zh_CN.csv b/app/code/Magento/Authorizenet/i18n/zh_CN.csv
index 3de95843437..5fb0d1927db 100644
--- a/app/code/Magento/Authorizenet/i18n/zh_CN.csv
+++ b/app/code/Magento/Authorizenet/i18n/zh_CN.csv
@@ -47,7 +47,7 @@
 "Payment canceling error.","取消支付过程出错。"
 "Payment capturing error.","支付捕获出错。"
 "Payment error. Order was not found.","支付出错,订单未找到。"
-"Payment error. Paid amount doesn\'t match the order amount.","支付错误。付款金额与订单金额不匹配。"
+"Payment error. Paid amount doesn't match the order amount.","支付错误。付款金额与订单金额不匹配。"
 "Payment from Applicable Countries","从可接受的国家支付"
 "Payment from Specific Countries","从指定的国家支付"
 "Payment partial authorization error.","支付的部分身份验证出错。"
diff --git a/app/code/Magento/Authz/Service/AuthorizationV1.php b/app/code/Magento/Authz/Service/AuthorizationV1.php
index 42f51a6942d..f85b3a7d5d2 100644
--- a/app/code/Magento/Authz/Service/AuthorizationV1.php
+++ b/app/code/Magento/Authz/Service/AuthorizationV1.php
@@ -34,7 +34,7 @@ use Magento\User\Model\Resource\Rules\CollectionFactory as RulesCollectionFactor
 use Magento\User\Model\Role;
 use Magento\User\Model\RoleFactory;
 use Magento\User\Model\RulesFactory;
-use Magento\Core\Model\Acl\RootResource as RootAclResource;
+use Magento\Acl\RootResource as RootAclResource;
 
 /**
  * Authorization service.
diff --git a/app/code/Magento/Authz/etc/module.xml b/app/code/Magento/Authz/etc/module.xml
index f2e3eefbc76..3f91c1382b6 100644
--- a/app/code/Magento/Authz/etc/module.xml
+++ b/app/code/Magento/Authz/etc/module.xml
@@ -26,7 +26,6 @@
 <config>
     <module name="Magento_Authz" version="1.0.0.0" active="true">
         <depends>
-            <module name="Magento_Core"/>
             <!--TODO: Dependency on Magento_User is temporary and should be eliminated when ACL is made global-->
             <module name="Magento_User"/>
             <module name="Magento_Backend"/>
diff --git a/app/code/Magento/Backend/App/Router/DefaultRouter.php b/app/code/Magento/Backend/App/Router/DefaultRouter.php
index 1c1d83f5a61..2295ce59d23 100644
--- a/app/code/Magento/Backend/App/Router/DefaultRouter.php
+++ b/app/code/Magento/Backend/App/Router/DefaultRouter.php
@@ -69,7 +69,8 @@ class DefaultRouter extends \Magento\Core\App\Router\Base
      * @param string $routerId
      * @param \Magento\App\ConfigInterface $coreConfig
      * @param \Magento\Backend\App\ConfigInterface $backendConfig
-     * 
+     * @param \Magento\Code\NameBuilder $nameBuilder
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
@@ -83,6 +84,7 @@ class DefaultRouter extends \Magento\Core\App\Router\Base
         \Magento\Core\Model\Store\Config $storeConfig,
         \Magento\Url\SecurityInfoInterface $urlSecurityInfo,
         $routerId,
+        \Magento\Code\NameBuilder $nameBuilder,
         \Magento\App\ConfigInterface $coreConfig,
         \Magento\Backend\App\ConfigInterface $backendConfig
     ) {
@@ -96,7 +98,8 @@ class DefaultRouter extends \Magento\Core\App\Router\Base
             $storeManager,
             $storeConfig,
             $urlSecurityInfo,
-            $routerId
+            $routerId,
+            $nameBuilder
         );
         $this->_coreConfig = $coreConfig;
         $this->_backendConfig = $backendConfig;
@@ -173,6 +176,6 @@ class DefaultRouter extends \Magento\Core\App\Router\Base
         $parts[] = \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE;
         $parts[] = $controller;
 
-        return \Magento\Core\Helper\String::buildClassName($parts);
+        return $this->nameBuilder->buildClassName($parts);
     }
 }
diff --git a/app/code/Magento/Backend/Block/System/Account/Edit/Form.php b/app/code/Magento/Backend/Block/System/Account/Edit/Form.php
index d4e506fa7aa..e53511f6f22 100644
--- a/app/code/Magento/Backend/Block/System/Account/Edit/Form.php
+++ b/app/code/Magento/Backend/Block/System/Account/Edit/Form.php
@@ -46,7 +46,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\User\Model\UserFactory $userFactory
      * @param \Magento\Backend\Model\Auth\Session $authSession
@@ -54,7 +54,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\User\Model\UserFactory $userFactory,
         \Magento\Backend\Model\Auth\Session $authSession,
diff --git a/app/code/Magento/Backend/Block/System/Cache/Form.php b/app/code/Magento/Backend/Block/System/Cache/Form.php
index f665699c45a..bfb241e43e6 100644
--- a/app/code/Magento/Backend/Block/System/Cache/Form.php
+++ b/app/code/Magento/Backend/Block/System/Cache/Form.php
@@ -41,14 +41,14 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Helper\Data $coreData
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Helper\Data $coreData,
         array $data = array()
diff --git a/app/code/Magento/Backend/Block/System/Config/Form.php b/app/code/Magento/Backend/Block/System/Config/Form.php
index d8be9a45baa..89baf3e2ab6 100644
--- a/app/code/Magento/Backend/Block/System/Config/Form.php
+++ b/app/code/Magento/Backend/Block/System/Config/Form.php
@@ -123,7 +123,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Backend\Model\Config\Factory $configFactory
      * @param \Magento\Backend\Model\Config\Structure $configStructure
@@ -134,7 +134,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Backend\Model\Config\Factory $configFactory,
         \Magento\Backend\Model\Config\Structure $configStructure,
diff --git a/app/code/Magento/Backend/Block/System/Design/Edit.php b/app/code/Magento/Backend/Block/System/Design/Edit.php
index 3a2403bd5ea..abfccf831ba 100644
--- a/app/code/Magento/Backend/Block/System/Design/Edit.php
+++ b/app/code/Magento/Backend/Block/System/Design/Edit.php
@@ -35,18 +35,18 @@ class Edit extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php b/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php
index 4f9de6c30cf..009d9a903ed 100644
--- a/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php
+++ b/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php
@@ -39,7 +39,7 @@ class General extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\View\Design\Theme\LabelFactory $labelFactory
      * @param \Magento\Core\Model\System\Store $systemStore
@@ -47,7 +47,7 @@ class General extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\View\Design\Theme\LabelFactory $labelFactory,
         \Magento\Core\Model\System\Store $systemStore,
diff --git a/app/code/Magento/Backend/Block/System/Store/Edit.php b/app/code/Magento/Backend/Block/System/Store/Edit.php
index f11bee0abbd..4aaea1598b1 100644
--- a/app/code/Magento/Backend/Block/System/Store/Edit.php
+++ b/app/code/Magento/Backend/Block/System/Store/Edit.php
@@ -33,18 +33,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Backend/Block/System/Store/Edit/Form/Group.php b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Group.php
index 43cf0d23294..89201999748 100644
--- a/app/code/Magento/Backend/Block/System/Store/Edit/Form/Group.php
+++ b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Group.php
@@ -54,7 +54,7 @@ class Group
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Catalog\Model\Config\Source\Category $category
      * @param \Magento\Core\Model\StoreFactory $storeFactory
@@ -63,7 +63,7 @@ class Group
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Catalog\Model\Config\Source\Category $category,
         \Magento\Core\Model\StoreFactory $storeFactory,
diff --git a/app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php
index 61818b498f8..3941aaf288f 100644
--- a/app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php
+++ b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php
@@ -49,7 +49,7 @@ class Store
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\Store\Group\Factory $groupFactory
      * @param \Magento\Core\Model\Website\Factory $websiteFactory
@@ -57,7 +57,7 @@ class Store
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\Store\Group\Factory $groupFactory,
         \Magento\Core\Model\Website\Factory $websiteFactory,
diff --git a/app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php
index 54e44698bd4..663b5f2b8b0 100644
--- a/app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php
+++ b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php
@@ -44,14 +44,14 @@ class Website
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\Store\GroupFactory $groupFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\Store\GroupFactory $groupFactory,
         array $data = array()
diff --git a/app/code/Magento/Backend/Block/System/Variable/Edit.php b/app/code/Magento/Backend/Block/System/Variable/Edit.php
index 77d33830057..73492316d47 100644
--- a/app/code/Magento/Backend/Block/System/Variable/Edit.php
+++ b/app/code/Magento/Backend/Block/System/Variable/Edit.php
@@ -33,18 +33,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Backend/Block/Template.php b/app/code/Magento/Backend/Block/Template.php
index 1db6abfaf20..e2df01f908e 100644
--- a/app/code/Magento/Backend/Block/Template.php
+++ b/app/code/Magento/Backend/Block/Template.php
@@ -58,6 +58,11 @@ class Template extends \Magento\View\Element\Template
      */
     protected $formKey;
 
+    /**
+     * @var \Magento\Code\NameBuilder
+     */
+    protected $nameBuilder;
+
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param array $data
@@ -71,6 +76,7 @@ class Template extends \Magento\View\Element\Template
         $this->mathRandom = $context->getMathRandom();
         $this->_backendSession = $context->getBackendSession();
         $this->formKey = $context->getFormKey();
+        $this->nameBuilder = $context->getNameBuilder();
         parent::__construct($context, $data);
     }
 
@@ -100,13 +106,13 @@ class Template extends \Magento\View\Element\Template
         }
         return !$this->_storeConfig->getConfigFlag('advanced/modules_disable_output/' . $moduleName);
     }
-    
+
     /**
      * Make this public so that templates can use it properly with template engine
-     * 
+     *
      * @return \Magento\AuthorizationInterface
      */
-    public function getAuthorization() 
+    public function getAuthorization()
     {
         return $this->_authorization;
     }
diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php
index 02a42590186..406d4b42b2b 100644
--- a/app/code/Magento/Backend/Block/Template/Context.php
+++ b/app/code/Magento/Backend/Block/Template/Context.php
@@ -49,7 +49,12 @@ class Context extends \Magento\View\Element\Template\Context
      * @var \Magento\Data\Form\FormKey
      */
     protected $formKey;
-    
+
+    /**
+     * @var \Magento\Code\NameBuilder
+     */
+    protected $nameBuilder;
+
     /**
      * @param \Magento\App\RequestInterface $request
      * @param \Magento\View\LayoutInterface $layout
@@ -79,8 +84,9 @@ class Context extends \Magento\View\Element\Template\Context
      * @param \Magento\Backend\Model\Session $backendSession
      * @param \Magento\Math\Random $mathRandom
      * @param \Magento\Data\Form\FormKey $formKey
+     * @param \Magento\Code\NameBuilder $nameBuilder
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
@@ -112,12 +118,14 @@ class Context extends \Magento\View\Element\Template\Context
         \Magento\Backend\Model\Session $backendSession,
         \Magento\Math\Random $mathRandom,
         \Magento\Data\Form\FormKey $formKey,
+        \Magento\Code\NameBuilder $nameBuilder,
         array $data = array()
     ) {
         $this->_authorization = $authorization;
         $this->_backendSession = $backendSession;
         $this->mathRandom = $mathRandom;
         $this->formKey = $formKey;
+        $this->nameBuilder = $nameBuilder;
         parent::__construct(
             $request,
             $layout,
@@ -198,4 +206,12 @@ class Context extends \Magento\View\Element\Template\Context
     {
         return $this->formKey;
     }
+
+    /**
+     * @return \Magento\Data\Form\FormKey
+     */
+    public function getNameBuilder()
+    {
+        return $this->nameBuilder;
+    }
 }
diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Tree.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Tree.php
index 33656740e9b..4f4534b3334 100644
--- a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Tree.php
+++ b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Tree.php
@@ -71,7 +71,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Catalog\Model\Resource\Category\Tree $categoryTree
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
@@ -81,7 +81,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Catalog\Model\Resource\Category\Tree $categoryTree,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\Catalog\Model\CategoryFactory $categoryFactory,
diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php
index 8851881ab15..0b5daa4f370 100644
--- a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php
+++ b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php
@@ -62,7 +62,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\Source\Urlrewrite\TypesFactory $typesFactory
      * @param \Magento\Core\Model\Source\Urlrewrite\OptionsFactory $optionFactory
@@ -78,7 +78,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\Source\Urlrewrite\TypesFactory $typesFactory,
         \Magento\Core\Model\Source\Urlrewrite\OptionsFactory $optionFactory,
diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php
index 21946e85819..b2d863e56f5 100644
--- a/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php
+++ b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php
@@ -55,7 +55,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\Source\Urlrewrite\TypesFactory $typesFactory
      * @param \Magento\Core\Model\Source\Urlrewrite\OptionsFactory $optionFactory
@@ -70,7 +70,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\Source\Urlrewrite\TypesFactory $typesFactory,
         \Magento\Core\Model\Source\Urlrewrite\OptionsFactory $optionFactory,
diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php b/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php
index 3bf81658970..dbb83a8c014 100644
--- a/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php
+++ b/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php
@@ -89,7 +89,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\Source\Urlrewrite\TypesFactory $typesFactory
      * @param \Magento\Core\Model\Source\Urlrewrite\OptionsFactory $optionFactory
@@ -102,7 +102,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\Source\Urlrewrite\TypesFactory $typesFactory,
         \Magento\Core\Model\Source\Urlrewrite\OptionsFactory $optionFactory,
diff --git a/app/code/Magento/Backend/Block/Widget/Form/Container.php b/app/code/Magento/Backend/Block/Widget/Form/Container.php
index 7e12d739fd2..cd55df72c13 100644
--- a/app/code/Magento/Backend/Block/Widget/Form/Container.php
+++ b/app/code/Magento/Backend/Block/Widget/Form/Container.php
@@ -125,7 +125,7 @@ class Container extends \Magento\Backend\Block\Widget\Container
      */
     protected function _buildFormClassName()
     {
-        return \Magento\Core\Helper\String::buildClassName(array(
+        return $this->nameBuilder->buildClassName(array(
             $this->_blockGroup,
             'Block',
             $this->_controller,
diff --git a/app/code/Magento/Backend/Block/Widget/Form/Generic.php b/app/code/Magento/Backend/Block/Widget/Form/Generic.php
index 3ca9484e66a..ac8e2bb1d65 100644
--- a/app/code/Magento/Backend/Block/Widget/Form/Generic.php
+++ b/app/code/Magento/Backend/Block/Widget/Form/Generic.php
@@ -43,19 +43,19 @@ class Generic extends \Magento\Backend\Block\Widget\Form
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Additional.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Additional.php
index d4f2006b8da..c9f3e8fcd15 100644
--- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Additional.php
+++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Additional.php
@@ -36,14 +36,14 @@ class Additional extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\View\Layout\Argument\Interpreter\Options $optionsInterpreter
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\View\Layout\Argument\Interpreter\Options $optionsInterpreter,
         array $data = array()
diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php
index 3e52c3cc449..c5e6908a7e3 100644
--- a/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php
+++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php
@@ -32,7 +32,7 @@ class Design extends Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -43,12 +43,12 @@ class Design extends Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Core\Filter\Date $dateFilter
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Core\Filter\Date $dateFilter
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php
index f2c28135d38..34cfdcb6a76 100644
--- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php
+++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php
@@ -39,7 +39,7 @@ class Store extends Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -50,12 +50,12 @@ class Store extends Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Filter\FilterManager $filterManager
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Filter\FilterManager $filterManager
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Variable.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Variable.php
index ceacf3557d6..00b9d4fa88b 100644
--- a/app/code/Magento/Backend/Controller/Adminhtml/System/Variable.php
+++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Variable.php
@@ -39,17 +39,17 @@ class Variable extends Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php
index 36bc7a2e60f..8662f6e8da7 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php
@@ -52,8 +52,8 @@ class Custom extends \Magento\Core\Model\Config\Value
     protected $_configWriter;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\App\Config\Storage\WriterInterface $configWriter
@@ -62,8 +62,8 @@ class Custom extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\App\Config\Storage\WriterInterface $configWriter,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php
index 1eea1145c89..aa1b56c67f3 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php
@@ -38,7 +38,7 @@ class Observer
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -59,14 +59,14 @@ class Observer
 
     /**
      * @param \Magento\Backend\Helper\Data $backendData
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Backend\Model\Auth\Session $authSession
      * @param \Magento\Core\Model\App $app
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      */
     public function __construct(
         \Magento\Backend\Helper\Data $backendData,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Backend\Model\Auth\Session $authSession,
         \Magento\Core\Model\App $app,
         \Magento\Core\Model\StoreManagerInterface $storeManager
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php
index 1549e350d6e..bcb813ac243 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php
@@ -42,8 +42,8 @@ class Robots extends \Magento\Core\Model\Config\Value
     protected $_file;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\App\Filesystem $filesystem
@@ -52,8 +52,8 @@ class Robots extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\App\Filesystem $filesystem,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php
index 456c090a356..af9ee8e6b13 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php
@@ -40,8 +40,8 @@ class Usecustom extends \Magento\Core\Model\Config\Value
     protected $_configWriter;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\App\Config\Storage\WriterInterface $configWriter
@@ -50,8 +50,8 @@ class Usecustom extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\App\Config\Storage\WriterInterface $configWriter,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php
index 639ad905e6c..a067e696abd 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php
@@ -37,8 +37,8 @@ class Usesecretkey extends \Magento\Core\Model\Config\Value
     protected $_backendUrl;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Backend\Model\UrlInterface $backendUrl
@@ -47,8 +47,8 @@ class Usesecretkey extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Backend\Model\UrlInterface $backendUrl,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php b/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php
index d57aa466d59..76689c4988b 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php
@@ -31,8 +31,8 @@ class Baseurl extends \Magento\Core\Model\Config\Value
     protected $_mergeService;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\View\Asset\MergeService $mergeService
@@ -41,8 +41,8 @@ class Baseurl extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\View\Asset\MergeService $mergeService,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php
index 0378619ca6c..e471b6fee47 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php
@@ -48,8 +48,8 @@ abstract class AbstractCurrency extends \Magento\Core\Model\Config\Value
     /**
      * Constructor
      *
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
@@ -58,8 +58,8 @@ abstract class AbstractCurrency extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php
index 323ccf82df0..502e3d9daf4 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php
@@ -38,8 +38,8 @@ class Allow extends AbstractCurrency
     protected $_locale;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
@@ -49,8 +49,8 @@ class Allow extends AbstractCurrency
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php
index 74e69679fa5..e76e973d538 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php
@@ -39,8 +39,8 @@ class Cron extends \Magento\Core\Model\Config\Value
     protected $_configValueFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory
@@ -49,8 +49,8 @@ class Cron extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Config\ValueFactory $configValueFactory,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php
index 2f052eeef07..ed8fc844a32 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php
@@ -37,8 +37,8 @@ class Encrypted
     protected $_encryptor;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Encryption\EncryptorInterface $encryptor
@@ -47,8 +47,8 @@ class Encrypted
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Encryption\EncryptorInterface $encryptor,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/File.php b/app/code/Magento/Backend/Model/Config/Backend/File.php
index 78c9a5ef6b2..61342b3c1d8 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/File.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/File.php
@@ -61,8 +61,8 @@ class File extends \Magento\Core\Model\Config\Value
     protected $_uploaderFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\File\UploaderFactory $uploaderFactory
@@ -73,8 +73,8 @@ class File extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\File\UploaderFactory $uploaderFactory,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php b/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php
index ec2216bebc1..4ac4e8b5103 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php
@@ -42,8 +42,8 @@ class Adapter extends \Magento\Core\Model\Config\Value
     protected $_imageFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Image\AdapterFactory $imageFactory
@@ -52,8 +52,8 @@ class Adapter extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Image\AdapterFactory $imageFactory,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Locale.php b/app/code/Magento/Backend/Model/Config/Backend/Locale.php
index 1942420a94a..36b304696b0 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Locale.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Locale.php
@@ -52,8 +52,8 @@ class Locale extends \Magento\Core\Model\Config\Value
     protected $_storeFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Resource\Config\Data\CollectionFactory $configsFactory
@@ -67,8 +67,8 @@ class Locale extends \Magento\Core\Model\Config\Value
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Resource\Config\Data\CollectionFactory $configsFactory,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php b/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php
index 706b9915b11..50711b3d56a 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php
@@ -45,8 +45,8 @@ class Cron extends \Magento\Core\Model\Config\Value
     protected $_runModelPath = '';
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory
@@ -56,8 +56,8 @@ class Cron extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Config\ValueFactory $configValueFactory,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Secure.php b/app/code/Magento/Backend/Model/Config/Backend/Secure.php
index 9df57bb8929..27a35ca2541 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Secure.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Secure.php
@@ -31,8 +31,8 @@ class Secure extends \Magento\Core\Model\Config\Value
     protected $_mergeService;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\View\Asset\MergeService $mergeService
@@ -41,8 +41,8 @@ class Secure extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\View\Asset\MergeService $mergeService,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php b/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php
index afa74d82e77..4e034da610a 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php
@@ -37,8 +37,8 @@ class Database extends \Magento\Core\Model\Config\Value
     protected $_coreFileStorage = null;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Helper\File\Storage $coreFileStorage
@@ -47,8 +47,8 @@ class Database extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Helper\File\Storage $coreFileStorage,
diff --git a/app/code/Magento/Backend/Model/Config/Backend/Translate.php b/app/code/Magento/Backend/Model/Config/Backend/Translate.php
index d4a7279d460..a8633e64f70 100644
--- a/app/code/Magento/Backend/Model/Config/Backend/Translate.php
+++ b/app/code/Magento/Backend/Model/Config/Backend/Translate.php
@@ -53,8 +53,8 @@ class Translate extends \Magento\Core\Model\Config\Value
     /**
      * Constructor
      *
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
@@ -64,8 +64,8 @@ class Translate extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
diff --git a/app/code/Magento/Backend/Model/Config/Source/Admin/Page.php b/app/code/Magento/Backend/Model/Config/Source/Admin/Page.php
index b646800c5c4..9cf451b4338 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Admin/Page.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Admin/Page.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Backend\Model\Config\Source\Admin;
 
-class Page implements \Magento\Core\Model\Option\ArrayInterface
+class Page implements \Magento\Option\ArrayInterface
 {
     /**
      * Menu model
diff --git a/app/code/Magento/Backend/Model/Config/Source/Checktype.php b/app/code/Magento/Backend/Model/Config/Source/Checktype.php
index 581d1f7db72..333938f1489 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Checktype.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Checktype.php
@@ -34,7 +34,7 @@
  */
 namespace Magento\Backend\Model\Config\Source;
 
-class Checktype implements \Magento\Core\Model\Option\ArrayInterface
+class Checktype implements \Magento\Option\ArrayInterface
 {
     /**
      * Retrieve Check Type Option array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Currency.php b/app/code/Magento/Backend/Model/Config/Source/Currency.php
index 14246d1c9cc..41ad819e540 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Currency.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Currency.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Backend\Model\Config\Source;
 
-class Currency implements \Magento\Core\Model\Option\ArrayInterface
+class Currency implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Date/Short.php b/app/code/Magento/Backend/Model/Config/Source/Date/Short.php
index 7ba4596e0c0..4361c3867d0 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Date/Short.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Date/Short.php
@@ -27,7 +27,7 @@
 
 namespace Magento\Backend\Model\Config\Source\Date;
 
-class Short implements \Magento\Core\Model\Option\ArrayInterface
+class Short implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Design/Robots.php b/app/code/Magento/Backend/Model/Config/Source/Design/Robots.php
index d879e4fee49..c0934ba3b06 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Design/Robots.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Design/Robots.php
@@ -27,7 +27,7 @@
 
 namespace Magento\Backend\Model\Config\Source\Design;
 
-class Robots implements \Magento\Core\Model\Option\ArrayInterface
+class Robots implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Dev/Dbautoup.php b/app/code/Magento/Backend/Model/Config/Source/Dev/Dbautoup.php
index 26b2b3bc533..bd7ce11ec72 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Dev/Dbautoup.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Dev/Dbautoup.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Backend\Model\Config\Source\Dev;
 
-class Dbautoup implements \Magento\Core\Model\Option\ArrayInterface
+class Dbautoup implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Email/Identity.php b/app/code/Magento/Backend/Model/Config/Source/Email/Identity.php
index d7e677ce91d..bcf93088007 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Email/Identity.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Email/Identity.php
@@ -27,7 +27,7 @@
 
 namespace Magento\Backend\Model\Config\Source\Email;
 
-class Identity implements \Magento\Core\Model\Option\ArrayInterface
+class Identity implements \Magento\Option\ArrayInterface
 {
     /**
      * Email Identity options
diff --git a/app/code/Magento/Backend/Model/Config/Source/Email/Method.php b/app/code/Magento/Backend/Model/Config/Source/Email/Method.php
index a6c569ecaa5..77adaf68fff 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Email/Method.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Email/Method.php
@@ -34,7 +34,7 @@
  */
 namespace Magento\Backend\Model\Config\Source\Email;
 
-class Method implements \Magento\Core\Model\Option\ArrayInterface
+class Method implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Email/Smtpauth.php b/app/code/Magento/Backend/Model/Config/Source/Email/Smtpauth.php
index 5706498c3cb..e3766ce86f2 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Email/Smtpauth.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Email/Smtpauth.php
@@ -27,7 +27,7 @@
 
 namespace Magento\Backend\Model\Config\Source\Email;
 
-class Smtpauth implements \Magento\Core\Model\Option\ArrayInterface
+class Smtpauth implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Email/Template.php b/app/code/Magento/Backend/Model/Config/Source/Email/Template.php
index 9d304653b0b..b409f338288 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Email/Template.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Email/Template.php
@@ -24,10 +24,10 @@
 namespace Magento\Backend\Model\Config\Source\Email;
 
 class Template extends \Magento\Object
-    implements \Magento\Core\Model\Option\ArrayInterface
+    implements \Magento\Option\ArrayInterface
 {
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     private $_coreRegistry;
 
@@ -42,13 +42,13 @@ class Template extends \Magento\Object
     protected $_templatesFactory;
 
     /**
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Email\Model\Resource\Template\CollectionFactory $templatesFactory
      * @param \Magento\Email\Model\Template\Config $emailConfig
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Email\Model\Resource\Template\CollectionFactory $templatesFactory,
         \Magento\Email\Model\Template\Config $emailConfig,
         array $data = array()
diff --git a/app/code/Magento/Backend/Model/Config/Source/Enabledisable.php b/app/code/Magento/Backend/Model/Config/Source/Enabledisable.php
index 3e5ec55f7ed..93ec48730a7 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Enabledisable.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Enabledisable.php
@@ -27,7 +27,7 @@
 
 namespace Magento\Backend\Model\Config\Source;
 
-class Enabledisable implements \Magento\Core\Model\Option\ArrayInterface
+class Enabledisable implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Image/Adapter.php b/app/code/Magento/Backend/Model/Config/Source/Image/Adapter.php
index f386ef15f7e..116e7a53b16 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Image/Adapter.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Image/Adapter.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Backend\Model\Config\Source\Image;
 
-class Adapter implements \Magento\Core\Model\Option\ArrayInterface
+class Adapter implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Image\Adapter\ConfigInterface
diff --git a/app/code/Magento/Backend/Model/Config/Source/Locale.php b/app/code/Magento/Backend/Model/Config/Source/Locale.php
index ab6b1b4c018..2dfb3ee4f7e 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Locale.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Locale.php
@@ -23,13 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
- 
+
 /**
  * Locale source
  */
 namespace Magento\Backend\Model\Config\Source;
 
-class Locale implements \Magento\Core\Model\Option\ArrayInterface
+class Locale implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Core\Model\LocaleInterface
diff --git a/app/code/Magento/Backend/Model/Config/Source/Locale/Country.php b/app/code/Magento/Backend/Model/Config/Source/Locale/Country.php
index 14cd7a18f9c..995d7431b51 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Locale/Country.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Locale/Country.php
@@ -23,13 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
- 
+
 /**
  * Locale country source
  */
 namespace Magento\Backend\Model\Config\Source\Locale;
 
-class Country implements \Magento\Core\Model\Option\ArrayInterface
+class Country implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Core\Model\LocaleInterface
diff --git a/app/code/Magento/Backend/Model/Config/Source/Locale/Currency.php b/app/code/Magento/Backend/Model/Config/Source/Locale/Currency.php
index 444c3f6db20..61949a54a88 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Locale/Currency.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Locale/Currency.php
@@ -23,13 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
- 
+
 /**
  * Locale currency source
  */
 namespace Magento\Backend\Model\Config\Source\Locale;
 
-class Currency implements \Magento\Core\Model\Option\ArrayInterface
+class Currency implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Locale/Currency/All.php b/app/code/Magento/Backend/Model/Config/Source/Locale/Currency/All.php
index fa71072e9e5..1d7a8061792 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Locale/Currency/All.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Locale/Currency/All.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Backend\Model\Config\Source\Locale\Currency;
 
-class All implements \Magento\Core\Model\Option\ArrayInterface
+class All implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Locale/Timezone.php b/app/code/Magento/Backend/Model/Config/Source/Locale/Timezone.php
index 587822063b7..e67bb0c3ba2 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Locale/Timezone.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Locale/Timezone.php
@@ -23,13 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
- 
+
 /**
  * Locale timezone source
  */
 namespace Magento\Backend\Model\Config\Source\Locale;
 
-class Timezone implements \Magento\Core\Model\Option\ArrayInterface
+class Timezone implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Core\Model\LocaleInterface
diff --git a/app/code/Magento/Backend/Model/Config/Source/Locale/Weekdaycodes.php b/app/code/Magento/Backend/Model/Config/Source/Locale/Weekdaycodes.php
index f1119e93714..13e8cf16439 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Locale/Weekdaycodes.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Locale/Weekdaycodes.php
@@ -29,7 +29,7 @@
  */
 namespace Magento\Backend\Model\Config\Source\Locale;
 
-class Weekdaycodes implements \Magento\Core\Model\Option\ArrayInterface
+class Weekdaycodes implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Core\Model\LocaleInterface
diff --git a/app/code/Magento/Backend/Model/Config/Source/Locale/Weekdays.php b/app/code/Magento/Backend/Model/Config/Source/Locale/Weekdays.php
index 0959a534c19..ab6d059fba1 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Locale/Weekdays.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Locale/Weekdays.php
@@ -29,7 +29,7 @@
  */
 namespace Magento\Backend\Model\Config\Source\Locale;
 
-class Weekdays implements \Magento\Core\Model\Option\ArrayInterface
+class Weekdays implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Core\Model\LocaleInterface
diff --git a/app/code/Magento/Backend/Model/Config/Source/Nooptreq.php b/app/code/Magento/Backend/Model/Config/Source/Nooptreq.php
index 14772971f7a..a655c4fda42 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Nooptreq.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Nooptreq.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Backend\Model\Config\Source;
 
-class Nooptreq implements \Magento\Core\Model\Option\ArrayInterface
+class Nooptreq implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Reports/Scope.php b/app/code/Magento/Backend/Model/Config/Source/Reports/Scope.php
index c5cb584099e..b75aa361553 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Reports/Scope.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Reports/Scope.php
@@ -33,7 +33,7 @@
  */
 namespace Magento\Backend\Model\Config\Source\Reports;
 
-class Scope implements \Magento\Core\Model\Option\ArrayInterface
+class Scope implements \Magento\Option\ArrayInterface
 {
     /**
      * Scope filter
diff --git a/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php b/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php
index 3ac0d9dec46..7760080de62 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php
@@ -31,7 +31,7 @@ namespace Magento\Backend\Model\Config\Source\Storage\Media;
 
 use Magento\App\Arguments;
 
-class Database implements \Magento\Core\Model\Option\ArrayInterface
+class Database implements \Magento\Option\ArrayInterface
 {
     /**
      * @var Arguments
diff --git a/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Storage.php b/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Storage.php
index acd10d8e7e7..8d9a85d664b 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Storage.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Storage.php
@@ -29,7 +29,7 @@
  */
 namespace Magento\Backend\Model\Config\Source\Storage\Media;
 
-class Storage implements \Magento\Core\Model\Option\ArrayInterface
+class Storage implements \Magento\Option\ArrayInterface
 {
     /**
      * Options getter
diff --git a/app/code/Magento/Backend/Model/Config/Source/Store.php b/app/code/Magento/Backend/Model/Config/Source/Store.php
index d6cc0b773b5..e4397cba50c 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Store.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Store.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Backend\Model\Config\Source;
 
-class Store implements \Magento\Core\Model\Option\ArrayInterface
+class Store implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Web/Protocol.php b/app/code/Magento/Backend/Model/Config/Source/Web/Protocol.php
index fd24b6b3576..c6ed413df68 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Web/Protocol.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Web/Protocol.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Backend\Model\Config\Source\Web;
 
-class Protocol implements \Magento\Core\Model\Option\ArrayInterface
+class Protocol implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Web/Redirect.php b/app/code/Magento/Backend/Model/Config/Source/Web/Redirect.php
index 74d9b74af71..f5aa5645ebf 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Web/Redirect.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Web/Redirect.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Backend\Model\Config\Source\Web;
 
-class Redirect implements \Magento\Core\Model\Option\ArrayInterface
+class Redirect implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Website.php b/app/code/Magento/Backend/Model/Config/Source/Website.php
index 535b696c26a..b4df7debf34 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Website.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Website.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Backend\Model\Config\Source;
 
-class Website implements \Magento\Core\Model\Option\ArrayInterface
+class Website implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Backend/Model/Config/Source/Website/OptionHash.php b/app/code/Magento/Backend/Model/Config/Source/Website/OptionHash.php
index 6800391e71c..7f31b833b5e 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Website/OptionHash.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Website/OptionHash.php
@@ -29,7 +29,7 @@ namespace Magento\Backend\Model\Config\Source\Website;
 use Magento\Core\Model\System\Store;
 
 class OptionHash
-    implements \Magento\Core\Model\Option\ArrayInterface
+    implements \Magento\Option\ArrayInterface
 {
     /**
      * System Store Model
diff --git a/app/code/Magento/Backend/Model/Config/Source/Yesno.php b/app/code/Magento/Backend/Model/Config/Source/Yesno.php
index 6eb1e531842..2d3f96b5e02 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Yesno.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Yesno.php
@@ -30,7 +30,7 @@
  */
 namespace Magento\Backend\Model\Config\Source;
 
-class Yesno implements \Magento\Core\Model\Option\ArrayInterface
+class Yesno implements \Magento\Option\ArrayInterface
 {
 
     /**
diff --git a/app/code/Magento/Backend/Model/Config/Source/Yesnocustom.php b/app/code/Magento/Backend/Model/Config/Source/Yesnocustom.php
index 406b7bee568..e73456ad38a 100644
--- a/app/code/Magento/Backend/Model/Config/Source/Yesnocustom.php
+++ b/app/code/Magento/Backend/Model/Config/Source/Yesnocustom.php
@@ -30,7 +30,7 @@
  */
 namespace Magento\Backend\Model\Config\Source;
 
-class Yesnocustom implements \Magento\Core\Model\Option\ArrayInterface
+class Yesnocustom implements \Magento\Option\ArrayInterface
 {
 
     /**
diff --git a/app/code/Magento/Backend/Model/Menu/Filter/Iterator.php b/app/code/Magento/Backend/Model/Menu/Filter/Iterator.php
index 06893120c06..6410772379f 100644
--- a/app/code/Magento/Backend/Model/Menu/Filter/Iterator.php
+++ b/app/code/Magento/Backend/Model/Menu/Filter/Iterator.php
@@ -30,6 +30,16 @@ namespace Magento\Backend\Model\Menu\Filter;
  */
 class Iterator extends \FilterIterator
 {
+    /**
+     * Constructor
+     *
+     * @param \Iterator $iterator
+     */
+    public function __construct(\Iterator $iterator)
+    {
+        parent::__construct($iterator);
+    }
+
     /**
      * Check whether the current element of the iterator is acceptable
      *
diff --git a/app/code/Magento/Backend/etc/di.xml b/app/code/Magento/Backend/etc/di.xml
index 7cb58d42078..ea21e78278f 100644
--- a/app/code/Magento/Backend/etc/di.xml
+++ b/app/code/Magento/Backend/etc/di.xml
@@ -123,12 +123,12 @@
             <argument name="resourceLoader" xsi:type="object">Magento\Acl\Loader\Resource</argument>
         </arguments>
     </type>
-    <type name="Magento\Core\Model\Acl\Cache">
+    <type name="Magento\Acl\Cache">
         <arguments>
             <argument name="cacheKey" xsi:type="string">backend_acl_resources</argument>
         </arguments>
     </type>
-    <type name="Magento\Core\Model\Acl\RootResource">
+    <type name="Magento\Acl\RootResource">
         <arguments>
             <argument name="identifier" xsi:type="string">Magento_Adminhtml::all</argument>
         </arguments>
diff --git a/app/code/Magento/Backup/Controller/Adminhtml/Index.php b/app/code/Magento/Backup/Controller/Adminhtml/Index.php
index 28d56779742..84b77f77cec 100644
--- a/app/code/Magento/Backup/Controller/Adminhtml/Index.php
+++ b/app/code/Magento/Backup/Controller/Adminhtml/Index.php
@@ -35,7 +35,7 @@ class Index extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -56,14 +56,14 @@ class Index extends \Magento\Backend\App\Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Backup\Factory $backupFactory
      * @param \Magento\App\Response\Http\FileFactory $fileFactory
      * @param \Magento\Backup\Model\BackupFactory $backupModelFactory
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Backup\Factory $backupFactory,
         \Magento\App\Response\Http\FileFactory $fileFactory,
         \Magento\Backup\Model\BackupFactory $backupModelFactory
diff --git a/app/code/Magento/Backup/Model/Config/Backend/Cron.php b/app/code/Magento/Backup/Model/Config/Backend/Cron.php
index 62370583bd6..72f2f62a74b 100644
--- a/app/code/Magento/Backup/Model/Config/Backend/Cron.php
+++ b/app/code/Magento/Backup/Model/Config/Backend/Cron.php
@@ -48,8 +48,8 @@ class Cron extends \Magento\Core\Model\Config\Value
     protected $_runModelPath = '';
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory
@@ -59,8 +59,8 @@ class Cron extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Config\ValueFactory $configValueFactory,
diff --git a/app/code/Magento/Backup/Model/Config/Source/Type.php b/app/code/Magento/Backup/Model/Config/Source/Type.php
index ad3f6c6f8b9..5661989cb8c 100644
--- a/app/code/Magento/Backup/Model/Config/Source/Type.php
+++ b/app/code/Magento/Backup/Model/Config/Source/Type.php
@@ -30,7 +30,7 @@ namespace Magento\Backup\Model\Config\Source;
  *
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-class Type implements \Magento\Core\Model\Option\ArrayInterface
+class Type implements \Magento\Option\ArrayInterface
 {
     /**
      * Backup data
diff --git a/app/code/Magento/Backup/Model/Grid/Options.php b/app/code/Magento/Backup/Model/Grid/Options.php
index 856116df32f..3d4c9571241 100644
--- a/app/code/Magento/Backup/Model/Grid/Options.php
+++ b/app/code/Magento/Backup/Model/Grid/Options.php
@@ -33,7 +33,7 @@
  */
 namespace Magento\Backup\Model\Grid;
 
-class Options implements \Magento\Core\Model\Option\ArrayInterface
+class Options implements \Magento\Option\ArrayInterface
 {
 
     /**
diff --git a/app/code/Magento/Backup/Model/Observer.php b/app/code/Magento/Backup/Model/Observer.php
index c48ad2d8a7c..d960a11f7bb 100644
--- a/app/code/Magento/Backup/Model/Observer.php
+++ b/app/code/Magento/Backup/Model/Observer.php
@@ -56,7 +56,7 @@ class Observer
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -86,7 +86,7 @@ class Observer
 
     /**
      * @param \Magento\Backup\Helper\Data $backupData
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Logger $logger
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\App\Filesystem $filesystem
@@ -94,7 +94,7 @@ class Observer
      */
     public function __construct(
         \Magento\Backup\Helper\Data $backupData,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Logger $logger,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\App\Filesystem $filesystem,
diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php
index b1ef2c9a83e..2e7b761fe37 100644
--- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php
+++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php
@@ -42,18 +42,18 @@ class Extend
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php
index 5aaeaea1e62..1c6e8f98ca4 100644
--- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php
+++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php
@@ -43,18 +43,18 @@ class Bundle extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php
index 0276a35f7ed..c9bfc0c19d6 100644
--- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php
+++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php
@@ -70,7 +70,7 @@ class Option extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -88,14 +88,14 @@ class Option extends \Magento\Backend\Block\Widget
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Model\Config\Source\Yesno $yesno
      * @param \Magento\Bundle\Model\Source\Option\Type $optionTypes
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Model\Config\Source\Yesno $yesno,
         \Magento\Bundle\Model\Source\Option\Type $optionTypes,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php
index 3b725e7f782..198f763b95e 100644
--- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php
+++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php
@@ -48,7 +48,7 @@ class Selection
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -67,7 +67,7 @@ class Selection
      * @param \Magento\Backend\Model\Config\Source\Yesno $yesno
      * @param \Magento\Bundle\Model\Source\Option\Selection\Price\Type $priceType
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
@@ -75,7 +75,7 @@ class Selection
         \Magento\Backend\Model\Config\Source\Yesno $yesno,
         \Magento\Bundle\Model\Source\Option\Selection\Price\Type $priceType,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_catalogData = $catalogData;
diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php
index fdf60e0f7b9..57bf52f50a9 100644
--- a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php
+++ b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php
@@ -45,7 +45,7 @@ class Price extends \Magento\Catalog\Block\Product\Price
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Tax\Helper\Data $taxData
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Stdlib\String $string
      * @param \Magento\Math\Random $mathRandom
      * @param \Magento\Checkout\Helper\Cart $cartHelper
@@ -57,7 +57,7 @@ class Price extends \Magento\Catalog\Block\Product\Price
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Tax\Helper\Data $taxData,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Stdlib\String $string,
         \Magento\Math\Random $mathRandom,
         \Magento\Checkout\Helper\Cart $cartHelper,
diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php
index 1c8bf217c85..3090b1c0d31 100644
--- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php
+++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php
@@ -70,7 +70,7 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -86,13 +86,13 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php
index 62598657fdb..954e294bda8 100644
--- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php
+++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php
@@ -60,14 +60,14 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Tax\Helper\Data $taxData
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Stdlib\String $string
      * @param \Magento\Math\Random $mathRandom
      * @param \Magento\Checkout\Helper\Cart $cartHelper
      * @param \Magento\Tax\Model\Calculation $taxCalc
      * @param \Magento\Core\Helper\Data $coreHelper
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
@@ -75,7 +75,7 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Tax\Helper\Data $taxData,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Stdlib\String $string,
         \Magento\Math\Random $mathRandom,
         \Magento\Checkout\Helper\Cart $cartHelper,
diff --git a/app/code/Magento/Bundle/Model/Price/Index.php b/app/code/Magento/Bundle/Model/Price/Index.php
index 06c5c7fc205..de5cb6b8794 100644
--- a/app/code/Magento/Bundle/Model/Price/Index.php
+++ b/app/code/Magento/Bundle/Model/Price/Index.php
@@ -58,8 +58,8 @@ class Index extends \Magento\Core\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -67,8 +67,8 @@ class Index extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Bundle/Model/Product/CatalogPrice.php b/app/code/Magento/Bundle/Model/Product/CatalogPrice.php
index 2e544ed26ca..26620b58eb3 100644
--- a/app/code/Magento/Bundle/Model/Product/CatalogPrice.php
+++ b/app/code/Magento/Bundle/Model/Product/CatalogPrice.php
@@ -40,19 +40,19 @@ class CatalogPrice implements \Magento\Catalog\Model\Product\CatalogPriceInterfa
     protected $commonPriceModel;
 
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $coreRegistry;
 
     /**
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Model\Product\CatalogPrice $commonPriceModel
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Model\Product\CatalogPrice $commonPriceModel,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->storeManager = $storeManager;
         $this->commonPriceModel = $commonPriceModel;
diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php
index 6d1cd960fe6..dfb269540f6 100644
--- a/app/code/Magento/Bundle/Model/Product/Type.php
+++ b/app/code/Magento/Bundle/Model/Product/Type.php
@@ -151,7 +151,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType
      * @param \Magento\Core\Helper\Data $coreData
      * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb
      * @param \Magento\App\Filesystem $filesystem
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Logger $logger
      * @param \Magento\Catalog\Helper\Product $catalogProduct
      * @param \Magento\Catalog\Helper\Data $catalogData
@@ -175,7 +175,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType
         \Magento\Core\Helper\Data $coreData,
         \Magento\Core\Helper\File\Storage\Database $fileStorageDb,
         \Magento\App\Filesystem $filesystem,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Logger $logger,
         \Magento\Catalog\Helper\Product $catalogProduct,
         \Magento\Catalog\Helper\Data $catalogData,
diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php
index 86f22d882b2..547c818cbef 100644
--- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php
+++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php
@@ -39,8 +39,8 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte
     protected $string;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\App\Filesystem $filesystem
      * @param \Magento\Filter\FilterManager $filterManager
@@ -50,8 +50,8 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\App\Filesystem $filesystem,
         \Magento\Filter\FilterManager $filterManager,
diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php
index 0f70db38908..981483e9263 100644
--- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php
+++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php
@@ -37,8 +37,8 @@ class Invoice extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems
     protected $string;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\App\Filesystem $filesystem
      * @param \Magento\Filter\FilterManager $filterManager
@@ -48,8 +48,8 @@ class Invoice extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\App\Filesystem $filesystem,
         \Magento\Filter\FilterManager $filterManager,
diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php
index 68a3656f529..f8594e2b644 100644
--- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php
+++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php
@@ -37,8 +37,8 @@ class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems
     protected $string;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\App\Filesystem $filesystem
      * @param \Magento\Filter\FilterManager $filterManager
@@ -48,8 +48,8 @@ class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\App\Filesystem $filesystem,
         \Magento\Filter\FilterManager $filterManager,
diff --git a/app/code/Magento/Bundle/Model/Selection.php b/app/code/Magento/Bundle/Model/Selection.php
index fa35ddec8d7..794312cd92f 100644
--- a/app/code/Magento/Bundle/Model/Selection.php
+++ b/app/code/Magento/Bundle/Model/Selection.php
@@ -64,16 +64,16 @@ class Selection extends \Magento\Core\Model\AbstractModel
     protected $_catalogData = null;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Bundle\Model\Resource\Selection $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Bundle\Model\Resource\Selection $resource,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Bundle/Model/Source/Option/Selection/Price/Type.php b/app/code/Magento/Bundle/Model/Source/Option/Selection/Price/Type.php
index 5fc08315089..0d80b57cd09 100644
--- a/app/code/Magento/Bundle/Model/Source/Option/Selection/Price/Type.php
+++ b/app/code/Magento/Bundle/Model/Source/Option/Selection/Price/Type.php
@@ -33,7 +33,7 @@
  */
 namespace Magento\Bundle\Model\Source\Option\Selection\Price;
 
-class Type implements \Magento\Core\Model\Option\ArrayInterface
+class Type implements \Magento\Option\ArrayInterface
 {
     public function toOptionArray()
     {
diff --git a/app/code/Magento/Bundle/Model/Source/Option/Type.php b/app/code/Magento/Bundle/Model/Source/Option/Type.php
index c7ed5286bd7..935bb914bef 100644
--- a/app/code/Magento/Bundle/Model/Source/Option/Type.php
+++ b/app/code/Magento/Bundle/Model/Source/Option/Type.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Bundle\Model\Source\Option;
 
-class Type implements \Magento\Core\Model\Option\ArrayInterface
+class Type implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_shipment_new.xml b/app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_new.xml
similarity index 100%
rename from app/code/Magento/Bundle/view/adminhtml/layout/sales_order_shipment_new.xml
rename to app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_new.xml
diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_shipment_view.xml b/app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_view.xml
similarity index 100%
rename from app/code/Magento/Bundle/view/adminhtml/layout/sales_order_shipment_view.xml
rename to app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_view.xml
diff --git a/app/code/Magento/Captcha/Model/Config/Font.php b/app/code/Magento/Captcha/Model/Config/Font.php
index 7dc27ad754f..db10d4320a5 100644
--- a/app/code/Magento/Captcha/Model/Config/Font.php
+++ b/app/code/Magento/Captcha/Model/Config/Font.php
@@ -33,7 +33,7 @@
  */
 namespace Magento\Captcha\Model\Config;
 
-class Font implements \Magento\Core\Model\Option\ArrayInterface
+class Font implements \Magento\Option\ArrayInterface
 {
     /**
      * Captcha data
diff --git a/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php b/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php
index 94fc59ba21f..4928cc0f1fb 100644
--- a/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php
+++ b/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php
@@ -34,7 +34,7 @@
 namespace Magento\Captcha\Model\Config\Form;
 
 abstract class AbstractForm extends \Magento\Core\Model\Config\Value
-    implements \Magento\Core\Model\Option\ArrayInterface
+    implements \Magento\Option\ArrayInterface
 {
     /**
      * @var string
diff --git a/app/code/Magento/Captcha/Model/Config/Mode.php b/app/code/Magento/Captcha/Model/Config/Mode.php
index e02006de68e..5953b109dfc 100644
--- a/app/code/Magento/Captcha/Model/Config/Mode.php
+++ b/app/code/Magento/Captcha/Model/Config/Mode.php
@@ -33,7 +33,7 @@
  */
 namespace Magento\Captcha\Model\Config;
 
-class Mode implements \Magento\Core\Model\Option\ArrayInterface
+class Mode implements \Magento\Option\ArrayInterface
 {
     /**
      * Get options for captcha mode selection field
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/AbstractCategory.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/AbstractCategory.php
index e6981da3831..83da6c7a40c 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Category/AbstractCategory.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/AbstractCategory.php
@@ -41,7 +41,7 @@ class AbstractCategory extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -53,13 +53,13 @@ class AbstractCategory extends \Magento\Backend\Block\Template
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Catalog\Model\Resource\Category\Tree $categoryTree
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Catalog\Model\Resource\Category\Tree $categoryTree,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_categoryTree = $categoryTree;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php
index a3ccc9017fa..f21a2ba952d 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php
@@ -58,13 +58,13 @@ class Form extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory
      * @param Template\Context $context
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Catalog\Model\Resource\Category\Tree $categoryTree
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Catalog\Model\Resource\Category\Tree $categoryTree,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Json\EncoderInterface $jsonEncoder,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php
index ad90d0f9492..3fdf4460833 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php
@@ -43,14 +43,14 @@ class Attributes extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig,
         array $data = array()
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php
index d6454b41f5e..abf60510882 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php
@@ -42,7 +42,7 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -55,14 +55,14 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Catalog\Model\ProductFactory $productFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_productFactory = $productFactory;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tabs.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tabs.php
index 344ce00de9d..f6410bfc657 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tabs.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tabs.php
@@ -46,7 +46,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry|null
+     * @var \Magento\Registry|null
      */
     protected $_coreRegistry = null;
 
@@ -68,7 +68,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
      * @param \Magento\Backend\Model\Auth\Session $authSession
      * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $collectionFactory
      * @param \Magento\Catalog\Helper\Catalog $helperCatalog
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
@@ -77,7 +77,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
         \Magento\Backend\Model\Auth\Session $authSession,
         \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $collectionFactory,
         \Magento\Catalog\Helper\Catalog $helperCatalog,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_collectionFactory = $collectionFactory;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php
index df55cd8bb02..678d47d865b 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php
@@ -73,7 +73,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Catalog\Model\Resource\Category\Tree $categoryTree
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Resource\HelperPool $helperPool
      * @param \Magento\Backend\Model\Auth\Session $backendSession
      * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
@@ -82,7 +82,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Catalog\Model\Resource\Category\Tree $categoryTree,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Core\Model\Resource\HelperPool $helperPool,
         \Magento\Backend\Model\Auth\Session $backendSession,
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg/Content.php b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg/Content.php
index 55e0c330f41..43444e02b14 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg/Content.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg/Content.php
@@ -45,14 +45,14 @@ class Content extends Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig,
         array $data = array()
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php
index a4985da7972..2cc792783e0 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php
@@ -42,18 +42,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php
index 4433d308b7b..421af44996e 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php
@@ -54,7 +54,7 @@ class Advanced extends Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param Yesno $yesNo
      * @param Data $eavData
@@ -62,7 +62,7 @@ class Advanced extends Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         Yesno $yesNo,
         Data $eavData,
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php
index d7cdee0afb3..dcc2f7a563c 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php
@@ -47,14 +47,14 @@ class Front extends Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param Yesno $yesNo
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         Yesno $yesNo,
         array $data = array()
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php
index f122f842058..41837bb2af7 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php
@@ -49,7 +49,7 @@ class Main extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -84,7 +84,7 @@ class Main extends \Magento\Backend\Block\Template
      * @param \Magento\Eav\Model\Entity\TypeFactory $typeFactory
      * @param \Magento\Eav\Model\Entity\Attribute\GroupFactory $groupFactory
      * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param AttributeMapperInterface $attributeMapper
      * @param array $data
      */
@@ -94,7 +94,7 @@ class Main extends \Magento\Backend\Block\Template
         \Magento\Eav\Model\Entity\TypeFactory $typeFactory,
         \Magento\Eav\Model\Entity\Attribute\GroupFactory $groupFactory,
         \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         AttributeMapperInterface $attributeMapper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php
index a7514ff85a9..93e56c6ef7d 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php
@@ -44,14 +44,14 @@ class Formgroup
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Eav\Model\Entity\TypeFactory $typeFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Eav\Model\Entity\TypeFactory $typeFactory,
         array $data = array()
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formset.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formset.php
index 165dcd8cf6b..07d691305f6 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formset.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formset.php
@@ -38,14 +38,14 @@ class Formset
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory,
         array $data = array()
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main/Filter.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main/Filter.php
index 5d4abf2645f..50265cd0287 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main/Filter.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main/Filter.php
@@ -44,14 +44,14 @@ class Filter
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory,
         array $data = array()
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Configure.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Configure.php
index 56584b59542..9e266e7d47b 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Configure.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Configure.php
@@ -48,7 +48,7 @@ class Configure extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -60,13 +60,13 @@ class Configure extends \Magento\Backend\Block\Widget
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Catalog\Model\Product $product
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Catalog\Model\Product $product,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_catalogProduct = $product;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Error.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Error.php
index a062fb6cec0..cf02daecae7 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Error.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Error.php
@@ -38,7 +38,7 @@ class Error extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -50,13 +50,13 @@ class Error extends \Magento\View\Element\Template
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Json\EncoderInterface $jsonEncoder
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Json\EncoderInterface $jsonEncoder,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_jsonEncoder = $jsonEncoder;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/Qty.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/Qty.php
index 69f8b0d1138..2c4da47addc 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/Qty.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/Qty.php
@@ -34,18 +34,18 @@ class Qty extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Update/Result.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Update/Result.php
index c7ce96b27c3..16ebdc3f6c7 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Update/Result.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Update/Result.php
@@ -47,7 +47,7 @@ class Result extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -60,14 +60,14 @@ class Result extends \Magento\View\Element\Template
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Backend\Helper\Js $adminhtmlJs
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Backend\Helper\Js $adminhtmlJs,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_jsonEncoder = $jsonEncoder;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php
index 7d7a3f7ba41..bd78eb58df7 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php
@@ -43,7 +43,7 @@ class Edit extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -66,7 +66,7 @@ class Edit extends \Magento\Backend\Block\Widget
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $attributeSetFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Helper\Product $productHelper
      * @param array $data
      */
@@ -74,7 +74,7 @@ class Edit extends \Magento\Backend\Block\Widget
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Eav\Model\Entity\Attribute\SetFactory $attributeSetFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Catalog\Helper\Product $productHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php
index 8b17998f3e4..8ac763c9bd3 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php
@@ -52,7 +52,7 @@ class Attributes
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\Catalog\Helper\Product\Edit\Action\Attribute $attributeAction
@@ -60,7 +60,7 @@ class Attributes
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\Catalog\Helper\Product\Edit\Action\Attribute $attributeAction,
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php
index caa824af9d3..fbbadcafb27 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php
@@ -38,18 +38,18 @@ class AttributeSet extends \Magento\Backend\Block\Widget\Form
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Js.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Js.php
index 71d56a00bbc..eee5cd98fa2 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Js.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Js.php
@@ -31,18 +31,18 @@ class Js extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php
index 298d2066a0c..0e0e7a431b1 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php
@@ -51,14 +51,14 @@ class NewCategory extends \Magento\Backend\Block\Widget\Form\Generic
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Json\EncoderInterface $jsonEncoder
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Catalog\Model\CategoryFactory $categoryFactory,
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php
index 109be40b628..97623f977c0 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php
@@ -49,7 +49,7 @@ class Attributes extends \Magento\Catalog\Block\Adminhtml\Form
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig
      * @param \Magento\Catalog\Helper\Data $catalogData
@@ -57,7 +57,7 @@ class Attributes extends \Magento\Catalog\Block\Adminhtml\Form
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig,
         \Magento\Catalog\Helper\Data $catalogData,
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php
index 199be8aa211..9f430d99f99 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php
@@ -38,7 +38,7 @@ class Search extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -56,14 +56,14 @@ class Search extends \Magento\Backend\Block\Widget
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Core\Model\Resource\HelperPool $helperPool
      * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Core\Model\Resource\HelperPool $helperPool,
         \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_helperPool = $helperPool;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php
index 543b13dc40b..d45749c92a3 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php
@@ -42,7 +42,7 @@ class Crosssell extends Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -85,9 +85,9 @@ class Crosssell extends Extended
      * @param \Magento\Catalog\Model\Product\Type $type
      * @param \Magento\Catalog\Model\Product\Attribute\Source\Status $status
      * @param \Magento\Catalog\Model\Product\Visibility $visibility
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
@@ -99,7 +99,7 @@ class Crosssell extends Extended
         \Magento\Catalog\Model\Product\Type $type,
         \Magento\Catalog\Model\Product\Attribute\Source\Status $status,
         \Magento\Catalog\Model\Product\Visibility $visibility,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_linkFactory = $linkFactory;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php
index 636587c2dca..a0a0d622ead 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php
@@ -48,7 +48,7 @@ class Inventory extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -67,7 +67,7 @@ class Inventory extends \Magento\Backend\Block\Widget
      * @param \Magento\CatalogInventory\Model\Source\Backorders $backorders
      * @param \Magento\CatalogInventory\Model\Source\Stock $stock
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -75,7 +75,7 @@ class Inventory extends \Magento\Backend\Block\Widget
         \Magento\CatalogInventory\Model\Source\Backorders $backorders,
         \Magento\CatalogInventory\Model\Source\Stock $stock,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_stock = $stock;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php
index 5f949d9712d..057f05adde6 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php
@@ -57,7 +57,7 @@ class Option extends Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -86,7 +86,7 @@ class Option extends Widget
      * @param \Magento\Backend\Model\Config\Source\Yesno $configYesNo
      * @param \Magento\Catalog\Model\Config\Source\Product\Options\Type $optionType
      * @param Product $product
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductOptions\ConfigInterface $productOptionConfig
      * @param array $data
      */
@@ -95,7 +95,7 @@ class Option extends Widget
         \Magento\Backend\Model\Config\Source\Yesno $configYesNo,
         \Magento\Catalog\Model\Config\Source\Product\Options\Type $optionType,
         Product $product,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductOptions\ConfigInterface $productOptionConfig,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php
index d5005895241..dcb2025e7f7 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php
@@ -68,7 +68,7 @@ abstract class AbstractGroup
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -87,7 +87,7 @@ abstract class AbstractGroup
      * @param \Magento\Customer\Model\GroupFactory $groupFactory
      * @param \Magento\Directory\Helper\Data $directoryHelper
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
@@ -95,7 +95,7 @@ abstract class AbstractGroup
         \Magento\Customer\Model\GroupFactory $groupFactory,
         \Magento\Directory\Helper\Data $directoryHelper,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_groupFactory = $groupFactory;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Recurring.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Recurring.php
index 9d75d75d8c4..8a166fc65e3 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Recurring.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Recurring.php
@@ -35,18 +35,18 @@ class Recurring
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php
index 1d46c98fcd0..9e482e49e45 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php
@@ -41,7 +41,7 @@ class Related extends Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -84,9 +84,9 @@ class Related extends Extended
      * @param \Magento\Catalog\Model\Product\Type $type
      * @param \Magento\Catalog\Model\Product\Attribute\Source\Status $status
      * @param \Magento\Catalog\Model\Product\Visibility $visibility
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
@@ -98,7 +98,7 @@ class Related extends Extended
         \Magento\Catalog\Model\Product\Type $type,
         \Magento\Catalog\Model\Product\Attribute\Source\Status $status,
         \Magento\Catalog\Model\Product\Visibility $visibility,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_linkFactory = $linkFactory;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php
index c54b896284d..21aa6bdbe69 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php
@@ -38,7 +38,7 @@ class Upsell extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -81,9 +81,9 @@ class Upsell extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Catalog\Model\Product\Type $type
      * @param \Magento\Catalog\Model\Product\Attribute\Source\Status $status
      * @param \Magento\Catalog\Model\Product\Visibility $visibility
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
@@ -95,7 +95,7 @@ class Upsell extends \Magento\Backend\Block\Widget\Grid\Extended
         \Magento\Catalog\Model\Product\Type $type,
         \Magento\Catalog\Model\Product\Attribute\Source\Status $status,
         \Magento\Catalog\Model\Product\Visibility $visibility,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_linkFactory = $linkFactory;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Websites.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Websites.php
index f5472863ae2..b1f1b77c562 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Websites.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Websites.php
@@ -48,7 +48,7 @@ class Websites extends \Magento\Backend\Block\Store\Switcher
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -57,7 +57,7 @@ class Websites extends \Magento\Backend\Block\Store\Switcher
      * @param \Magento\Core\Model\Website\Factory $websiteFactory
      * @param \Magento\Core\Model\Store\Group\Factory $storeGroupFactory
      * @param \Magento\Core\Model\StoreFactory $storeFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -65,7 +65,7 @@ class Websites extends \Magento\Backend\Block\Store\Switcher
         \Magento\Core\Model\Website\Factory $websiteFactory,
         \Magento\Core\Model\Store\Group\Factory $storeGroupFactory,
         \Magento\Core\Model\StoreFactory $storeFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php
index f6324619bee..f64b6aef90f 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php
@@ -48,7 +48,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -89,7 +89,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
      * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $collectionFactory
      * @param \Magento\Catalog\Helper\Catalog $helperCatalog
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Translate\InlineInterface $translateInline,
      * @param array $data
      */
@@ -101,7 +101,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
         \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $collectionFactory,
         \Magento\Catalog\Helper\Catalog $helperCatalog,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Translate\InlineInterface $translateInline,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Options/Ajax.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Options/Ajax.php
index 0f8dcf20482..561fa870009 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Options/Ajax.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Options/Ajax.php
@@ -38,10 +38,10 @@ class Ajax extends \Magento\Backend\Block\AbstractBlock
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
-    
+
     /**
      * Core data
      *
@@ -64,7 +64,7 @@ class Ajax extends \Magento\Backend\Block\AbstractBlock
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\Core\Helper\Data $coreData
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
@@ -72,7 +72,7 @@ class Ajax extends \Magento\Backend\Block\AbstractBlock
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\Core\Helper\Data $coreData,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_jsonEncoder = $jsonEncoder;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit.php
index 55aa5238473..d7fd90046d7 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit.php
@@ -34,18 +34,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $coreRegistry;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->coreRegistry = $registry;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php b/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php
index e0d7a6c78cc..c4c8e36ce01 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php
@@ -43,14 +43,14 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\System\Store $systemStore
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\System\Store $systemStore,
         array $data = array()
diff --git a/app/code/Magento/Catalog/Block/Category/View.php b/app/code/Magento/Catalog/Block/Category/View.php
index ba666afb9bd..fbd25bc687a 100644
--- a/app/code/Magento/Catalog/Block/Category/View.php
+++ b/app/code/Magento/Catalog/Block/Category/View.php
@@ -38,7 +38,7 @@ class View extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -57,14 +57,14 @@ class View extends \Magento\View\Element\Template
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Layer $catalogLayer
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Helper\Category $categoryHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Layer $catalogLayer,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Catalog\Helper\Category $categoryHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Catalog/Block/Navigation.php b/app/code/Magento/Catalog/Block/Navigation.php
index 64b44f44740..bfdceeefa76 100644
--- a/app/code/Magento/Catalog/Block/Navigation.php
+++ b/app/code/Magento/Catalog/Block/Navigation.php
@@ -61,7 +61,7 @@ class Navigation extends \Magento\View\Element\Template
     protected $_catalogCategory;
 
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
@@ -98,7 +98,7 @@ class Navigation extends \Magento\View\Element\Template
      * @param \Magento\Catalog\Model\Layer $catalogLayer
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Catalog\Helper\Category $catalogCategory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\Indexer\Category\Flat\State $flatState
      * @param array $data
      */
@@ -109,7 +109,7 @@ class Navigation extends \Magento\View\Element\Template
         \Magento\Catalog\Model\Layer $catalogLayer,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Catalog\Helper\Category $catalogCategory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\Indexer\Category\Flat\State $flatState,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php
index 3936cc70dc6..dfc9b9d1906 100644
--- a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php
+++ b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php
@@ -102,7 +102,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -160,7 +160,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -177,7 +177,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php
index 78277a259f1..0f8a55f5077 100644
--- a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php
+++ b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php
@@ -115,7 +115,7 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -131,13 +131,13 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare
      * @param \Magento\Customer\Model\Session $customerSession
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Catalog/Block/Product/Gallery.php b/app/code/Magento/Catalog/Block/Product/Gallery.php
index e06f8101145..1c2254ecee6 100644
--- a/app/code/Magento/Catalog/Block/Product/Gallery.php
+++ b/app/code/Magento/Catalog/Block/Product/Gallery.php
@@ -42,18 +42,18 @@ class Gallery extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Catalog/Block/Product/ListProduct.php b/app/code/Magento/Catalog/Block/Product/ListProduct.php
index b0ba12e2030..e36830e5a14 100644
--- a/app/code/Magento/Catalog/Block/Product/ListProduct.php
+++ b/app/code/Magento/Catalog/Block/Product/ListProduct.php
@@ -70,7 +70,7 @@ class ListProduct extends \Magento\Catalog\Block\Product\AbstractProduct
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -83,13 +83,13 @@ class ListProduct extends \Magento\Catalog\Block\Product\AbstractProduct
      * @param \Magento\Catalog\Model\Layer $catalogLayer
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Catalog/Block/Product/NewProduct.php b/app/code/Magento/Catalog/Block/Product/NewProduct.php
index bece75cfdee..69e82649a41 100644
--- a/app/code/Magento/Catalog/Block/Product/NewProduct.php
+++ b/app/code/Magento/Catalog/Block/Product/NewProduct.php
@@ -69,7 +69,7 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -83,13 +83,13 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct
      * @param \Magento\Customer\Model\Session $customerSession
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Catalog/Block/Product/Price.php b/app/code/Magento/Catalog/Block/Product/Price.php
index 9bb09395db7..199ee331d60 100644
--- a/app/code/Magento/Catalog/Block/Product/Price.php
+++ b/app/code/Magento/Catalog/Block/Product/Price.php
@@ -48,10 +48,10 @@ class Price extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
-    
+
     /**
      * Tax data
      *
@@ -91,7 +91,7 @@ class Price extends \Magento\View\Element\Template
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Tax\Helper\Data $taxData
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Stdlib\String $string
      * @param \Magento\Math\Random $mathRandom
      * @param \Magento\Checkout\Helper\Cart $cartHelper
@@ -102,7 +102,7 @@ class Price extends \Magento\View\Element\Template
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Tax\Helper\Data $taxData,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Stdlib\String $string,
         \Magento\Math\Random $mathRandom,
         \Magento\Checkout\Helper\Cart $cartHelper,
diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php
index 11ab978e106..28209babe6a 100644
--- a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php
+++ b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php
@@ -47,7 +47,7 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -62,13 +62,13 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct
      * @param CollectionFactory $productCollectionFactory
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php
index 7a6e1db50f1..02e581ab0a3 100644
--- a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php
+++ b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php
@@ -50,7 +50,7 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -65,13 +65,13 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct
      * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php
index 9987f309131..b1286581aac 100644
--- a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php
+++ b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php
@@ -71,7 +71,7 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -85,13 +85,13 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct
      * @param \Magento\Checkout\Model\Session $checkoutSession
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php
index 97d15a168a1..415cdad407a 100644
--- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php
+++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php
@@ -87,7 +87,7 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -101,13 +101,13 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct
      * @param \Magento\Checkout\Model\Session $checkoutSession
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Catalog/Block/Product/Send.php b/app/code/Magento/Catalog/Block/Product/Send.php
index 43a34fc0c56..dbbe05a2570 100644
--- a/app/code/Magento/Catalog/Block/Product/Send.php
+++ b/app/code/Magento/Catalog/Block/Product/Send.php
@@ -46,7 +46,7 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -58,13 +58,13 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct
      * @param \Magento\Customer\Model\Session $customerSession
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Catalog/Block/Product/TemplateSelector.php b/app/code/Magento/Catalog/Block/Product/TemplateSelector.php
index a2a94fe7f3c..c51eec5fd55 100644
--- a/app/code/Magento/Catalog/Block/Product/TemplateSelector.php
+++ b/app/code/Magento/Catalog/Block/Product/TemplateSelector.php
@@ -36,7 +36,7 @@ class TemplateSelector extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -57,14 +57,14 @@ class TemplateSelector extends \Magento\View\Element\Template
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setColFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setColFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\Resource\Helper $resourceHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php
index 37a8d9a19f7..f746af32736 100644
--- a/app/code/Magento/Catalog/Block/Product/View.php
+++ b/app/code/Magento/Catalog/Block/Product/View.php
@@ -82,7 +82,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -106,7 +106,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php
index bdc3759abfe..b3995daf0ce 100644
--- a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php
+++ b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php
@@ -43,7 +43,7 @@ abstract class AbstractView extends \Magento\Catalog\Block\Product\AbstractProdu
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -55,13 +55,13 @@ abstract class AbstractView extends \Magento\Catalog\Block\Product\AbstractProdu
      * @param \Magento\Stdlib\ArrayUtils $arrayUtils
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Catalog/Block/Product/View/Attributes.php b/app/code/Magento/Catalog/Block/Product/View/Attributes.php
index 5e48b6ef585..1954d4dd28e 100644
--- a/app/code/Magento/Catalog/Block/Product/View/Attributes.php
+++ b/app/code/Magento/Catalog/Block/Product/View/Attributes.php
@@ -46,18 +46,18 @@ class Attributes extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Catalog/Block/Product/View/Description.php b/app/code/Magento/Catalog/Block/Product/View/Description.php
index a0bf623ba8d..e912ce78e1e 100644
--- a/app/code/Magento/Catalog/Block/Product/View/Description.php
+++ b/app/code/Magento/Catalog/Block/Product/View/Description.php
@@ -46,18 +46,18 @@ class Description extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Catalog/Block/Product/View/Options.php b/app/code/Magento/Catalog/Block/Product/View/Options.php
index 817d064fce8..de0ff31a06a 100644
--- a/app/code/Magento/Catalog/Block/Product/View/Options.php
+++ b/app/code/Magento/Catalog/Block/Product/View/Options.php
@@ -53,7 +53,7 @@ class Options extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry = null;
 
@@ -87,7 +87,7 @@ class Options extends \Magento\View\Element\Template
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Model\Product\Option $option
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Stdlib\ArrayUtils $arrayUtils
      * @param array $data
      */
@@ -97,7 +97,7 @@ class Options extends \Magento\View\Element\Template
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Model\Product\Option $option,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Stdlib\ArrayUtils $arrayUtils,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Catalog/Block/Product/View/Price.php b/app/code/Magento/Catalog/Block/Product/View/Price.php
index 9508584f370..77ed346ae8e 100644
--- a/app/code/Magento/Catalog/Block/Product/View/Price.php
+++ b/app/code/Magento/Catalog/Block/Product/View/Price.php
@@ -34,18 +34,18 @@ class Price extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php
index 0904deea705..0eb5f9d7506 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php
@@ -67,8 +67,8 @@ class Category extends \Magento\Backend\App\Action
         if ($activeTabId) {
             $this->_objectManager->get('Magento\Backend\Model\Auth\Session')->setActiveTabId($activeTabId);
         }
-        $this->_objectManager->get('Magento\Core\Model\Registry')->register('category', $category);
-        $this->_objectManager->get('Magento\Core\Model\Registry')->register('current_category', $category);
+        $this->_objectManager->get('Magento\Registry')->register('category', $category);
+        $this->_objectManager->get('Magento\Registry')->register('current_category', $category);
         $this->_objectManager->get('Magento\Cms\Model\Wysiwyg\Config')->setStoreId($this->getRequest()->getParam('store'));
         return $category;
     }
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Widget.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Widget.php
index 73b3f141506..ffec1db6715 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Widget.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Widget.php
@@ -39,17 +39,17 @@ class Widget extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php
index 029aab1ec91..543ea434758 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php
@@ -48,7 +48,7 @@ class Product extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $registry = null;
 
@@ -89,7 +89,7 @@ class Product extends \Magento\Backend\App\Action
 
     /**
      * @param Action\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Filter\Date $dateFilter
      * @param Product\Initialization\Helper $initializationHelper
      * @param Product\Initialization\StockDataFilter $stockFilter
@@ -100,7 +100,7 @@ class Product extends \Magento\Backend\App\Action
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Core\Filter\Date $dateFilter,
         \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper,
         \Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter $stockFilter,
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php
index a0d8791434b..7f7315f65e4 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php
@@ -44,19 +44,19 @@ class Attribute extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
      * @param \Magento\Cache\FrontendInterface $attributeLabelCache
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
         \Magento\Cache\FrontendInterface $attributeLabelCache,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         $this->_attributeLabelCache = $attributeLabelCache;
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Builder.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Builder.php
index 4d6ce38aae0..a9807f3410d 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Builder.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Builder.php
@@ -27,7 +27,7 @@ namespace Magento\Catalog\Controller\Adminhtml\Product;
 use Magento\App\RequestInterface;
 use Magento\Catalog\Model\ProductFactory;
 use Magento\Cms\Model\Wysiwyg;
-use Magento\Core\Model\Registry;
+use Magento\Registry;
 use Magento\Logger;
 
 class Builder
@@ -43,7 +43,7 @@ class Builder
     protected $logger;
 
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $registry;
 
@@ -108,4 +108,4 @@ class Builder
         $this->wysiwygConfig->setStoreId($request->getParam('store'));
         return $product;
     }
-} 
+}
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php
index e5b2602b2b1..4d93042b2db 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php
@@ -40,17 +40,17 @@ class Review extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php
index f082eca4f0b..3d8851898e5 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php
@@ -37,17 +37,17 @@ class Set extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Search.php b/app/code/Magento/Catalog/Controller/Adminhtml/Search.php
index 377ecdf552b..41e9a09c311 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Search.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Search.php
@@ -33,17 +33,17 @@ class Search extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Catalog/Controller/Category.php b/app/code/Magento/Catalog/Controller/Category.php
index f7867fa51ce..b79d6c5c05b 100644
--- a/app/code/Magento/Catalog/Controller/Category.php
+++ b/app/code/Magento/Catalog/Controller/Category.php
@@ -37,7 +37,7 @@ class Category extends \Magento\App\Action\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -72,7 +72,7 @@ class Category extends \Magento\App\Action\Action
      * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
      * @param \Magento\Catalog\Model\Design $catalogDesign
      * @param \Magento\Catalog\Model\Session $catalogSession
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      */
     public function __construct(
@@ -80,7 +80,7 @@ class Category extends \Magento\App\Action\Action
         \Magento\Catalog\Model\CategoryFactory $categoryFactory,
         \Magento\Catalog\Model\Design $catalogDesign,
         \Magento\Catalog\Model\Session $catalogSession,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Core\Model\StoreManagerInterface $storeManager
     ) {
         $this->_storeManager = $storeManager;
diff --git a/app/code/Magento/Catalog/Helper/Data.php b/app/code/Magento/Catalog/Helper/Data.php
index 1bde0389d6d..f00bb2a2005 100644
--- a/app/code/Magento/Catalog/Helper/Data.php
+++ b/app/code/Magento/Catalog/Helper/Data.php
@@ -72,7 +72,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -157,7 +157,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
      * @param \Magento\Stdlib\String $string
      * @param Category $catalogCategory
      * @param Product $catalogProduct
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory
      * @param \Magento\Escaper $escaper
@@ -173,7 +173,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
         \Magento\Stdlib\String $string,
         Category $catalogCategory,
         Product $catalogProduct,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory,
         \Magento\Escaper $escaper,
diff --git a/app/code/Magento/Catalog/Helper/Flat/AbstractFlat.php b/app/code/Magento/Catalog/Helper/Flat/AbstractFlat.php
deleted file mode 100644
index 7157dc49df4..00000000000
--- a/app/code/Magento/Catalog/Helper/Flat/AbstractFlat.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category    Magento
- * @package     Magento_Catalog
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Catalog flat abstract helper
- *
- * @category   Magento
- * @package    Magento_Catalog
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Catalog\Helper\Flat;
-
-abstract class AbstractFlat extends \Magento\App\Helper\AbstractHelper
-{
-    /**
-     * Catalog Flat index process code
-     *
-     * @var null|string
-     */
-    protected $_indexerCode = null;
-
-    /**
-     * Store catalog Flat index process instance
-     *
-     * @var \Magento\Index\Model\Process|null
-     */
-    protected $_process = null;
-
-    /**
-     * Check if Catalog Category Flat Data is enabled
-     *
-     * @return bool
-     */
-    abstract public function isEnabled();
-
-    /**
-     * Process factory
-     *
-     * @var \Magento\Index\Model\ProcessFactory
-     */
-    protected $_processFactory;
-
-    /**
-     * @var bool
-     */
-    protected $_isAvailable;
-
-    /**
-     * @param \Magento\App\Helper\Context $context
-     * @param \Magento\Index\Model\ProcessFactory $processFactory
-     * @param bool $isAvailable
-     */
-    public function __construct(
-        \Magento\App\Helper\Context $context,
-        \Magento\Index\Model\ProcessFactory $processFactory,
-        $isAvailable = true
-    ) {
-        $this->_processFactory = $processFactory;
-        $this->_isAvailable = $isAvailable;
-        parent::__construct($context);
-    }
-
-    /**
-     * Check if Catalog Category Flat Data is available for use
-     *
-     * @return bool
-     */
-    public function isAvailable()
-    {
-        return $this->_isAvailable
-            && $this->isEnabled()
-            && !$this->getProcess()->isLocked()
-            && $this->getProcess()->getStatus() != \Magento\Index\Model\Process::STATUS_RUNNING;
-    }
-
-    /**
-     * Retrieve Catalog Flat index process
-     *
-     * @return \Magento\Index\Model\Process
-     */
-    public function getProcess()
-    {
-        if (is_null($this->_process)) {
-            $this->_process = $this->_processFactory->create()
-                ->load($this->_indexerCode, 'indexer_code');
-        }
-        return $this->_process;
-    }
-}
diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php
index 221195de6b2..416668e0f1e 100644
--- a/app/code/Magento/Catalog/Helper/Image.php
+++ b/app/code/Magento/Catalog/Helper/Image.php
@@ -23,14 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Catalog\Helper;
 
 use Magento\App\Helper\AbstractHelper;
 
 /**
  * Catalog image helper
- *
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Image extends AbstractHelper
 {
@@ -342,7 +341,7 @@ class Image extends AbstractHelper
      * @param int $imageOpacity
      * @return $this
      */
-    public function watermark($fileName, $position, $size=null, $imageOpacity=null)
+    public function watermark($fileName, $position, $size = null, $imageOpacity = null)
     {
         $this->setWatermark($fileName)
             ->setWatermarkPosition($position)
@@ -410,7 +409,21 @@ class Image extends AbstractHelper
                 $url = $model->saveFile()->getUrl();
             }
         } catch (\Exception $e) {
+            $url = $this->getDefaultPlaceholderUrl();
+        }
+        return $url;
+    }
+
+    /**
+     * @return string
+     */
+    protected function getDefaultPlaceholderUrl()
+    {
+        try {
             $url = $this->_viewUrl->getViewFileUrl($this->getPlaceholder());
+        } catch (\Exception $e) {
+            $this->_logger->logException($e);
+            $url = $this->_urlBuilder->getUrl('', array('_direct' => 'core/index/notfound'));
         }
         return $url;
     }
diff --git a/app/code/Magento/Catalog/Helper/Product.php b/app/code/Magento/Catalog/Helper/Product.php
index 3db04544e01..8da045500b1 100644
--- a/app/code/Magento/Catalog/Helper/Product.php
+++ b/app/code/Magento/Catalog/Helper/Product.php
@@ -70,7 +70,7 @@ class Product extends \Magento\Core\Helper\Url
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -129,7 +129,7 @@ class Product extends \Magento\Core\Helper\Url
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\Catalog\Model\Session $catalogSession
      * @param \Magento\View\Url $viewUrl
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Catalog\Model\Attribute\Config $attributeConfig
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\App\ConfigInterface $coreConfig
@@ -142,7 +142,7 @@ class Product extends \Magento\Core\Helper\Url
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\Catalog\Model\Session $catalogSession,
         \Magento\View\Url $viewUrl,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Catalog\Model\Attribute\Config $attributeConfig,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\App\ConfigInterface $coreConfig,
@@ -160,7 +160,7 @@ class Product extends \Magento\Core\Helper\Url
         $this->_coreConfig = $coreConfig;
         $this->_coreStoreConfig = $coreStoreConfig;
         $this->_logger = $context->getLogger();
-        parent::__construct($context, $storeManager);        
+        parent::__construct($context, $storeManager);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Helper/Product/Composite.php b/app/code/Magento/Catalog/Helper/Product/Composite.php
index f87d519dccf..9eaa3849816 100644
--- a/app/code/Magento/Catalog/Helper/Product/Composite.php
+++ b/app/code/Magento/Catalog/Helper/Product/Composite.php
@@ -37,10 +37,10 @@ class Composite extends \Magento\App\Helper\AbstractHelper
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
-    
+
      /**
       * Catalog product
       *
@@ -74,7 +74,7 @@ class Composite extends \Magento\App\Helper\AbstractHelper
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Product $catalogProduct
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\App\ViewInterface $view
      */
     public function __construct(
@@ -83,7 +83,7 @@ class Composite extends \Magento\App\Helper\AbstractHelper
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Product $catalogProduct,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\App\ViewInterface $view
     ) {
         $this->_customerFactory = $customerFactory;
diff --git a/app/code/Magento/Catalog/Helper/Product/Flat.php b/app/code/Magento/Catalog/Helper/Product/Flat.php
deleted file mode 100644
index 6e4dace1fec..00000000000
--- a/app/code/Magento/Catalog/Helper/Product/Flat.php
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category    Magento
- * @package     Magento_Catalog
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Catalog Product Flat Helper
- *
- * @category   Magento
- * @package    Magento_Catalog
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Catalog\Helper\Product;
-
-class Flat extends \Magento\Catalog\Helper\Flat\AbstractFlat
-{
-    /**
-     * Catalog Product Flat Config
-     */
-    const XML_PATH_USE_PRODUCT_FLAT          = 'catalog/frontend/flat_catalog_product';
-
-    /**
-     * @var int
-     */
-    protected $_addFilterableAttrs;
-
-    /**
-     * @var int
-     */
-    protected $_addChildData;
-
-    /**
-     * Catalog Flat Product index process code
-     */
-    const CATALOG_FLAT_PROCESS_CODE = 'catalog_product_flat';
-
-    /**
-     * Catalog Product Flat index process code
-     *
-     * @var string
-     */
-    protected $_indexerCode = self::CATALOG_FLAT_PROCESS_CODE;
-
-    /**
-     * Catalog Product Flat index process instance
-     *
-     * @var \Magento\Index\Model\Process|null
-     */
-    protected $_process = null;
-
-    /**
-     * Store flags which defines if Catalog Product Flat functionality is enabled
-     *
-     * @deprecated after 1.7.0.0
-     *
-     * @var array
-     */
-    protected $_isEnabled = array();
-
-    /**
-     * Core store config
-     *
-     * @var \Magento\Core\Model\Store\Config
-     */
-    protected $_coreStoreConfig;
-
-    /**
-     * @param \Magento\App\Helper\Context $context
-     * @param \Magento\Index\Model\ProcessFactory $processFactory
-     * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param mixed $addFilterableAttrs
-     * @param mixed $addChildData
-     * @param bool $isAvailable
-     */
-    public function __construct(
-        \Magento\App\Helper\Context $context,
-        \Magento\Index\Model\ProcessFactory $processFactory,
-        \Magento\Core\Model\Store\Config $coreStoreConfig,
-        $addFilterableAttrs = 0,
-        $addChildData = 0,
-        $isAvailable = true
-    ) {
-        $this->_coreStoreConfig = $coreStoreConfig;
-        parent::__construct($context, $processFactory, $isAvailable);
-        $this->_addFilterableAttrs = intval($addFilterableAttrs);
-        $this->_addChildData = intval($addChildData);
-    }
-
-    /**
-     * Check Catalog Product Flat functionality is enabled
-     *
-     * @return bool
-     */
-    public function isEnabled()
-    {
-        return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_USE_PRODUCT_FLAT);
-    }
-
-    /**
-     * Is add filterable attributes to Flat table
-     *
-     * @return int
-     */
-    public function isAddFilterableAttributes()
-    {
-        return $this->_addFilterableAttrs;
-    }
-
-    /**
-     * Is add child data to Flat
-     *
-     * @return int
-     */
-    public function isAddChildData()
-    {
-        return $this->_addChildData;
-    }
-}
diff --git a/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php b/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php
index f1dc4ce1406..f0b8f863056 100644
--- a/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php
+++ b/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php
@@ -44,11 +44,6 @@ class Indexer extends \Magento\App\Helper\AbstractHelper
      */
     const BATCH_SIZE = 500;
 
-    /**
-     * @var \Magento\Catalog\Helper\Product\Flat
-     */
-    protected $_flatHelper;
-
     /**
      * Resource instance
      *
@@ -131,36 +126,57 @@ class Indexer extends \Magento\App\Helper\AbstractHelper
      */
     protected $_storeManager;
 
+    /**
+     * @var bool
+     */
+    protected $_addFilterableAttrs;
+
+    /**
+     * @var bool
+     */
+    protected $_addChildData;
+
+    /**
+     * @var \Magento\Mview\View\Changelog
+     */
+    protected $_changelog;
+
     /**
      * @param \Magento\App\Helper\Context $context
      * @param \Magento\App\Resource $resource
-     * @param \Magento\Catalog\Helper\Product\Flat $flatHelper
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Catalog\Model\Attribute\Config $attributeConfig
      * @param \Magento\Catalog\Model\Resource\ConfigFactory $configFactory
      * @param \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
+     * @param \Magento\Mview\View\Changelog $changelog
+     * @param bool $addFilterableAttrs
+     * @param bool $addChildData
      * @param array $flatAttributeGroups
      */
     public function __construct(
         \Magento\App\Helper\Context $context,
         \Magento\App\Resource $resource,
-        \Magento\Catalog\Helper\Product\Flat $flatHelper,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Catalog\Model\Attribute\Config $attributeConfig,
         \Magento\Catalog\Model\Resource\ConfigFactory $configFactory,
         \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
+        \Magento\Mview\View\Changelog $changelog,
+        $addFilterableAttrs = false,
+        $addChildData = false,
         $flatAttributeGroups = array()
     ) {
         $this->_configFactory = $configFactory;
-        $this->_flatHelper = $flatHelper;
         $this->_resource = $resource;
         $this->_eavConfig = $eavConfig;
         $this->_attributeConfig = $attributeConfig;
         $this->_attributeFactory = $attributeFactory;
         $this->_flatAttributeGroups = $flatAttributeGroups;
         $this->_storeManager = $storeManager;
+        $this->_changelog = $changelog;
+        $this->_addFilterableAttrs = $addFilterableAttrs;
+        $this->_addChildData = $addChildData;
         parent::__construct($context);
     }
 
@@ -181,7 +197,7 @@ class Indexer extends \Magento\App\Helper\AbstractHelper
             'primary'   => true,
             'comment'   => 'Entity Id'
         );
-        if ($this->_flatHelper->isAddChildData()) {
+        if ($this->isAddChildData()) {
             $columns['child_id'] = array(
                 'type'      => \Magento\DB\Ddl\Table::TYPE_INTEGER,
                 'length'    => null,
@@ -219,6 +235,26 @@ class Indexer extends \Magento\App\Helper\AbstractHelper
         return $columns;
     }
 
+    /**
+     * Check whether filterable attributes should be added
+     *
+     * @return bool
+     */
+    public function isAddFilterableAttributes()
+    {
+        return $this->_addFilterableAttrs;
+    }
+
+    /**
+     * Check whether child data should be added
+     *
+     * @return bool
+     */
+    public function isAddChildData()
+    {
+        return $this->_addChildData;
+    }
+
     /**
      * Retrieve catalog product flat table columns array
      *
@@ -231,8 +267,8 @@ class Indexer extends \Magento\App\Helper\AbstractHelper
             foreach ($this->getAttributes() as $attribute) {
                 /** @var $attribute \Magento\Eav\Model\Entity\Attribute\AbstractAttribute */
                 $columns = $attribute
-                    ->setFlatAddFilterableAttributes($this->_flatHelper->isAddFilterableAttributes())
-                    ->setFlatAddChildData($this->_flatHelper->isAddChildData())
+                    ->setFlatAddFilterableAttributes($this->isAddFilterableAttributes())
+                    ->setFlatAddChildData($this->isAddChildData())
                     ->getFlatColumns();
                 if ($columns !== null) {
                     $this->_columns = array_merge($this->_columns, $columns);
@@ -333,7 +369,7 @@ class Indexer extends \Magento\App\Helper\AbstractHelper
                 $adapter->quoteInto('additional_table.used_for_sort_by = ?', 1),
                 $adapter->quoteInto('main_table.attribute_code IN(?)', $this->_systemAttributes)
             );
-            if ($this->_flatHelper->isAddFilterableAttributes()) {
+            if ($this->isAddFilterableAttributes()) {
                 $whereCondition[] = $adapter->quoteInto('additional_table.is_filterable > ?', 0);
             }
 
@@ -358,7 +394,7 @@ class Indexer extends \Magento\App\Helper\AbstractHelper
     {
         if ($this->_indexes === null) {
             $this->_indexes = array();
-            if ($this->_flatHelper->isAddChildData()) {
+            if ($this->isAddChildData()) {
                 $this->_indexes['PRIMARY'] = array(
                     'type'   => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY,
                     'fields' => array('entity_id', 'child_id')
@@ -389,8 +425,8 @@ class Indexer extends \Magento\App\Helper\AbstractHelper
             foreach ($this->getAttributes() as $attribute) {
                 /** @var $attribute \Magento\Eav\Model\Entity\Attribute */
                 $indexes = $attribute
-                    ->setFlatAddFilterableAttributes($this->_flatHelper->isAddFilterableAttributes())
-                    ->setFlatAddChildData($this->_flatHelper->isAddChildData())
+                    ->setFlatAddFilterableAttributes($this->isAddFilterableAttributes())
+                    ->setFlatAddChildData($this->isAddChildData())
                     ->getFlatIndexes();
                 if ($indexes !== null) {
                     $this->_indexes = array_merge($this->_indexes, $indexes);
@@ -475,7 +511,12 @@ class Indexer extends \Magento\App\Helper\AbstractHelper
     {
         $connection = $this->_resource->getConnection('write');
         $existentTables = $connection->getTables($connection->getTableName('catalog_product_flat_%'));
-
+        $this->_changelog->setViewId('catalog_product_flat');
+        foreach ($existentTables as $key => $tableName) {
+            if ($this->_changelog->getName() == $tableName) {
+                unset($existentTables[$key]);
+            }
+        }
         $actualStoreTables = array();
         foreach ($this->_storeManager->getStores() as $store) {
             $actualStoreTables[] = $this->getFlatTableName($store->getId());
diff --git a/app/code/Magento/Catalog/Helper/Product/View.php b/app/code/Magento/Catalog/Helper/Product/View.php
index 946d73ff0a3..57851c380e3 100644
--- a/app/code/Magento/Catalog/Helper/Product/View.php
+++ b/app/code/Magento/Catalog/Helper/Product/View.php
@@ -49,10 +49,10 @@ class View extends \Magento\App\Helper\AbstractHelper
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
-    
+
     /**
      * Catalog product
      *
@@ -97,7 +97,7 @@ class View extends \Magento\App\Helper\AbstractHelper
      * @param \Magento\Catalog\Model\Design $catalogDesign
      * @param \Magento\Catalog\Helper\Product $catalogProduct
      * @param \Magento\Theme\Helper\Layout $pageLayout
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\App\ViewInterface $view
      * @param \Magento\Message\ManagerInterface $messageManager
      * @param array $messageGroups
@@ -108,7 +108,7 @@ class View extends \Magento\App\Helper\AbstractHelper
         \Magento\Catalog\Model\Design $catalogDesign,
         \Magento\Catalog\Helper\Product $catalogProduct,
         \Magento\Theme\Helper\Layout $pageLayout,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\App\ViewInterface $view,
         \Magento\Message\ManagerInterface $messageManager,
         array $messageGroups = array()
diff --git a/app/code/Magento/Catalog/Model/AbstractModel.php b/app/code/Magento/Catalog/Model/AbstractModel.php
index 7d559d8220a..ca936a41286 100644
--- a/app/code/Magento/Catalog/Model/AbstractModel.php
+++ b/app/code/Magento/Catalog/Model/AbstractModel.php
@@ -81,16 +81,16 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php
index e15b8d8fe50..13a77872b55 100644
--- a/app/code/Magento/Catalog/Model/Category.php
+++ b/app/code/Magento/Catalog/Model/Category.php
@@ -185,8 +185,8 @@ class Category extends \Magento\Catalog\Model\AbstractModel
     protected $productIndexer;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Model\Resource\Category\Tree $categoryTreeResource
      * @param \Magento\Catalog\Model\Resource\Category\TreeFactory $categoryTreeFactory
@@ -206,8 +206,8 @@ class Category extends \Magento\Catalog\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Model\Resource\Category\Tree $categoryTreeResource,
         \Magento\Catalog\Model\Resource\Category\TreeFactory $categoryTreeFactory,
@@ -931,7 +931,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel
      * @param bool $sorted
      * @param bool $asCollection
      * @param bool $toLoad
-     * @return mixed
+     * @return \Magento\Data\Tree\Node\Collection|\Magento\Catalog\Model\Resource\Category\Collection
      */
     public function getCategories($parent, $recursionLevel = 0, $sorted = false, $asCollection = false, $toLoad = true)
     {
@@ -943,7 +943,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel
     /**
      * Return parent categories of current category
      *
-     * @return array
+     * @return \Magento\Object[]|\Magento\Catalog\Model\Category[]
      */
     public function getParentCategories()
     {
@@ -951,9 +951,9 @@ class Category extends \Magento\Catalog\Model\AbstractModel
     }
 
     /**
-     * Retuen children categories of current category
+     * Return children categories of current category
      *
-     * @return array
+     * @return \Magento\Catalog\Model\Resource\Category\Collection|\Magento\Catalog\Model\Category[]
      */
     public function getChildrenCategories()
     {
diff --git a/app/code/Magento/Catalog/Model/Config/Backend/Category.php b/app/code/Magento/Catalog/Model/Config/Backend/Category.php
index 18aad4f97ea..b058f0d7b26 100644
--- a/app/code/Magento/Catalog/Model/Config/Backend/Category.php
+++ b/app/code/Magento/Catalog/Model/Config/Backend/Category.php
@@ -44,8 +44,8 @@ class Category extends \Magento\Core\Model\Config\Value
     /**
      * Constructor
      *
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Catalog\Model\Category $catalogCategory
@@ -54,8 +54,8 @@ class Category extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Catalog\Model\Category $catalogCategory,
diff --git a/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php b/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php
index c84d18b7ff7..5b962256d64 100644
--- a/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php
+++ b/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php
@@ -48,8 +48,8 @@ class Image extends \Magento\Core\Model\Config\Value
     protected $_attributeCollectionFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory
@@ -59,8 +59,8 @@ class Image extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory,
diff --git a/app/code/Magento/Catalog/Model/Config/Source/Category.php b/app/code/Magento/Catalog/Model/Config/Source/Category.php
index 8e667a3a4a6..10869c903a8 100644
--- a/app/code/Magento/Catalog/Model/Config/Source/Category.php
+++ b/app/code/Magento/Catalog/Model/Config/Source/Category.php
@@ -30,7 +30,7 @@ namespace Magento\Catalog\Model\Config\Source;
  *
  * @SuppressWarnings(PHPMD.LongVariable)
  */
-class Category implements \Magento\Core\Model\Option\ArrayInterface
+class Category implements \Magento\Option\ArrayInterface
 {
     /**
      * Category collection factory
diff --git a/app/code/Magento/Catalog/Model/Config/Source/GridPerPage.php b/app/code/Magento/Catalog/Model/Config/Source/GridPerPage.php
index 9036ec752aa..c86e75ae5f7 100644
--- a/app/code/Magento/Catalog/Model/Config/Source/GridPerPage.php
+++ b/app/code/Magento/Catalog/Model/Config/Source/GridPerPage.php
@@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Config\Source;
  * @package    Magento_Catalog
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-class GridPerPage implements \Magento\Core\Model\Option\ArrayInterface
+class GridPerPage implements \Magento\Option\ArrayInterface
 {
     /**
      * Options
diff --git a/app/code/Magento/Catalog/Model/Config/Source/ListMode.php b/app/code/Magento/Catalog/Model/Config/Source/ListMode.php
index 84c8b62aa46..f8038725e64 100644
--- a/app/code/Magento/Catalog/Model/Config/Source/ListMode.php
+++ b/app/code/Magento/Catalog/Model/Config/Source/ListMode.php
@@ -25,9 +25,7 @@
  */
 namespace Magento\Catalog\Model\Config\Source;
 
-use Magento\Core\Model\Option\ArrayInterface;
-
-class ListMode implements ArrayInterface
+class ListMode implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Catalog/Model/Config/Source/ListPerPage.php b/app/code/Magento/Catalog/Model/Config/Source/ListPerPage.php
index 350336fa9bf..4908baddbe1 100644
--- a/app/code/Magento/Catalog/Model/Config/Source/ListPerPage.php
+++ b/app/code/Magento/Catalog/Model/Config/Source/ListPerPage.php
@@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Config\Source;
  * @package    Magento_Catalog
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-class ListPerPage implements \Magento\Core\Model\Option\ArrayInterface
+class ListPerPage implements \Magento\Option\ArrayInterface
 {
     /**
      * Pager Options
diff --git a/app/code/Magento/Catalog/Model/Config/Source/ListSort.php b/app/code/Magento/Catalog/Model/Config/Source/ListSort.php
index 63e6ffaa794..ca5b41e3527 100644
--- a/app/code/Magento/Catalog/Model/Config/Source/ListSort.php
+++ b/app/code/Magento/Catalog/Model/Config/Source/ListSort.php
@@ -34,7 +34,7 @@
  */
 namespace Magento\Catalog\Model\Config\Source;
 
-class ListSort implements \Magento\Core\Model\Option\ArrayInterface
+class ListSort implements \Magento\Option\ArrayInterface
 {
     /**
      * Catalog config
diff --git a/app/code/Magento/Catalog/Model/Config/Source/Price/Scope.php b/app/code/Magento/Catalog/Model/Config/Source/Price/Scope.php
index db248883d3c..04057d3b039 100644
--- a/app/code/Magento/Catalog/Model/Config/Source/Price/Scope.php
+++ b/app/code/Magento/Catalog/Model/Config/Source/Price/Scope.php
@@ -25,9 +25,7 @@
  */
 namespace Magento\Catalog\Model\Config\Source\Price;
 
-use Magento\Core\Model\Option\ArrayInterface;
-
-class Scope implements ArrayInterface
+class Scope implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Catalog/Model/Config/Source/Price/Step.php b/app/code/Magento/Catalog/Model/Config/Source/Price/Step.php
index 488b4681848..cbff39b70cc 100644
--- a/app/code/Magento/Catalog/Model/Config/Source/Price/Step.php
+++ b/app/code/Magento/Catalog/Model/Config/Source/Price/Step.php
@@ -25,9 +25,7 @@
  */
 namespace Magento\Catalog\Model\Config\Source\Price;
 
-use Magento\Core\Model\Option\ArrayInterface;
-
-class Step implements ArrayInterface
+class Step implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Catalog/Model/Config/Source/Product/Options/Price.php b/app/code/Magento/Catalog/Model/Config/Source/Product/Options/Price.php
index 62fc3de539c..8ea71ba3476 100644
--- a/app/code/Magento/Catalog/Model/Config/Source/Product/Options/Price.php
+++ b/app/code/Magento/Catalog/Model/Config/Source/Product/Options/Price.php
@@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Config\Source\Product\Options;
  * @package    Magento_Catalog
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-class Price implements \Magento\Core\Model\Option\ArrayInterface
+class Price implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Catalog/Model/Config/Source/Product/Options/Type.php b/app/code/Magento/Catalog/Model/Config/Source/Product/Options/Type.php
index 7f4d9a33f51..ec48b7709d8 100644
--- a/app/code/Magento/Catalog/Model/Config/Source/Product/Options/Type.php
+++ b/app/code/Magento/Catalog/Model/Config/Source/Product/Options/Type.php
@@ -26,7 +26,7 @@ namespace Magento\Catalog\Model\Config\Source\Product\Options;
 /**
  * Product option types mode source
  */
-class Type implements \Magento\Core\Model\Option\ArrayInterface
+class Type implements \Magento\Option\ArrayInterface
 {
     /**
      * Product Option Config
diff --git a/app/code/Magento/Catalog/Model/Config/Source/Product/Thumbnail.php b/app/code/Magento/Catalog/Model/Config/Source/Product/Thumbnail.php
index 2fd17f82e1b..8564cd2a53e 100644
--- a/app/code/Magento/Catalog/Model/Config/Source/Product/Thumbnail.php
+++ b/app/code/Magento/Catalog/Model/Config/Source/Product/Thumbnail.php
@@ -31,7 +31,7 @@ namespace Magento\Catalog\Model\Config\Source\Product;
  * @category   Magento
  * @package    Magento_Catalog
  */
-class Thumbnail implements \Magento\Core\Model\Option\ArrayInterface
+class Thumbnail implements \Magento\Option\ArrayInterface
 {
     const OPTION_USE_PARENT_IMAGE = 'parent';
     const OPTION_USE_OWN_IMAGE = 'itself';
diff --git a/app/code/Magento/Catalog/Model/Config/Source/TimeFormat.php b/app/code/Magento/Catalog/Model/Config/Source/TimeFormat.php
index 03795dfba8a..9fd455b4956 100644
--- a/app/code/Magento/Catalog/Model/Config/Source/TimeFormat.php
+++ b/app/code/Magento/Catalog/Model/Config/Source/TimeFormat.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Catalog\Model\Config\Source;
 
-class TimeFormat implements \Magento\Core\Model\Option\ArrayInterface
+class TimeFormat implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Catalog/Model/Config/Source/Watermark/Position.php b/app/code/Magento/Catalog/Model/Config/Source/Watermark/Position.php
index 7c2428e900b..fe91362ded8 100644
--- a/app/code/Magento/Catalog/Model/Config/Source/Watermark/Position.php
+++ b/app/code/Magento/Catalog/Model/Config/Source/Watermark/Position.php
@@ -34,7 +34,7 @@
  */
 namespace Magento\Catalog\Model\Config\Source\Watermark;
 
-class Position implements \Magento\Core\Model\Option\ArrayInterface
+class Position implements \Magento\Option\ArrayInterface
 {
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Design.php b/app/code/Magento/Catalog/Model/Design.php
index 6da61ad22bb..6a4ff5a355e 100644
--- a/app/code/Magento/Catalog/Model/Design.php
+++ b/app/code/Magento/Catalog/Model/Design.php
@@ -52,8 +52,8 @@ class Design extends \Magento\Core\Model\AbstractModel
     protected $_locale;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\View\DesignInterface $design
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -61,8 +61,8 @@ class Design extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\View\DesignInterface $design,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Catalog/Model/Entity/Attribute.php b/app/code/Magento/Catalog/Model/Entity/Attribute.php
index 1f1ec92ef3a..ac657aaa3d0 100644
--- a/app/code/Magento/Catalog/Model/Entity/Attribute.php
+++ b/app/code/Magento/Catalog/Model/Entity/Attribute.php
@@ -96,8 +96,8 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute
     protected $attrLockValidator;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Helper\Data $coreData
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory
@@ -112,8 +112,8 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Helper\Data $coreData,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory,
diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php
index eb64fe93de1..55ffa2c1ad8 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php
@@ -35,8 +35,8 @@ class Mode extends \Magento\Core\Model\Config\Value
     protected $flatIndexer;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer
@@ -45,8 +45,8 @@ class Mode extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Indexer\Model\IndexerInterface $flatIndexer,
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php
index 5c9feef1f8e..6b7a6d7f510 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php
@@ -49,13 +49,6 @@ abstract class AbstractAction
      */
     protected $_valueFieldSuffix = '_value';
 
-    /**
-     * Logger instance
-     *
-     * @var \Magento\Logger
-     */
-    protected $_logger;
-
     /**
      * Resource instance
      *
@@ -82,13 +75,6 @@ abstract class AbstractAction
      */
     protected $_coreStoreConfig;
 
-    /**
-     * Current store number representation
-     *
-     * @var int
-     */
-    protected $_storeId;
-
     /**
      * Suffix for drop table (uses on flat table rename)
      *
@@ -108,13 +94,6 @@ abstract class AbstractAction
      */
     protected $_coreData;
 
-    /**
-     * Product flat helper
-     *
-     * @var \Magento\Catalog\Helper\Product\Flat
-     */
-    protected $_productFlatHelper;
-
     /**
      * @var \Magento\DB\Adapter\AdapterInterface
      */
@@ -132,13 +111,6 @@ abstract class AbstractAction
      */
     protected $_flatTablesExist = array();
 
-    /**
-     * Contains list of created "value" tables
-     *
-     * @var array
-     */
-    protected $_valueTables = array();
-
     /**
      * List of product types available in installation
      *
@@ -147,62 +119,52 @@ abstract class AbstractAction
     protected $_productTypes = array();
 
     /**
-     * Calls amount during current session
-     *
-     * @var int
+     * @var \Magento\Catalog\Model\Indexer\Product\Flat\Processor
      */
-    protected static $_calls = 0;
+    protected $_flatProductProcessor;
 
     /**
-     * @var \Magento\App\ConfigInterface $config
+     * @var TableBuilder
      */
-    protected $_config;
+    protected $_tableBuilder;
 
     /**
-     * @var \Magento\Catalog\Helper\Product\Flat
+     * @var FlatTableBuilder
      */
-    protected $_flatProductHelper;
+    protected $_flatTableBuilder;
 
     /**
-     * @var \Magento\Catalog\Model\Indexer\Product\Flat\Processor
-     */
-    protected $_flatProductProcessor;
-
-    /**
-     * @param \Magento\Logger $logger
      * @param \Magento\App\Resource $resource
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper
      * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig
      * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper
      * @param \Magento\Catalog\Model\Product\Type $productType
-     * @param \Magento\App\ConfigInterface $config
-     * @param \Magento\Catalog\Helper\Product\Flat $flatProductHelper
      * @param Processor $flatProductProcessor
+     * @param TableBuilder $tableBuilder
+     * @param FlatTableBuilder $flatTableBuilder
      */
     public function __construct(
-        \Magento\Logger $logger,
         \Magento\App\Resource $resource,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Model\Resource\Helper $resourceHelper,
         \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig,
         \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper,
         \Magento\Catalog\Model\Product\Type $productType,
-        \Magento\App\ConfigInterface $config,
-        \Magento\Catalog\Helper\Product\Flat $flatProductHelper,
-        \Magento\Catalog\Model\Indexer\Product\Flat\Processor $flatProductProcessor
+        \Magento\Catalog\Model\Indexer\Product\Flat\Processor $flatProductProcessor,
+        \Magento\Catalog\Model\Indexer\Product\Flat\TableBuilder $tableBuilder,
+        \Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder $flatTableBuilder
     ) {
-        $this->_logger = $logger;
         $this->_resource = $resource;
         $this->_storeManager = $storeManager;
         $this->_resourceHelper = $resourceHelper;
         $this->_coreStoreConfig = $coreStoreConfig;
         $this->_productIndexerHelper = $productHelper;
         $this->_productType = $productType;
-        $this->_config = $config;
         $this->_connection = $resource->getConnection('default');
-        $this->_flatProductHelper = $flatProductHelper;
         $this->_flatProductProcessor = $flatProductProcessor;
+        $this->_tableBuilder = $tableBuilder;
+        $this->_flatTableBuilder = $flatTableBuilder;
     }
 
     /**
@@ -236,521 +198,19 @@ abstract class AbstractAction
         return sprintf('%s_tmp_indexer', $tableName);
     }
 
-    /**
-     * Create empty temporary table with given columns list
-     *
-     * @param string $tableName  Table name
-     * @param array $columns array('columnName' => \Magento\Catalog\Model\Resource\Eav\Attribute, ...)
-     *
-     * @return \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
-     */
-    protected function _createTemporaryTable($tableName, array $columns)
-    {
-        if (!empty($columns)) {
-            $valueTableName      = $tableName . $this->_valueFieldSuffix;
-            $temporaryTable      = $this->_connection->newTable($tableName);
-            $valueTemporaryTable = $this->_connection->newTable($valueTableName);
-            $flatColumns         = $this->_productIndexerHelper->getFlatColumns();
-
-            $temporaryTable->addColumn(
-                'entity_id',
-                \Magento\DB\Ddl\Table::TYPE_INTEGER
-            );
-
-            $temporaryTable->addColumn(
-                'type_id',
-                \Magento\DB\Ddl\Table::TYPE_TEXT
-            );
-
-            $temporaryTable->addColumn(
-                'attribute_set_id',
-                \Magento\DB\Ddl\Table::TYPE_INTEGER
-            );
-
-            $valueTemporaryTable->addColumn(
-                'entity_id',
-                \Magento\DB\Ddl\Table::TYPE_INTEGER
-            );
-
-            /** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */
-            foreach ($columns as $columnName => $attribute) {
-                $attributeCode = $attribute->getAttributeCode();
-                if (isset($flatColumns[$attributeCode])) {
-                    $column = $flatColumns[$attributeCode];
-                } else {
-                    $column = $attribute->_getFlatColumnsDdlDefinition();
-                    $column = $column[$attributeCode];
-                }
-
-                $temporaryTable->addColumn(
-                    $columnName,
-                    $column['type'],
-                    isset($column['length']) ? $column['length'] : null
-                );
-
-                $columnValueName = $attributeCode . $this->_valueFieldSuffix;
-                if (isset($flatColumns[$columnValueName])) {
-                    $columnValue = $flatColumns[$columnValueName];
-                    $valueTemporaryTable->addColumn(
-                        $columnValueName,
-                        $columnValue['type'],
-                        isset($columnValue['length']) ? $columnValue['length'] : null
-                    );
-                }
-            }
-            $this->_connection->dropTemporaryTable($tableName);
-            $this->_connection->createTemporaryTable($temporaryTable);
-
-            if (count($valueTemporaryTable->getColumns()) > 1) {
-                $this->_connection->dropTemporaryTable($valueTableName);
-                $this->_connection->createTemporaryTable($valueTemporaryTable);
-                $this->_valueTables[$valueTableName] = $valueTableName;
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * Fill temporary entity table
-     *
-     * @param string $tableName
-     * @param array  $columns
-     * @param array  $changedIds
-     *
-     * @return \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
-     */
-    protected function _fillTemporaryEntityTable($tableName, array $columns, array $changedIds = array())
-    {
-        if (!empty($columns)) {
-            $select = $this->_connection->select();
-            $temporaryEntityTable = $this->_getTemporaryTableName($tableName);
-            $idsColumns = array(
-                'entity_id',
-                'type_id',
-                'attribute_set_id',
-            );
-
-            $columns = array_merge($idsColumns, array_keys($columns));
-
-            $select->from(array('e' => $tableName), $columns);
-            $onDuplicate = false;
-            if (!empty($changedIds)) {
-                $select->where(
-                    $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)
-                );
-                $onDuplicate = true;
-            }
-            $sql = $select->insertFromSelect($temporaryEntityTable, $columns, $onDuplicate);
-            $this->_connection->query($sql);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Fill temporary table by data from products EAV attributes by type
-     *
-     * @param string $tableName
-     * @param array  $tableColumns
-     * @param array  $changedIds
-     *
-     * @return \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
-     */
-    protected function _fillTemporaryTable($tableName, array $tableColumns, array $changedIds)
-    {
-        if (!empty($tableColumns)) {
-
-            $columnsChunks = array_chunk($tableColumns, self::ATTRIBUTES_CHUNK_SIZE, true);
-            foreach ($columnsChunks as $columnsList) {
-                $select                  = $this->_connection->select();
-                $selectValue             = $this->_connection->select();
-                $entityTableName         = $this->_getTemporaryTableName(
-                    $this->_productIndexerHelper->getTable('catalog_product_entity')
-                );
-                $temporaryTableName      = $this->_getTemporaryTableName($tableName);
-                $temporaryValueTableName = $temporaryTableName . $this->_valueFieldSuffix;
-                $keyColumn               = array('entity_id');
-                $columns                 = array_merge($keyColumn, array_keys($columnsList));
-                $valueColumns            = $keyColumn;
-                $flatColumns             = $this->_productIndexerHelper->getFlatColumns();
-                $iterationNum            = 1;
-
-                $select->from(
-                    array('e' => $entityTableName),
-                    $keyColumn
-                );
-
-                $selectValue->from(
-                    array('e' => $temporaryTableName),
-                    $keyColumn
-                );
-
-                /** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */
-                foreach ($columnsList as $columnName => $attribute) {
-                    $countTableName = 't' . $iterationNum++;
-                    $joinCondition  = sprintf(
-                        'e.entity_id = %1$s.entity_id AND %1$s.attribute_id = %2$d AND %1$s.store_id = 0',
-                        $countTableName,
-                        $attribute->getId()
-                    );
-
-                    $select->joinLeft(
-                        array($countTableName => $tableName),
-                        $joinCondition,
-                        array($columnName => 'value')
-                    );
-
-                    if ($attribute->getFlatUpdateSelect($this->_storeId) instanceof \Magento\DB\Select) {
-                        $attributeCode   = $attribute->getAttributeCode();
-                        $columnValueName = $attributeCode . $this->_valueFieldSuffix;
-                        if (isset($flatColumns[$columnValueName])) {
-                            $valueJoinCondition = sprintf(
-                                'e.%1$s = %2$s.option_id AND %2$s.store_id = 0',
-                                $attributeCode,
-                                $countTableName
-                            );
-                            $selectValue->joinLeft(
-                                array($countTableName => $this->_productIndexerHelper->getTable('eav_attribute_option_value')),
-                                $valueJoinCondition,
-                                array($columnValueName => $countTableName . '.value')
-                            );
-                            $valueColumns[] = $columnValueName;
-                        }
-                    }
-                }
-
-                if (!empty($changedIds)) {
-                    $select->where(
-                        $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)
-                    );
-                }
-
-                $sql = $select->insertFromSelect($temporaryTableName, $columns, true);
-                $this->_connection->query($sql);
-
-                if (count($valueColumns) > 1) {
-                    if (!empty($changedIds)) {
-                        $selectValue->where(
-                            $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)
-                        );
-                    }
-                    $sql = $selectValue->insertFromSelect($temporaryValueTableName, $valueColumns, true);
-                    $this->_connection->query($sql);
-                }
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * Add primary key to table by it name
-     *
-     * @param string $tableName
-     * @param string $columnName
-     *
-     * @return \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
-     */
-    protected function _addPrimaryKeyToTable($tableName, $columnName = 'entity_id')
-    {
-        $this->_connection->addIndex(
-            $tableName,
-            'entity_id',
-            array($columnName),
-            \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY
-        );
-
-        return $this;
-    }
-
-    /**
-     * Prepare flat table for store
-     *
-     * @throws \Magento\Core\Exception
-     *
-     * @return \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
-     */
-    protected function _createTemporaryFlatTable()
-    {
-        $columns = $this->_productIndexerHelper->getFlatColumns();
-
-        $indexesNeed  = $this->_productIndexerHelper->getFlatIndexes();
-
-        $maxIndex = $this->_config->getValue(self::XML_NODE_MAX_INDEX_COUNT);
-        if ($maxIndex && count($indexesNeed) > $maxIndex) {
-            throw new \Magento\Core\Exception(
-                __("The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."
-                . "Currently there are %1\$d of them."
-                . "Please reduce the number of filterable/sortable attributes in order to use this module",
-                    count($indexesNeed), $maxIndex)
-            );
-        }
-
-        $indexKeys = array();
-        $indexProps = array_values($indexesNeed);
-        $upperPrimaryKey = strtoupper(\Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY);
-        foreach ($indexProps as $i => $indexProp) {
-            $indexName = $this->_connection->getIndexName(
-                $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($this->_storeId)),
-                $indexProp['fields'],
-                $indexProp['type']
-            );
-            $indexProp['type'] = strtoupper($indexProp['type']);
-            if ($indexProp['type'] == $upperPrimaryKey) {
-                $indexKey = $upperPrimaryKey;
-            } else {
-                $indexKey = $indexName;
-            }
-
-            $indexProps[$i] = array(
-                'KEY_NAME'     => $indexName,
-                'COLUMNS_LIST' => $indexProp['fields'],
-                'INDEX_TYPE'   => strtolower($indexProp['type'])
-            );
-            $indexKeys[$i] = $indexKey;
-        }
-        $indexesNeed = array_combine($indexKeys, $indexProps);
-
-        /** @var $table \Magento\DB\Ddl\Table */
-        $table = $this->_connection->newTable(
-            $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($this->_storeId))
-        );
-        foreach ($columns as $fieldName => $fieldProp) {
-            $columnLength = isset($fieldProp['length']) ? $fieldProp['length'] : null;
-
-            $columnDefinition = array(
-                'nullable' => isset($fieldProp['nullable']) ? (bool)$fieldProp['nullable'] : false,
-                'unsigned' => isset($fieldProp['unsigned']) ? (bool)$fieldProp['unsigned'] : false,
-                'default'  => isset($fieldProp['default']) ? $fieldProp['default'] : false,
-                'primary'  => false,
-            );
-
-            $columnComment = isset($fieldProp['comment']) ? $fieldProp['comment'] : $fieldName;
-
-            $table->addColumn(
-                $fieldName,
-                $fieldProp['type'],
-                $columnLength,
-                $columnDefinition,
-                $columnComment
-            );
-        }
-
-        foreach ($indexesNeed as $indexProp) {
-            $table->addIndex(
-                $indexProp['KEY_NAME'], $indexProp['COLUMNS_LIST'],
-                array('type' => $indexProp['INDEX_TYPE'])
-            );
-        }
-
-        $table->setComment("Catalog Product Flat (Store {$this->_storeId})");
-
-        $this->_connection->dropTable(
-            $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($this->_storeId))
-        );
-        $this->_connection->createTable($table);
-
-        return $this;
-    }
-
-    /**
-     * Fill temporary flat table by data from temporary flat table parts
-     *
-     * @param array $tables
-     *
-     * @return \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
-     */
-    protected function _fillTemporaryFlatTable(array $tables)
-    {
-        $select                   = $this->_connection->select();
-        $temporaryFlatTableName   = $this->_getTemporaryTableName(
-            $this->_productIndexerHelper->getFlatTableName($this->_storeId)
-        );
-        $flatColumns              = $this->_productIndexerHelper->getFlatColumns();
-        $entityTableName          = $this->_productIndexerHelper->getTable('catalog_product_entity');
-        $entityTemporaryTableName = $this->_getTemporaryTableName($entityTableName);
-        $columnsList              = array_keys($tables[$entityTableName]);
-        $websiteId                = (int)$this->_storeManager->getStore($this->_storeId)->getWebsiteId();
-
-        unset($tables[$entityTableName]);
-
-        $allColumns = array_merge(
-            array(
-                'entity_id',
-                'type_id',
-                'attribute_set_id',
-            ),
-            $columnsList
-        );
-
-        /* @var $status \Magento\Eav\Model\Entity\Attribute */
-        $status = $this->_productIndexerHelper->getAttribute('status');
-        $statusTable = $this->_getTemporaryTableName($status->getBackendTable());
-        $statusConditions = array('e.entity_id = dstatus.entity_id',
-            'dstatus.entity_type_id = ' . (int)$status->getEntityTypeId(), 'dstatus.store_id = ' . (int)$this->_storeId,
-            'dstatus.attribute_id = ' . (int)$status->getId());
-        $statusExpression = $this->_connection->getIfNullSql('dstatus.value',
-            $this->_connection->quoteIdentifier("$statusTable.status"));
-
-        $select->from(
-            array('e' => $entityTemporaryTableName),
-            $allColumns
-        )->joinInner(
-                array('wp' => $this->_productIndexerHelper->getTable('catalog_product_website')),
-                'wp.product_id = e.entity_id AND wp.website_id = ' . $websiteId,
-                array()
-            )->joinLeft(
-                array('dstatus' => $status->getBackend()->getTable()),
-                implode(' AND ', $statusConditions),
-                array()
-            )->where(
-                $statusExpression . ' = ' . \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
-            );
-
-        foreach ($tables as $tableName => $columns) {
-            $columnValueNames        = array();
-            $temporaryTableName      = $this->_getTemporaryTableName($tableName);
-            $temporaryValueTableName = $temporaryTableName . $this->_valueFieldSuffix;
-            $columnsNames            = array_keys($columns);
-
-            $select->joinLeft(
-                $temporaryTableName,
-                'e.entity_id = ' . $temporaryTableName. '.entity_id',
-                $columnsNames
-            );
-            $allColumns = array_merge($allColumns, $columnsNames);
-
-            foreach ($columnsNames as $name ) {
-                $columnValueName = $name . $this->_valueFieldSuffix;
-                if (isset($flatColumns[$columnValueName])) {
-                    $columnValueNames[] = $columnValueName;
-                }
-            }
-            if (!empty($columnValueNames)) {
-                $select->joinLeft(
-                    $temporaryValueTableName,
-                    'e.entity_id = ' . $temporaryValueTableName. '.entity_id',
-                    $columnValueNames
-                );
-                $allColumns = array_merge($allColumns, $columnValueNames);
-            }
-        }
-        $sql = $select->insertFromSelect($temporaryFlatTableName, $allColumns, false);
-        $this->_connection->query($sql);
-
-        return $this;
-    }
-
-    /**
-     * Apply diff. between 0 store and current store to temporary flat table
-     *
-     * @param array $tables
-     * @param array $changedIds
-     *
-     * @return \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
-     */
-    protected function _updateTemporaryTableByStoreValues(array $tables, array $changedIds)
-    {
-        $flatColumns = $this->_productIndexerHelper->getFlatColumns();
-        $temporaryFlatTableName = $this->_getTemporaryTableName(
-            $this->_productIndexerHelper->getFlatTableName($this->_storeId)
-        );
-
-        foreach ($tables as $tableName => $columns) {
-            foreach ($columns as $attribute) {
-                /* @var $attribute \Magento\Eav\Model\Entity\Attribute */
-                $attributeCode = $attribute->getAttributeCode();
-                if ($attribute->getBackend()->getType() != 'static') {
-                    $joinCondition = 't.entity_id = e.entity_id'
-                        . ' AND t.entity_type_id = ' . $attribute->getEntityTypeId()
-                        . ' AND t.attribute_id=' . $attribute->getId()
-                        . ' AND t.store_id = ' . $this->_storeId
-                        . ' AND t.value IS NOT NULL';
-                    /** @var $select \Magento\DB\Select */
-                    $select = $this->_connection->select()
-                        ->joinInner(
-                            array('t' => $tableName),
-                            $joinCondition,
-                            array($attributeCode => 't.value')
-                        );
-                    if (!empty($changedIds)) {
-                        $select->where(
-                            $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)
-                        );
-                    }
-                    $sql = $select->crossUpdateFromSelect(array('e' => $temporaryFlatTableName));
-                    $this->_connection->query($sql);
-                }
-
-                //Update not simple attributes (eg. dropdown)
-                if (isset($flatColumns[$attributeCode . $this->_valueFieldSuffix])) {
-                    $select = $this->_connection->select()
-                        ->joinInner(
-                            array('t' => $this->_productIndexerHelper->getTable('eav_attribute_option_value')),
-                            't.option_id = e.' . $attributeCode . ' AND t.store_id=' . $this->_storeId,
-                            array($attributeCode . $this->_valueFieldSuffix => 't.value')
-                        );
-                    if (!empty($changedIds)) {
-                        $select->where(
-                            $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)
-                        );
-                    }
-                    $sql = $select->crossUpdateFromSelect(array('e' => $temporaryFlatTableName));
-                    $this->_connection->query($sql);
-                }
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * Swap flat product table and temporary flat table and drop old one
-     *
-     * @return \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
-     */
-    protected function _moveDataToFlatTable()
-    {
-        $flatTable              = $this->_productIndexerHelper->getFlatTableName($this->_storeId);
-        $flatDropName           = $flatTable . $this->_tableDropSuffix;
-        $temporaryFlatTableName = $this->_getTemporaryTableName(
-            $this->_productIndexerHelper->getFlatTableName($this->_storeId)
-        );
-        $renameTables           = array();
-
-        if ($this->_connection->isTableExists($flatTable)) {
-            $renameTables[] = array(
-                'oldName' => $flatTable,
-                'newName' => $flatDropName,
-            );
-        }
-        $renameTables[] = array(
-            'oldName' => $temporaryFlatTableName,
-            'newName' => $flatTable,
-        );
-
-        $this->_connection->dropTable($flatDropName);
-        $this->_connection->renameTablesBatch($renameTables);
-        $this->_connection->dropTable($flatDropName);
-
-        return $this;
-    }
-
     /**
      * Drop temporary tables created by reindex process
      *
      * @param array $tablesList
-     *
-     * @return \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
+     * @param int|string $storeId
      */
-    protected function _cleanOnFailure(array $tablesList)
+    protected function _cleanOnFailure(array $tablesList, $storeId)
     {
         foreach ($tablesList as $table => $columns) {
             $this->_connection->dropTemporaryTable($table);
         }
-        $tableName = $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($this->_storeId));
+        $tableName = $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId));
         $this->_connection->dropTable($tableName);
-        return $this;
     }
 
     /**
@@ -759,70 +219,24 @@ abstract class AbstractAction
      * @param int $storeId
      * @param array $changedIds
      *
-     * @return \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
      * @throws \Exception
      */
     protected function _reindex($storeId, array $changedIds = array())
     {
-        $this->_storeId     = $storeId;
-        $entityTableName    = $this->_productIndexerHelper->getTable('catalog_product_entity');
-        $attributes         = $this->_productIndexerHelper->getAttributes();
-        $eavAttributes      = $this->_productIndexerHelper->getTablesStructure($attributes);
-        $entityTableColumns = $eavAttributes[$entityTableName];
-
         try {
-            //We should prepare temp. tables only for first call of reindex all
-            if (!self::$_calls) {
-                $temporaryEavAttributes = $eavAttributes;
-
-                //add status global value to the base table
-                /* @var $status \Magento\Eav\Model\Entity\Attribute */
-                $status = $this->_productIndexerHelper->getAttribute('status');
-                $temporaryEavAttributes[$status->getBackendTable()]['status'] = $status;
-                //Create list of temporary tables based on available attributes attributes
-                foreach ($temporaryEavAttributes as $tableName => $columns) {
-                    $this->_createTemporaryTable($this->_getTemporaryTableName($tableName), $columns);
-                }
-
-                //Fill "base" table which contains all available products
-                $this->_fillTemporaryEntityTable($entityTableName, $entityTableColumns, $changedIds);
-
-                //Add primary key to "base" temporary table for increase speed of joins in future
-                $this->_addPrimaryKeyToTable($this->_getTemporaryTableName($entityTableName));
-                unset($temporaryEavAttributes[$entityTableName]);
-
-                foreach ($temporaryEavAttributes as $tableName => $columns) {
-                    $temporaryTableName = $this->_getTemporaryTableName($tableName);
-
-                    //Add primary key to temporary table for increase speed of joins in future
-                    $this->_addPrimaryKeyToTable($temporaryTableName);
-
-                    //Create temporary table for composite attributes
-                    if (isset($this->_valueTables[$temporaryTableName . $this->_valueFieldSuffix])) {
-                        $this->_addPrimaryKeyToTable($temporaryTableName . $this->_valueFieldSuffix);
-                    }
-
-                    //Fill temporary tables with attributes grouped by it type
-                    $this->_fillTemporaryTable($tableName, $columns, $changedIds);
-                }
-            }
-            //Create and fill flat temporary table
-            $this->_createTemporaryFlatTable();
-            $this->_fillTemporaryFlatTable($eavAttributes);
-            //Update zero based attributes by values from current store
-            $this->_updateTemporaryTableByStoreValues($eavAttributes, $changedIds);
+            $this->_tableBuilder->build($storeId, $changedIds, $this->_valueFieldSuffix);
+            $this->_flatTableBuilder->build(
+                $storeId, $changedIds, $this->_valueFieldSuffix, $this->_tableDropSuffix, true
+            );
 
-            //Rename current flat table to "drop", rename temporary flat to flat and drop "drop" table
-            $this->_moveDataToFlatTable();
-            $this->_updateRelationProducts($this->_storeId, $changedIds);
-            $this->_cleanRelationProducts($this->_storeId);
-            self::$_calls++;
+            $this->_updateRelationProducts($storeId, $changedIds);
+            $this->_cleanRelationProducts($storeId);
         } catch (\Exception $e) {
-            $this->_cleanOnFailure($eavAttributes);
+            $attributes = $this->_productIndexerHelper->getAttributes();
+            $eavAttributes = $this->_productIndexerHelper->getTablesStructure($attributes);
+            $this->_cleanOnFailure($eavAttributes, $storeId);
             throw $e;
         }
-
-        return $this;
     }
 
     /**
@@ -877,7 +291,7 @@ abstract class AbstractAction
      */
     protected function _updateRelationProducts($storeId, $productIds = null)
     {
-        if (!$this->_flatProductHelper->isAddChildData() || !$this->_isFlatTableExists($storeId)) {
+        if (!$this->_productIndexerHelper->isAddChildData() || !$this->_isFlatTableExists($storeId)) {
             return $this;
         }
 
@@ -934,7 +348,7 @@ abstract class AbstractAction
      */
     protected function _cleanRelationProducts($storeId)
     {
-        if (!$this->_flatProductHelper->isAddChildData()) {
+        if (!$this->_productIndexerHelper->isAddChildData()) {
             return $this;
         }
 
@@ -994,13 +408,12 @@ abstract class AbstractAction
      */
     protected function _reindexSingleProduct($storeId, $productId)
     {
-        $this->_storeId = $storeId;
-
-        $flatTable = $this->_productIndexerHelper->getFlatTableName($this->_storeId);
+        $flatTable = $this->_productIndexerHelper->getFlatTableName($storeId);
 
         if (!$this->_connection->isTableExists($flatTable)) {
-            $this->_createTemporaryFlatTable();
-            $this->_moveDataToFlatTable();
+            $this->_flatTableBuilder->build(
+                $storeId, array($productId), $this->_valueFieldSuffix, $this->_tableDropSuffix, false
+            );
         }
 
         $attributes    = $this->_productIndexerHelper->getAttributes();
@@ -1050,7 +463,7 @@ abstract class AbstractAction
                             array('t2' => $tableName),
                             't.entity_id = t2.entity_id '
                             . ' AND t.attribute_id = t2.attribute_id  '
-                            . $this->_connection->quoteInto(' AND t2.store_id = ?', $this->_storeId),
+                            . $this->_connection->quoteInto(' AND t2.store_id = ?', $storeId),
                             array()
                         )->where(
                             'e.entity_id = ' . $productId
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php
index f6666302857..9c9ff84e301 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php
@@ -55,42 +55,4 @@ class Rows extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
         }
         return $this;
     }
-
-    /**
-     * Move data from temporary flat table into regular flat table.
-     *
-     * @return \Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows
-     */
-    protected function _moveDataToFlatTable()
-    {
-        $flatTable = $this->_productIndexerHelper->getFlatTableName($this->_storeId);
-
-        if (!$this->_connection->isTableExists($flatTable)) {
-            parent::_moveDataToFlatTable();
-        } else {
-            $describe = $this->_connection->describeTable(
-                $this->_productIndexerHelper->getFlatTableName($this->_storeId)
-            );
-            $columns  = $this->_productIndexerHelper->getFlatColumns();
-            $columns  = array_keys(array_intersect_key($describe, $columns));
-            $select   = $this->_connection->select();
-
-            $select->from(
-                array(
-                    'tf' => $this->_getTemporaryTableName(
-                            $this->_productIndexerHelper->getFlatTableName($this->_storeId)
-                        ),
-                ),
-                $columns
-            );
-            $sql = $select->insertFromSelect($flatTable, $columns);
-            $this->_connection->query($sql);
-
-            $this->_connection->dropTable(
-                $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($this->_storeId))
-            );
-        }
-
-        return $this;
-    }
 }
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows/TableData.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows/TableData.php
new file mode 100644
index 00000000000..0033c0c8f6f
--- /dev/null
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows/TableData.php
@@ -0,0 +1,96 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_Catalog
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows;
+
+/**
+ * Class TableData
+ * @package Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows
+ */
+class TableData implements \Magento\Catalog\Model\Indexer\Product\Flat\TableDataInterface
+{
+    /**
+     * @var \Magento\DB\Adapter\AdapterInterface
+     */
+    protected $_connection;
+
+    /**
+     * @var \Magento\Catalog\Helper\Product\Flat\Indexer
+     */
+    protected $_productIndexerHelper;
+
+    /**
+     * @var \Magento\App\Resource
+     */
+    protected $_resource;
+
+    /**
+     * @param \Magento\App\Resource $resource
+     * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper
+     */
+    public function __construct(
+        \Magento\App\Resource $resource,
+        \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper
+    ) {
+        $this->_resource = $resource;
+        $this->_productIndexerHelper = $productIndexerHelper;
+    }
+
+    /**
+     * Move data from temporary tables to flat
+     *
+     * @param string $flatTable
+     * @param string $flatDropName
+     * @param string $temporaryFlatTableName
+     */
+    public function move($flatTable, $flatDropName, $temporaryFlatTableName)
+    {
+        $connection = $this->_resource->getConnection('write');
+        if (!$connection->isTableExists($flatTable)) {
+            $connection->dropTable($flatDropName);
+            $connection->renameTablesBatch(array(
+                'oldName' => $temporaryFlatTableName,
+                'newName' => $flatTable
+            ));
+            $connection->dropTable($flatDropName);
+        } else {
+            $describe = $connection->describeTable($flatTable);
+            $columns  = $this->_productIndexerHelper->getFlatColumns();
+            $columns  = array_keys(array_intersect_key($describe, $columns));
+            $select   = $connection->select();
+
+            $select->from(
+                array('tf' => sprintf('%s_tmp_indexer', $flatTable)),
+                $columns
+            );
+            $sql = $select->insertFromSelect($flatTable, $columns);
+            $connection->query($sql);
+
+            $connection->dropTable(
+                sprintf('%s_tmp_indexer', $flatTable)
+            );
+        }
+    }
+}
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php
new file mode 100644
index 00000000000..33db7166420
--- /dev/null
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php
@@ -0,0 +1,357 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_Catalog
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Catalog\Model\Indexer\Product\Flat;
+
+/**
+ * Class FlatTableBuilder
+ * @package Magento\Catalog\Model\Indexer\Product\Flat
+ */
+class FlatTableBuilder
+{
+    /**
+     * @var \Magento\Catalog\Helper\Product\Flat\Indexer
+     */
+    protected $_productIndexerHelper;
+
+    /**
+     * @var \Magento\DB\Adapter\AdapterInterface
+     */
+    protected $_connection;
+
+    /**
+     * @var \Magento\App\ConfigInterface $config
+     */
+    protected $_config;
+
+    /**
+     * @var \Magento\Core\Model\StoreManagerInterface
+     */
+    protected $_storeManager;
+
+    /**
+     * @var TableDataInterface
+     */
+    protected $_tableData;
+
+    /**
+     * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper
+     * @param \Magento\App\Resource $resource
+     * @param \Magento\App\ConfigInterface $config
+     * @param \Magento\Core\Model\StoreManagerInterface $storeManager
+     * @param TableDataInterface $tableData
+     */
+    public function __construct(
+        \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper,
+        \Magento\App\Resource $resource,
+        \Magento\App\ConfigInterface $config,
+        \Magento\Core\Model\StoreManagerInterface $storeManager,
+        \Magento\Catalog\Model\Indexer\Product\Flat\TableDataInterface $tableData
+    ) {
+        $this->_productIndexerHelper = $productIndexerHelper;
+        $this->_connection = $resource->getConnection('write');
+        $this->_config = $config;
+        $this->_storeManager = $storeManager;
+        $this->_tableData = $tableData;
+    }
+
+    /**
+     * Prepare temporary flat tables
+     *
+     * @param int|string $storeId
+     * @param array $changedIds
+     * @param string $valueFieldSuffix
+     * @param string $tableDropSuffix
+     * @param bool $fillTmpTables
+     */
+    public function build($storeId, $changedIds, $valueFieldSuffix, $tableDropSuffix, $fillTmpTables)
+    {
+        $attributes = $this->_productIndexerHelper->getAttributes();
+        $eavAttributes = $this->_productIndexerHelper->getTablesStructure($attributes);
+
+
+        $this->_createTemporaryFlatTable($storeId);
+
+        if ($fillTmpTables) {
+            $this->_fillTemporaryFlatTable($eavAttributes, $storeId, $valueFieldSuffix);
+            //Update zero based attributes by values from current store
+            $this->_updateTemporaryTableByStoreValues($eavAttributes, $changedIds, $storeId, $valueFieldSuffix);
+        }
+
+        $flatTable = $this->_productIndexerHelper->getFlatTableName($storeId);
+        $flatDropName = $flatTable . $tableDropSuffix;
+        $temporaryFlatTableName = $this->_getTemporaryTableName(
+            $this->_productIndexerHelper->getFlatTableName($storeId)
+        );
+        $this->_tableData->move($flatTable, $flatDropName, $temporaryFlatTableName);
+    }
+
+    /**
+     * Prepare flat table for store
+     *
+     * @param int|string $storeId
+     * @throws \Magento\Core\Exception
+     */
+    protected function _createTemporaryFlatTable($storeId)
+    {
+        $columns = $this->_productIndexerHelper->getFlatColumns();
+
+        $indexesNeed  = $this->_productIndexerHelper->getFlatIndexes();
+
+        $maxIndex = $this->_config->getValue(
+            \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction::XML_NODE_MAX_INDEX_COUNT
+        );
+        if ($maxIndex && count($indexesNeed) > $maxIndex) {
+            throw new \Magento\Core\Exception(
+                __("The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes."
+                    . "Currently there are %1\$d of them."
+                    . "Please reduce the number of filterable/sortable attributes in order to use this module",
+                    count($indexesNeed), $maxIndex)
+            );
+        }
+
+        $indexKeys = array();
+        $indexProps = array_values($indexesNeed);
+        $upperPrimaryKey = strtoupper(\Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY);
+        foreach ($indexProps as $i => $indexProp) {
+            $indexName = $this->_connection->getIndexName(
+                $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId)),
+                $indexProp['fields'],
+                $indexProp['type']
+            );
+            $indexProp['type'] = strtoupper($indexProp['type']);
+            if ($indexProp['type'] == $upperPrimaryKey) {
+                $indexKey = $upperPrimaryKey;
+            } else {
+                $indexKey = $indexName;
+            }
+
+            $indexProps[$i] = array(
+                'KEY_NAME'     => $indexName,
+                'COLUMNS_LIST' => $indexProp['fields'],
+                'INDEX_TYPE'   => strtolower($indexProp['type'])
+            );
+            $indexKeys[$i] = $indexKey;
+        }
+        $indexesNeed = array_combine($indexKeys, $indexProps);
+
+        /** @var $table \Magento\DB\Ddl\Table */
+        $table = $this->_connection->newTable(
+            $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId))
+        );
+        foreach ($columns as $fieldName => $fieldProp) {
+            $columnLength = isset($fieldProp['length']) ? $fieldProp['length'] : null;
+
+            $columnDefinition = array(
+                'nullable' => isset($fieldProp['nullable']) ? (bool)$fieldProp['nullable'] : false,
+                'unsigned' => isset($fieldProp['unsigned']) ? (bool)$fieldProp['unsigned'] : false,
+                'default'  => isset($fieldProp['default']) ? $fieldProp['default'] : false,
+                'primary'  => false,
+            );
+
+            $columnComment = isset($fieldProp['comment']) ? $fieldProp['comment'] : $fieldName;
+
+            $table->addColumn(
+                $fieldName,
+                $fieldProp['type'],
+                $columnLength,
+                $columnDefinition,
+                $columnComment
+            );
+        }
+
+        foreach ($indexesNeed as $indexProp) {
+            $table->addIndex(
+                $indexProp['KEY_NAME'], $indexProp['COLUMNS_LIST'],
+                array('type' => $indexProp['INDEX_TYPE'])
+            );
+        }
+
+        $table->setComment("Catalog Product Flat (Store {$storeId})");
+
+        $this->_connection->dropTable(
+            $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId))
+        );
+        $this->_connection->createTable($table);
+    }
+
+    /**
+     * Fill temporary flat table by data from temporary flat table parts
+     *
+     * @param array $tables
+     * @param int|string $storeId
+     * @param string $valueFieldSuffix
+     */
+    protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldSuffix)
+    {
+        $select                   = $this->_connection->select();
+        $temporaryFlatTableName   = $this->_getTemporaryTableName(
+            $this->_productIndexerHelper->getFlatTableName($storeId)
+        );
+        $flatColumns              = $this->_productIndexerHelper->getFlatColumns();
+        $entityTableName          = $this->_productIndexerHelper->getTable('catalog_product_entity');
+        $entityTemporaryTableName = $this->_getTemporaryTableName($entityTableName);
+        $columnsList              = array_keys($tables[$entityTableName]);
+        $websiteId                = (int)$this->_storeManager->getStore($storeId)->getWebsiteId();
+
+        unset($tables[$entityTableName]);
+
+        $allColumns = array_merge(
+            array(
+                'entity_id',
+                'type_id',
+                'attribute_set_id',
+            ),
+            $columnsList
+        );
+
+        /* @var $status \Magento\Eav\Model\Entity\Attribute */
+        $status = $this->_productIndexerHelper->getAttribute('status');
+        $statusTable = $this->_getTemporaryTableName($status->getBackendTable());
+        $statusConditions = array('e.entity_id = dstatus.entity_id',
+            'dstatus.entity_type_id = ' . (int)$status->getEntityTypeId(), 'dstatus.store_id = ' . (int)$storeId,
+            'dstatus.attribute_id = ' . (int)$status->getId());
+        $statusExpression = $this->_connection->getIfNullSql('dstatus.value',
+            $this->_connection->quoteIdentifier("$statusTable.status"));
+
+        $select->from(
+            array('e' => $entityTemporaryTableName),
+            $allColumns
+        )->joinInner(
+                array('wp' => $this->_productIndexerHelper->getTable('catalog_product_website')),
+                'wp.product_id = e.entity_id AND wp.website_id = ' . $websiteId,
+                array()
+            )->joinLeft(
+                array('dstatus' => $status->getBackend()->getTable()),
+                implode(' AND ', $statusConditions),
+                array()
+            )->where(
+                $statusExpression . ' = ' . \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
+            );
+
+        foreach ($tables as $tableName => $columns) {
+            $columnValueNames        = array();
+            $temporaryTableName      = $this->_getTemporaryTableName($tableName);
+            $temporaryValueTableName = $temporaryTableName . $valueFieldSuffix;
+            $columnsNames            = array_keys($columns);
+
+            $select->joinLeft(
+                $temporaryTableName,
+                'e.entity_id = ' . $temporaryTableName. '.entity_id',
+                $columnsNames
+            );
+            $allColumns = array_merge($allColumns, $columnsNames);
+
+            foreach ($columnsNames as $name ) {
+                $columnValueName = $name . $valueFieldSuffix;
+                if (isset($flatColumns[$columnValueName])) {
+                    $columnValueNames[] = $columnValueName;
+                }
+            }
+            if (!empty($columnValueNames)) {
+                $select->joinLeft(
+                    $temporaryValueTableName,
+                    'e.entity_id = ' . $temporaryValueTableName. '.entity_id',
+                    $columnValueNames
+                );
+                $allColumns = array_merge($allColumns, $columnValueNames);
+            }
+        }
+        $sql = $select->insertFromSelect($temporaryFlatTableName, $allColumns, false);
+        $this->_connection->query($sql);
+    }
+
+    /**
+     * Apply diff. between 0 store and current store to temporary flat table
+     *
+     * @param array $tables
+     * @param array $changedIds
+     * @param int|string $storeId
+     * @param string $valueFieldSuffix
+     */
+    protected function _updateTemporaryTableByStoreValues(array $tables, array $changedIds, $storeId, $valueFieldSuffix)
+    {
+        $flatColumns = $this->_productIndexerHelper->getFlatColumns();
+        $temporaryFlatTableName = $this->_getTemporaryTableName(
+            $this->_productIndexerHelper->getFlatTableName($storeId)
+        );
+
+        foreach ($tables as $tableName => $columns) {
+            foreach ($columns as $attribute) {
+                /* @var $attribute \Magento\Eav\Model\Entity\Attribute */
+                $attributeCode = $attribute->getAttributeCode();
+                if ($attribute->getBackend()->getType() != 'static') {
+                    $joinCondition = 't.entity_id = e.entity_id'
+                        . ' AND t.entity_type_id = ' . $attribute->getEntityTypeId()
+                        . ' AND t.attribute_id=' . $attribute->getId()
+                        . ' AND t.store_id = ' . $storeId
+                        . ' AND t.value IS NOT NULL';
+                    /** @var $select \Magento\DB\Select */
+                    $select = $this->_connection->select()
+                        ->joinInner(
+                            array('t' => $tableName),
+                            $joinCondition,
+                            array($attributeCode => 't.value')
+                        );
+                    if (!empty($changedIds)) {
+                        $select->where(
+                            $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)
+                        );
+                    }
+                    $sql = $select->crossUpdateFromSelect(array('e' => $temporaryFlatTableName));
+                    $this->_connection->query($sql);
+                }
+
+                //Update not simple attributes (eg. dropdown)
+                if (isset($flatColumns[$attributeCode . $valueFieldSuffix])) {
+                    $select = $this->_connection->select()
+                        ->joinInner(
+                            array('t' => $this->_productIndexerHelper->getTable('eav_attribute_option_value')),
+                            't.option_id = e.' . $attributeCode . ' AND t.store_id=' . $storeId,
+                            array($attributeCode . $valueFieldSuffix => 't.value')
+                        );
+                    if (!empty($changedIds)) {
+                        $select->where(
+                            $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)
+                        );
+                    }
+                    $sql = $select->crossUpdateFromSelect(array('e' => $temporaryFlatTableName));
+                    $this->_connection->query($sql);
+                }
+            }
+        }
+    }
+
+    /**
+     * Retrieve temporary table name by regular table name
+     *
+     * @param string $tableName
+     * @return string
+     */
+    protected function _getTemporaryTableName($tableName)
+    {
+        return sprintf('%s_tmp_indexer', $tableName);
+    }
+}
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/IndexerConfigData.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/IndexerConfigData.php
index 812e5a0ac7e..8d2956b1135 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/IndexerConfigData.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/IndexerConfigData.php
@@ -29,17 +29,17 @@ namespace Magento\Catalog\Model\Indexer\Product\Flat\Plugin;
 class IndexerConfigData
 {
     /**
-     * @var \Magento\Catalog\Helper\Product\Flat
+     * @var \Magento\Catalog\Model\Indexer\Product\Flat\State
      */
-    protected $_helper;
+    protected $_state;
 
     /**
-     * @param \Magento\Catalog\Helper\Product\Flat $helper
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $state
      */
     public function __construct(
-        \Magento\Catalog\Helper\Product\Flat $helper
+        \Magento\Catalog\Model\Indexer\Product\Flat\State $state
     ) {
-        $this->_helper = $helper;
+        $this->_state = $state;
     }
 
     /**
@@ -54,7 +54,7 @@ class IndexerConfigData
     {
         $data = $invocationChain->proceed($arguments);
 
-        if (!$this->_helper->isEnabled()) {
+        if (!$this->_state->isFlatEnabled()) {
             $indexerId = \Magento\Catalog\Model\Indexer\Product\Flat\Processor::INDEXER_ID;
             if ((!isset($arguments['path']) || !$arguments['path']) && isset($data[$indexerId])) {
                 unset($data[$indexerId]);
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php
index 1320a773161..168b0c9a3b7 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php
@@ -39,20 +39,20 @@ class Processor
     protected $_indexer;
 
     /**
-     * @var \Magento\Catalog\Helper\Product\Flat
+     * @var \Magento\Catalog\Model\Indexer\Product\Flat\State
      */
-    protected $_helper;
+    protected $_state;
 
     /**
      * @param \Magento\Indexer\Model\Indexer $indexer
-     * @param \Magento\Catalog\Helper\Product\Flat $helper
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $state
      */
     public function __construct(
        \Magento\Indexer\Model\Indexer $indexer,
-       \Magento\Catalog\Helper\Product\Flat $helper
+       \Magento\Catalog\Model\Indexer\Product\Flat\State $state
     ) {
         $this->_indexer = $indexer;
-        $this->_helper = $helper;
+        $this->_state = $state;
     }
 
     /**
@@ -75,7 +75,7 @@ class Processor
      */
     public function reindexRow($id)
     {
-        if (!$this->_helper->isEnabled() || $this->getIndexer()->isScheduled()) {
+        if (!$this->_state->isFlatEnabled() || $this->getIndexer()->isScheduled()) {
             return;
         }
         $this->getIndexer()->reindexRow($id);
@@ -88,7 +88,7 @@ class Processor
      */
     public function reindexList($ids)
     {
-        if (!$this->_helper->isEnabled() || $this->getIndexer()->isScheduled()) {
+        if (!$this->_state->isFlatEnabled() || $this->getIndexer()->isScheduled()) {
             return;
         }
         $this->getIndexer()->reindexList($ids);
@@ -99,7 +99,7 @@ class Processor
      */
     public function reindexAll()
     {
-        if (!$this->_helper->isEnabled()) {
+        if (!$this->_state->isFlatEnabled()) {
             return;
         }
         $this->getIndexer()->reindexAll();
@@ -110,6 +110,9 @@ class Processor
      */
     public function markIndexerAsInvalid()
     {
+        if (!$this->_state->isFlatEnabled()) {
+            return;
+        }
         $this->getIndexer()->invalidate();
     }
 }
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/State.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/State.php
new file mode 100644
index 00000000000..5570afcffd0
--- /dev/null
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/State.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Catalog\Model\Indexer\Product\Flat;
+
+class State extends \Magento\Catalog\Model\Indexer\AbstractFlatState
+{
+    /**
+     * Indexer ID in configuration
+     */
+    const INDEXER_ID = 'catalog_product_flat';
+
+    /**
+     * Flat Is Enabled Config XML Path
+     */
+    const INDEXER_ENABLED_XML_PATH = 'catalog/frontend/flat_catalog_product';
+
+    /**
+     * @var \Magento\Catalog\Helper\Product\Flat\Indexer
+     */
+    protected $_productFlatIndexerHelper;
+
+    /**
+     * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig
+     * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer
+     * @param \Magento\Catalog\Helper\Product\Flat\Indexer $flatIndexerHelper
+     * @param bool $isAvailable
+     */
+    public function __construct(
+        \Magento\Core\Model\Store\ConfigInterface $storeConfig,
+        \Magento\Indexer\Model\IndexerInterface $flatIndexer,
+        \Magento\Catalog\Helper\Product\Flat\Indexer $flatIndexerHelper,
+        $isAvailable = false
+    ) {
+        $this->storeConfig = $storeConfig;
+        $this->flatIndexer = $flatIndexer;
+        $this->_productFlatIndexerHelper = $flatIndexerHelper;
+        $this->isAvailable = $isAvailable;
+        parent::__construct($storeConfig, $flatIndexer, $isAvailable);
+    }
+
+    /**
+     * @return \Magento\Catalog\Helper\Product\Flat\Indexer
+     */
+    public function getFlatIndexerHelper()
+    {
+        return $this->_productFlatIndexerHelper;
+    }
+}
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php
index 4b4e62d1d70..92a0e25b66f 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php
@@ -35,8 +35,8 @@ class Mode extends \Magento\Core\Model\Config\Value
     protected $_productFlatIndexerProcessor;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor
@@ -45,8 +45,8 @@ class Mode extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor,
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php
new file mode 100644
index 00000000000..c03c65157ca
--- /dev/null
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php
@@ -0,0 +1,353 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_Catalog
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Catalog\Model\Indexer\Product\Flat;
+
+/**
+ * Class TableBuilder
+ * @package Magento\Catalog\Model\Indexer\Product\Flat
+ */
+class TableBuilder
+{
+    /**
+     * @var \Magento\Catalog\Helper\Product\Flat\Indexer
+     */
+    protected $_productIndexerHelper;
+
+    /**
+     * @var \Magento\DB\Adapter\AdapterInterface
+     */
+    protected $_connection;
+
+    /**
+     * Check whether builder was executed
+     *
+     * @var bool
+     */
+    protected $_isExecuted = false;
+
+    /**
+     * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper
+     * @param \Magento\App\Resource $resource
+     */
+    public function __construct(
+        \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper,
+        \Magento\App\Resource $resource
+    ) {
+        $this->_productIndexerHelper = $productIndexerHelper;
+        $this->_connection = $resource->getConnection('write');
+    }
+
+    /**
+     * Prepare temporary tables only for first call of reindex all
+     *
+     * @param $storeId
+     * @param $changedIds
+     * @param $valueFieldSuffix
+     */
+    public function build($storeId, $changedIds, $valueFieldSuffix)
+    {
+        if ($this->_isExecuted) {
+            return;
+        }
+        $entityTableName    = $this->_productIndexerHelper->getTable('catalog_product_entity');
+        $attributes         = $this->_productIndexerHelper->getAttributes();
+        $eavAttributes      = $this->_productIndexerHelper->getTablesStructure($attributes);
+        $entityTableColumns = $eavAttributes[$entityTableName];
+
+        $temporaryEavAttributes = $eavAttributes;
+
+        //add status global value to the base table
+        /* @var $status \Magento\Eav\Model\Entity\Attribute */
+        $status = $this->_productIndexerHelper->getAttribute('status');
+        $temporaryEavAttributes[$status->getBackendTable()]['status'] = $status;
+        //Create list of temporary tables based on available attributes attributes
+        $valueTables = array();
+        foreach ($temporaryEavAttributes as $tableName => $columns) {
+            $valueTables = array_merge(
+                $valueTables,
+                $this->_createTemporaryTable($this->_getTemporaryTableName($tableName), $columns, $valueFieldSuffix)
+            );
+        }
+
+        //Fill "base" table which contains all available products
+        $this->_fillTemporaryEntityTable($entityTableName, $entityTableColumns, $changedIds);
+
+        //Add primary key to "base" temporary table for increase speed of joins in future
+        $this->_addPrimaryKeyToTable($this->_getTemporaryTableName($entityTableName));
+        unset($temporaryEavAttributes[$entityTableName]);
+
+        foreach ($temporaryEavAttributes as $tableName => $columns) {
+            $temporaryTableName = $this->_getTemporaryTableName($tableName);
+
+            //Add primary key to temporary table for increase speed of joins in future
+            $this->_addPrimaryKeyToTable($temporaryTableName);
+
+            //Create temporary table for composite attributes
+            if (isset($valueTables[$temporaryTableName . $valueFieldSuffix])) {
+                $this->_addPrimaryKeyToTable($temporaryTableName . $valueFieldSuffix);
+            }
+
+            //Fill temporary tables with attributes grouped by it type
+            $this->_fillTemporaryTable($tableName, $columns, $changedIds, $valueFieldSuffix, $storeId);
+        }
+        $this->_isExecuted = true;
+    }
+
+    /**
+     * Create empty temporary table with given columns list
+     *
+     * @param string $tableName  Table name
+     * @param array $columns array('columnName' => \Magento\Catalog\Model\Resource\Eav\Attribute, ...)
+     * @param string $valueFieldSuffix
+     *
+     * @return array
+     */
+    protected function _createTemporaryTable($tableName, array $columns, $valueFieldSuffix)
+    {
+        $valueTables = array();
+        if (!empty($columns)) {
+            $valueTableName      = $tableName . $valueFieldSuffix;
+            $temporaryTable      = $this->_connection->newTable($tableName);
+            $valueTemporaryTable = $this->_connection->newTable($valueTableName);
+            $flatColumns         = $this->_productIndexerHelper->getFlatColumns();
+
+            $temporaryTable->addColumn(
+                'entity_id',
+                \Magento\DB\Ddl\Table::TYPE_INTEGER
+            );
+
+            $temporaryTable->addColumn(
+                'type_id',
+                \Magento\DB\Ddl\Table::TYPE_TEXT
+            );
+
+            $temporaryTable->addColumn(
+                'attribute_set_id',
+                \Magento\DB\Ddl\Table::TYPE_INTEGER
+            );
+
+            $valueTemporaryTable->addColumn(
+                'entity_id',
+                \Magento\DB\Ddl\Table::TYPE_INTEGER
+            );
+
+            /** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */
+            foreach ($columns as $columnName => $attribute) {
+                $attributeCode = $attribute->getAttributeCode();
+                if (isset($flatColumns[$attributeCode])) {
+                    $column = $flatColumns[$attributeCode];
+                } else {
+                    $column = $attribute->_getFlatColumnsDdlDefinition();
+                    $column = $column[$attributeCode];
+                }
+
+                $temporaryTable->addColumn(
+                    $columnName,
+                    $column['type'],
+                    isset($column['length']) ? $column['length'] : null
+                );
+
+                $columnValueName = $attributeCode . $valueFieldSuffix;
+                if (isset($flatColumns[$columnValueName])) {
+                    $columnValue = $flatColumns[$columnValueName];
+                    $valueTemporaryTable->addColumn(
+                        $columnValueName,
+                        $columnValue['type'],
+                        isset($columnValue['length']) ? $columnValue['length'] : null
+                    );
+                }
+            }
+            $this->_connection->dropTemporaryTable($tableName);
+            $this->_connection->createTemporaryTable($temporaryTable);
+
+            if (count($valueTemporaryTable->getColumns()) > 1) {
+                $this->_connection->dropTemporaryTable($valueTableName);
+                $this->_connection->createTemporaryTable($valueTemporaryTable);
+                $valueTables[$valueTableName] = $valueTableName;
+            }
+        }
+        return $valueTables;
+    }
+
+    /**
+     * Retrieve temporary table name by regular table name
+     *
+     * @param string $tableName
+     * @return string
+     */
+    protected function _getTemporaryTableName($tableName)
+    {
+        return sprintf('%s_tmp_indexer', $tableName);
+    }
+
+    /**
+     * Fill temporary entity table
+     *
+     * @param string $tableName
+     * @param array  $columns
+     * @param array  $changedIds
+     */
+    protected function _fillTemporaryEntityTable($tableName, array $columns, array $changedIds = array())
+    {
+        if (!empty($columns)) {
+            $select = $this->_connection->select();
+            $temporaryEntityTable = $this->_getTemporaryTableName($tableName);
+            $idsColumns = array(
+                'entity_id',
+                'type_id',
+                'attribute_set_id',
+            );
+
+            $columns = array_merge($idsColumns, array_keys($columns));
+
+            $select->from(array('e' => $tableName), $columns);
+            $onDuplicate = false;
+            if (!empty($changedIds)) {
+                $select->where(
+                    $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)
+                );
+                $onDuplicate = true;
+            }
+            $sql = $select->insertFromSelect($temporaryEntityTable, $columns, $onDuplicate);
+            $this->_connection->query($sql);
+        }
+    }
+
+    /**
+     * Add primary key to table by it name
+     *
+     * @param string $tableName
+     * @param string $columnName
+     */
+    protected function _addPrimaryKeyToTable($tableName, $columnName = 'entity_id')
+    {
+        $this->_connection->addIndex(
+            $tableName,
+            'entity_id',
+            array($columnName),
+            \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY
+        );
+    }
+
+    /**
+     * Fill temporary table by data from products EAV attributes by type
+     *
+     * @param string $tableName
+     * @param array  $tableColumns
+     * @param array  $changedIds
+     * @param string $valueFieldSuffix
+     * @param int $storeId
+     */
+    protected function _fillTemporaryTable(
+        $tableName, array $tableColumns, array $changedIds, $valueFieldSuffix, $storeId
+    ) {
+        if (!empty($tableColumns)) {
+
+            $columnsChunks = array_chunk(
+                $tableColumns, \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction::ATTRIBUTES_CHUNK_SIZE, true
+            );
+            foreach ($columnsChunks as $columnsList) {
+                $select                  = $this->_connection->select();
+                $selectValue             = $this->_connection->select();
+                $entityTableName         = $this->_getTemporaryTableName(
+                    $this->_productIndexerHelper->getTable('catalog_product_entity')
+                );
+                $temporaryTableName      = $this->_getTemporaryTableName($tableName);
+                $temporaryValueTableName = $temporaryTableName . $valueFieldSuffix;
+                $keyColumn               = array('entity_id');
+                $columns                 = array_merge($keyColumn, array_keys($columnsList));
+                $valueColumns            = $keyColumn;
+                $flatColumns             = $this->_productIndexerHelper->getFlatColumns();
+                $iterationNum            = 1;
+
+                $select->from(
+                    array('e' => $entityTableName),
+                    $keyColumn
+                );
+
+                $selectValue->from(
+                    array('e' => $temporaryTableName),
+                    $keyColumn
+                );
+
+                /** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */
+                foreach ($columnsList as $columnName => $attribute) {
+                    $countTableName = 't' . $iterationNum++;
+                    $joinCondition  = sprintf(
+                        'e.entity_id = %1$s.entity_id AND %1$s.attribute_id = %2$d AND %1$s.store_id = 0',
+                        $countTableName,
+                        $attribute->getId()
+                    );
+
+                    $select->joinLeft(
+                        array($countTableName => $tableName),
+                        $joinCondition,
+                        array($columnName => 'value')
+                    );
+
+                    if ($attribute->getFlatUpdateSelect($storeId) instanceof \Magento\DB\Select) {
+                        $attributeCode   = $attribute->getAttributeCode();
+                        $columnValueName = $attributeCode . $valueFieldSuffix;
+                        if (isset($flatColumns[$columnValueName])) {
+                            $valueJoinCondition = sprintf(
+                                'e.%1$s = %2$s.option_id AND %2$s.store_id = 0',
+                                $attributeCode,
+                                $countTableName
+                            );
+                            $selectValue->joinLeft(
+                                array($countTableName => $this->_productIndexerHelper
+                                        ->getTable('eav_attribute_option_value')
+                                ),
+                                $valueJoinCondition,
+                                array($columnValueName => $countTableName . '.value')
+                            );
+                            $valueColumns[] = $columnValueName;
+                        }
+                    }
+                }
+
+                if (!empty($changedIds)) {
+                    $select->where(
+                        $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)
+                    );
+                }
+
+                $sql = $select->insertFromSelect($temporaryTableName, $columns, true);
+                $this->_connection->query($sql);
+
+                if (count($valueColumns) > 1) {
+                    if (!empty($changedIds)) {
+                        $selectValue->where(
+                            $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)
+                        );
+                    }
+                    $sql = $selectValue->insertFromSelect($temporaryValueTableName, $valueColumns, true);
+                    $this->_connection->query($sql);
+                }
+            }
+        }
+    }
+}
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableData.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableData.php
new file mode 100644
index 00000000000..b0bb56f54df
--- /dev/null
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableData.php
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_Catalog
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Catalog\Model\Indexer\Product\Flat;
+
+/**
+ * Class TableData
+ * @package Magento\Catalog\Model\Indexer\Product\Flat
+ */
+class TableData implements TableDataInterface
+{
+    /**
+     * @var \Magento\DB\Adapter\AdapterInterface
+     */
+    protected $_connection;
+
+    /**
+     * @var \Magento\App\Resource
+     */
+    protected $_resource;
+
+    /**
+     * @param \Magento\App\Resource $resource
+     */
+    public function __construct(
+        \Magento\App\Resource $resource
+    ) {
+        $this->_resource = $resource;
+    }
+
+    /**
+     * Move data from temporary tables to flat
+     *
+     * @param string $flatTable
+     * @param string $flatDropName
+     * @param string $temporaryFlatTableName
+     */
+    public function move($flatTable, $flatDropName, $temporaryFlatTableName)
+    {
+        $connection = $this->_resource->getConnection('write');
+        $renameTables = array();
+
+        if ($connection->isTableExists($flatTable)) {
+            $renameTables[] = array(
+                'oldName' => $flatTable,
+                'newName' => $flatDropName,
+            );
+        }
+        $renameTables[] = array(
+            'oldName' => $temporaryFlatTableName,
+            'newName' => $flatTable,
+        );
+
+        $connection->dropTable($flatDropName);
+        $connection->renameTablesBatch($renameTables);
+        $connection->dropTable($flatDropName);
+    }
+}
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableDataInterface.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableDataInterface.php
new file mode 100644
index 00000000000..b01ff01599e
--- /dev/null
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableDataInterface.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_Catalog
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Catalog\Model\Indexer\Product\Flat;
+
+/**
+ * Interface TableDataInterface
+ * @package Magento\Catalog\Model\Indexer\Product\Flat
+ */
+interface TableDataInterface
+{
+    /**
+     * Move data from temporary tables to flat
+     *
+     * @param string $flatTable
+     * @param string $flatDropName
+     * @param string $temporaryFlatTableName
+     */
+    public function move($flatTable, $flatDropName, $temporaryFlatTableName);
+}
diff --git a/app/code/Magento/Catalog/Model/Indexer/Url.php b/app/code/Magento/Catalog/Model/Indexer/Url.php
index ab752c334a3..49201649429 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Url.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Url.php
@@ -93,8 +93,8 @@ class Url extends \Magento\Index\Model\Indexer\AbstractIndexer
     /**
      * Constructor
      *
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\Resource\UrlFactory $catalogResourceUrlFactory
      * @param \Magento\Catalog\Model\Url $catalogUrl
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -102,8 +102,8 @@ class Url extends \Magento\Index\Model\Indexer\AbstractIndexer
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\Resource\UrlFactory $catalogResourceUrlFactory,
         \Magento\Catalog\Model\Url $catalogUrl,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Catalog/Model/Layer.php b/app/code/Magento/Catalog/Model/Layer.php
index 96f1370c27d..98e976d5ba1 100644
--- a/app/code/Magento/Catalog/Model/Layer.php
+++ b/app/code/Magento/Catalog/Model/Layer.php
@@ -50,7 +50,7 @@ class Layer extends \Magento\Object
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -121,7 +121,7 @@ class Layer extends \Magento\Object
      * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility
      * @param \Magento\Catalog\Model\Config $catalogConfig
      * @param \Magento\Customer\Model\Session $customerSession
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -133,7 +133,7 @@ class Layer extends \Magento\Object
         \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility,
         \Magento\Catalog\Model\Config $catalogConfig,
         \Magento\Customer\Model\Session $customerSession,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_layerStateFactory = $layerStateFactory;
diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Category.php b/app/code/Magento/Catalog/Model/Layer/Filter/Category.php
index f0e3fd6659a..a1b344c96c5 100644
--- a/app/code/Magento/Catalog/Model/Layer/Filter/Category.php
+++ b/app/code/Magento/Catalog/Model/Layer/Filter/Category.php
@@ -59,7 +59,7 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -78,7 +78,7 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter
      * @param \Magento\Catalog\Model\Layer $catalogLayer
      * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
      * @param \Magento\Escaper $escaper
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -87,7 +87,7 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter
         \Magento\Catalog\Model\Layer $catalogLayer,
         \Magento\Catalog\Model\CategoryFactory $categoryFactory,
         \Magento\Escaper $escaper,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_categoryFactory = $categoryFactory;
@@ -195,9 +195,8 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter
      */
     protected function _getItemsData()
     {
-        $categoty   = $this->getCategory();
-        /** @var $category \Magento\Catalog\Model\Categeory */
-        $categories = $categoty->getChildrenCategories();
+        $category   = $this->getCategory();
+        $categories = $category->getChildrenCategories();
 
         $this->getLayer()->getProductCollection()
             ->addCountToCategories($categories);
diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Price.php b/app/code/Magento/Catalog/Model/Layer/Filter/Price.php
index 9022eb4cfb4..a61aa6b617e 100644
--- a/app/code/Magento/Catalog/Model/Layer/Filter/Price.php
+++ b/app/code/Magento/Catalog/Model/Layer/Filter/Price.php
@@ -65,7 +65,7 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -90,7 +90,7 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter
      * @param \Magento\Catalog\Model\Resource\Layer\Filter\PriceFactory $filterPriceFactory
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Catalog\Model\Layer\Filter\Price\Algorithm $priceAlgorithm
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -100,7 +100,7 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter
         \Magento\Catalog\Model\Resource\Layer\Filter\PriceFactory $filterPriceFactory,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Catalog\Model\Layer\Filter\Price\Algorithm $priceAlgorithm,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_resource = $filterPriceFactory->create();
diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php
index 83663d93be9..11bc51f7596 100644
--- a/app/code/Magento/Catalog/Model/Product.php
+++ b/app/code/Magento/Catalog/Model/Product.php
@@ -253,8 +253,8 @@ class Product extends \Magento\Catalog\Model\AbstractModel
     protected $_productFlatIndexerProcessor;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param Product\Url $url
      * @param Product\Link $productLink
@@ -282,8 +282,8 @@ class Product extends \Magento\Catalog\Model\AbstractModel
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         Product\Url $url,
         Product\Link $productLink,
diff --git a/app/code/Magento/Catalog/Model/Product/Action.php b/app/code/Magento/Catalog/Model/Product/Action.php
index 1b68d930d86..ea9d77ed795 100644
--- a/app/code/Magento/Catalog/Model/Product/Action.php
+++ b/app/code/Magento/Catalog/Model/Product/Action.php
@@ -54,8 +54,8 @@ class Action extends \Magento\Core\Model\AbstractModel
     protected $categoryIndexer;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\Product\WebsiteFactory $productWebsiteFactory
      * @param \Magento\Index\Model\Indexer $indexIndexer
      * @param \Magento\Indexer\Model\IndexerInterface $categoryIndexer
@@ -64,8 +64,8 @@ class Action extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\Product\WebsiteFactory $productWebsiteFactory,
         \Magento\Index\Model\Indexer $indexIndexer,
         \Magento\Indexer\Model\IndexerInterface $categoryIndexer,
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Group.php b/app/code/Magento/Catalog/Model/Product/Attribute/Group.php
index 09e9f07068f..15db2aad2e8 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Group.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Group.php
@@ -38,16 +38,16 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Group
     protected $_attributeCollectionFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Inputtype.php b/app/code/Magento/Catalog/Model/Product/Attribute/Source/Inputtype.php
index 4b70899f985..d5bddd122c0 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Inputtype.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Source/Inputtype.php
@@ -33,10 +33,10 @@ class Inputtype extends \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputt
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
-    
+
     /**
      * Core event manager proxy
      *
@@ -46,11 +46,11 @@ class Inputtype extends \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputt
 
     /**
      * @param \Magento\Event\ManagerInterface $eventManager
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Event\ManagerInterface $eventManager,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_eventManager = $eventManager;
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Catalog/Model/Product/Compare/Item.php b/app/code/Magento/Catalog/Model/Product/Compare/Item.php
index 5298d7e7d90..5a70c2cd51b 100644
--- a/app/code/Magento/Catalog/Model/Product/Compare/Item.php
+++ b/app/code/Magento/Catalog/Model/Product/Compare/Item.php
@@ -90,8 +90,8 @@ class Item extends \Magento\Core\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Log\Model\Visitor $logVisitor
      * @param \Magento\Customer\Model\Session $customerSession
@@ -101,8 +101,8 @@ class Item extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Log\Model\Visitor $logVisitor,
         \Magento\Customer\Model\Session $customerSession,
diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php
index adbedcf7f72..d73c0352904 100644
--- a/app/code/Magento/Catalog/Model/Product/Image.php
+++ b/app/code/Magento/Catalog/Model/Product/Image.php
@@ -182,8 +182,8 @@ class Image extends \Magento\Core\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Model\Product\Media\Config $catalogProductMediaConfig
      * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase
@@ -197,8 +197,8 @@ class Image extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Model\Product\Media\Config $catalogProductMediaConfig,
         \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase,
diff --git a/app/code/Magento/Catalog/Model/Product/Indexer/Eav.php b/app/code/Magento/Catalog/Model/Product/Indexer/Eav.php
index 9ab9f641a5e..15831083d59 100644
--- a/app/code/Magento/Catalog/Model/Product/Indexer/Eav.php
+++ b/app/code/Magento/Catalog/Model/Product/Indexer/Eav.php
@@ -66,16 +66,16 @@ class Eav extends \Magento\Index\Model\Indexer\AbstractIndexer
     protected $_eavConfig;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Catalog/Model/Product/Link.php b/app/code/Magento/Catalog/Model/Product/Link.php
index 60cb878810c..2cc4d23b757 100644
--- a/app/code/Magento/Catalog/Model/Product/Link.php
+++ b/app/code/Magento/Catalog/Model/Product/Link.php
@@ -70,8 +70,8 @@ class Link extends \Magento\Core\Model\AbstractModel
     protected $_linkCollectionFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\Resource\Product\Link\CollectionFactory $linkCollectionFactory
      * @param \Magento\Catalog\Model\Resource\Product\Link\Product\CollectionFactory $productCollectionFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -79,8 +79,8 @@ class Link extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\Resource\Product\Link\CollectionFactory $linkCollectionFactory,
         \Magento\Catalog\Model\Resource\Product\Link\Product\CollectionFactory $productCollectionFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Catalog/Model/Product/Option.php b/app/code/Magento/Catalog/Model/Product/Option.php
index 8506ddde4c1..fa83f15364a 100644
--- a/app/code/Magento/Catalog/Model/Product/Option.php
+++ b/app/code/Magento/Catalog/Model/Product/Option.php
@@ -111,8 +111,8 @@ class Option extends AbstractModel
     protected $string;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param Option\Value $productOptionValue
      * @param \Magento\Catalog\Model\Product\Option\Type\Factory $optionFactory
      * @param \Magento\Stdlib\String $string
@@ -121,8 +121,8 @@ class Option extends AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         Option\Value $productOptionValue,
         \Magento\Catalog\Model\Product\Option\Type\Factory $optionFactory,
         \Magento\Stdlib\String $string,
diff --git a/app/code/Magento/Catalog/Model/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Product/Option/Value.php
index 08a2cc7e3e4..c28870911d4 100644
--- a/app/code/Magento/Catalog/Model/Product/Option/Value.php
+++ b/app/code/Magento/Catalog/Model/Product/Option/Value.php
@@ -68,16 +68,16 @@ class Value extends \Magento\Core\Model\AbstractModel
     protected $_valueCollectionFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $valueCollectionFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $valueCollectionFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php
index c5f661fe230..7dfd8017b80 100644
--- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php
+++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php
@@ -132,7 +132,7 @@ abstract class AbstractType
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -187,7 +187,7 @@ abstract class AbstractType
      * @param \Magento\Core\Helper\Data $coreData
      * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb
      * @param \Magento\App\Filesystem $filesystem
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Logger $logger
      * @param array $data
      */
@@ -200,7 +200,7 @@ abstract class AbstractType
         \Magento\Core\Helper\Data $coreData,
         \Magento\Core\Helper\File\Storage\Database $fileStorageDb,
         \Magento\App\Filesystem $filesystem,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Logger $logger,
         array $data = array()
     ) {
@@ -506,7 +506,8 @@ abstract class AbstractType
                         $path = dirname($dst);
 
                         try {
-                            $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR)->create($path);
+                            $rootDir = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR);
+                            $rootDir->create($rootDir->getRelativePath($path));
                         } catch (\Magento\Filesystem\FilesystemException $e) {
                             throw new \Magento\Core\Exception(
                                 __("We can't create writeable directory \"%1\".", $path)
diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php
index 7e1d06eb5c5..4b555acb629 100644
--- a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php
+++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php
@@ -484,7 +484,7 @@ class Flat extends \Magento\Index\Model\Resource\AbstractResource
      *
      * @param \Magento\Catalog\Model\Category $category
      * @param bool $isActive
-     * @return array
+     * @return \Magento\Catalog\Model\Category[]
      */
     public function getParentCategories($category, $isActive = true)
     {
@@ -540,7 +540,7 @@ class Flat extends \Magento\Index\Model\Resource\AbstractResource
      * Return children categories of category
      *
      * @param \Magento\Catalog\Model\Category $category
-     * @return array
+     * @return \Magento\Catalog\Model\Category[]
      */
     public function getChildrenCategories($category)
     {
diff --git a/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php
index 65b3d9b8258..6baa5772cd5 100644
--- a/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php
+++ b/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php
@@ -119,13 +119,13 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute
     protected $_productFlatIndexerProcessor;
 
     /**
-     * @var \Magento\Catalog\Helper\Product\Flat
+     * @var \Magento\Catalog\Helper\Product\Flat\Indexer
      */
-    protected $_productFlatHelper;
+    protected $_productFlatIndexerHelper;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Helper\Data $coreData
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory
@@ -136,15 +136,15 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute
      * @param \Magento\Catalog\Model\ProductFactory $catalogProductFactory
      * @param \Magento\Index\Model\Indexer $indexIndexer
      * @param \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor
-     * @param \Magento\Catalog\Helper\Product\Flat $productFlatHelper
+     * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productFlatIndexerHelper
      * @param LockValidatorInterface $lockValidator
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Helper\Data $coreData,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory,
@@ -155,7 +155,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute
         \Magento\Catalog\Model\ProductFactory $catalogProductFactory,
         \Magento\Index\Model\Indexer $indexIndexer,
         \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor,
-        \Magento\Catalog\Helper\Product\Flat $productFlatHelper,
+        \Magento\Catalog\Helper\Product\Flat\Indexer $productFlatIndexerHelper,
         LockValidatorInterface $lockValidator,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
@@ -163,7 +163,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute
     ) {
         $this->_indexIndexer = $indexIndexer;
         $this->_productFlatIndexerProcessor = $productFlatIndexerProcessor;
-        $this->_productFlatHelper = $productFlatHelper;
+        $this->_productFlatIndexerHelper = $productFlatIndexerHelper;
         $this->attrLockValidator = $lockValidator;
         parent::__construct(
             $context,
@@ -239,11 +239,11 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute
         $this->_eavConfig->clear();
 
         $enableBefore = ($this->getOrigData('backend_type') == 'static')
-            || ($this->_productFlatHelper->isAddFilterableAttributes() && $this->getOrigData('is_filterable') > 0)
+            || ($this->_productFlatIndexerHelper->isAddFilterableAttributes() && $this->getOrigData('is_filterable') > 0)
             || ($this->getOrigData('used_in_product_listing') == 1)
             || ($this->getOrigData('used_for_sort_by') == 1);
         $enableAfter = ($this->getData('backend_type') == 'static')
-            || ($this->_productFlatHelper->isAddFilterableAttributes() && $this->getData('is_filterable') > 0)
+            || ($this->_productFlatIndexerHelper->isAddFilterableAttributes() && $this->getData('is_filterable') > 0)
             || ($this->getData('used_in_product_listing') == 1)
             || ($this->getData('used_for_sort_by') == 1);
 
diff --git a/app/code/Magento/Catalog/Model/Resource/Product.php b/app/code/Magento/Catalog/Model/Resource/Product.php
index 43c889c85d6..f5e1f7050d1 100644
--- a/app/code/Magento/Catalog/Model/Resource/Product.php
+++ b/app/code/Magento/Catalog/Model/Resource/Product.php
@@ -381,7 +381,8 @@ class Product extends AbstractResource
         // fetching all parent IDs, including those are higher on the tree
         $select = $this->_getReadAdapter()->select()->distinct()
             ->from($this->getTable('catalog_category_product_index'), array('category_id'))
-            ->where('product_id = ? AND is_parent = 1', (int)$object->getEntityId());
+            ->where('product_id = ? AND is_parent = 1', (int)$object->getEntityId())
+            ->where('visibility != ?', \Magento\Catalog\Model\Product\Visibility::VISIBILITY_NOT_VISIBLE);
 
         return $this->_getReadAdapter()->fetchCol($select);
     }
diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php
index 17ea71cc4ba..533023987b1 100644
--- a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php
+++ b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php
@@ -201,9 +201,9 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl
     /**
      * Catalog product flat
      *
-     * @var \Magento\Catalog\Helper\Product\Flat
+     * @var \Magento\Catalog\Model\Indexer\Product\Flat\State
      */
-    protected $_catalogProductFlat = null;
+    protected $_catalogProductFlatState = null;
 
     /**
      * Catalog data
@@ -271,15 +271,15 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl
      * @param \Magento\Validator\UniversalFactory $universalFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Catalog\Helper\Product\Flat $catalogProductFlat
-     * @param \Magento\Core\Model\Store\Config $coreStoreConfig
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState
+     * @param Store\Config $coreStoreConfig
      * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
      * @param \Magento\Catalog\Model\Resource\Url $catalogUrl
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Zend_Db_Adapter_Abstract $connection
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
@@ -294,7 +294,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl
         \Magento\Validator\UniversalFactory $universalFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Catalog\Helper\Product\Flat $catalogProductFlat,
+        \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
         \Magento\Catalog\Model\Resource\Url $catalogUrl,
@@ -304,7 +304,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl
         $connection = null
     ) {
         $this->_catalogData = $catalogData;
-        $this->_catalogProductFlat = $catalogProductFlat;
+        $this->_catalogProductFlatState = $catalogProductFlatState;
         $this->_coreStoreConfig = $coreStoreConfig;
         $this->_productOptionFactory = $productOptionFactory;
         $this->_catalogUrl = $catalogUrl;
@@ -414,11 +414,11 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl
     /**
      * Retrieve Catalog Product Flat Helper object
      *
-     * @return \Magento\Catalog\Helper\Product\Flat
+     * @return \Magento\Catalog\Model\Indexer\Product\Flat\State
      */
-    public function getFlatHelper()
+    public function getFlatState()
     {
-        return $this->_catalogProductFlat;
+        return $this->_catalogProductFlatState;
     }
 
     /**
@@ -430,7 +430,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl
     public function isEnabledFlat()
     {
         if (!isset($this->_flatEnabled[$this->getStoreId()])) {
-            $this->_flatEnabled[$this->getStoreId()] = $this->getFlatHelper()->isAvailable();
+            $this->_flatEnabled[$this->getStoreId()] = $this->getFlatState()->isAvailable();
         }
         return $this->_flatEnabled[$this->getStoreId()];
     }
@@ -548,7 +548,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl
                 ->from(array(self::MAIN_TABLE_ALIAS => $this->getEntity()->getFlatTableName()), null)
                 ->columns(array('status' => new \Zend_Db_Expr(ProductStatus::STATUS_ENABLED)));
             $this->addAttributeToSelect(array('entity_id', 'type_id', 'attribute_set_id'));
-            if ($this->getFlatHelper()->isAddChildData()) {
+            if ($this->_catalogProductFlatState->getFlatIndexerHelper()->isAddChildData()) {
                 $this->getSelect()
                     ->where('e.is_child=?', 0);
                 $this->addAttributeToSelect(array('child_id', 'is_child'));
@@ -2065,16 +2065,15 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl
             if ($item->hasStockItem()) {
                 $item->unsStockItem();
             }
-            $item = $this->_items[$i] = null;
+            $this->_items[$i] = null;
         }
 
         foreach ($this->_itemsById as $i => $item) {
-            $item = $this->_itemsById[$i] = null;
+            $this->_itemsById[$i] = null;
         }
 
         unset($this->_items, $this->_data, $this->_itemsById);
         $this->_data = array();
-        $this->_itemsById = array();
         return parent::clear();
     }
 
diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php
index abb1b7c6478..913d0ac97de 100644
--- a/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php
+++ b/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php
@@ -83,7 +83,7 @@ class Collection
      * @param \Magento\Validator\UniversalFactory $universalFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Catalog\Helper\Product\Flat $catalogProductFlat
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
      * @param \Magento\Catalog\Model\Resource\Url $catalogUrl
@@ -108,7 +108,7 @@ class Collection
         \Magento\Validator\UniversalFactory $universalFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Catalog\Helper\Product\Flat $catalogProductFlat,
+        \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
         \Magento\Catalog\Model\Resource\Url $catalogUrl,
@@ -133,7 +133,7 @@ class Collection
             $universalFactory,
             $storeManager,
             $catalogData,
-            $catalogProductFlat,
+            $catalogProductFlatState,
             $coreStoreConfig,
             $productOptionFactory,
             $catalogUrl,
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 8c7d423f7e8..f5427e9c804 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
@@ -39,8 +39,8 @@ class Suffix extends \Magento\Core\Model\Config\Value
     protected $_coreUrlRewrite = null;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Helper\Url\Rewrite $coreUrlRewrite
@@ -49,8 +49,8 @@ class Suffix extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Helper\Url\Rewrite $coreUrlRewrite,
diff --git a/app/code/Magento/Catalog/etc/adminhtml/di.xml b/app/code/Magento/Catalog/etc/adminhtml/di.xml
index 52a5d0e53e2..2aa4eef40e5 100644
--- a/app/code/Magento/Catalog/etc/adminhtml/di.xml
+++ b/app/code/Magento/Catalog/etc/adminhtml/di.xml
@@ -57,6 +57,9 @@
             </argument>
         </arguments>
     </type>
+    <type name="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper">
+        <plugin name="configurable" type="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Configurable" sortOrder="50" />
+    </type>
     <type name="Magento\Catalog\Helper\Flat\AbstractFlat">
         <arguments>
             <argument name="isAvailable" xsi:type="boolean">false</argument>
diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml
index 21c19a51f6d..e7f59d1044c 100644
--- a/app/code/Magento/Catalog/etc/di.xml
+++ b/app/code/Magento/Catalog/etc/di.xml
@@ -152,8 +152,8 @@
         <plugin name="categoryStoreGroupAroundSave" type="Magento\Catalog\Model\Indexer\Category\Product\Plugin\StoreGroup"/>
     </type>
     <type name="Magento\Indexer\Model\Config\Data">
-        <plugin name="indexerCategoryFlat" type="Magento\Catalog\Model\Indexer\Category\Flat\Plugin\IndexerConfigData"/>
-        <plugin name="indexerProductFlat" type="Magento\Catalog\Model\Indexer\Product\Flat\Plugin\IndexerConfigData"/>
+        <plugin name="indexerCategoryFlatConfigGet" type="Magento\Catalog\Model\Indexer\Category\Flat\Plugin\IndexerConfigData"/>
+        <plugin name="indexerProductFlatConfigGet" type="Magento\Catalog\Model\Indexer\Product\Flat\Plugin\IndexerConfigData"/>
     </type>
     <type name="Magento\Catalog\Model\Indexer\Category\Flat">
         <arguments>
@@ -219,4 +219,22 @@
             <argument name="categoryIndexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
         </arguments>
     </type>
+
+    <virtualType name="rowsFlatTableBuilder" type="Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder">
+        <arguments>
+            <argument name="tableData" xsi:type="object">Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows\TableData</argument>
+        </arguments>
+    </virtualType>
+
+    <type name="Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows">
+        <arguments>
+            <argument name="tableData" xsi:type="object">rowsFlatTableBuilder</argument>
+        </arguments>
+    </type>
+
+    <type name="Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder">
+        <arguments>
+            <argument name="tableData" xsi:type="object">Magento\Catalog\Model\Indexer\Product\Flat\TableData</argument>
+        </arguments>
+    </type>
 </config>
diff --git a/app/code/Magento/Catalog/etc/frontend/di.xml b/app/code/Magento/Catalog/etc/frontend/di.xml
index 0e83b79c052..ed2f5b780f2 100644
--- a/app/code/Magento/Catalog/etc/frontend/di.xml
+++ b/app/code/Magento/Catalog/etc/frontend/di.xml
@@ -63,4 +63,9 @@
             <argument name="orPosition" xsi:type="const">Magento\Catalog\Block\ShortcutButtons::POSITION_AFTER</argument>
         </arguments>
     </virtualType>
+    <type name="Magento\Catalog\Model\Indexer\Product\Flat\State">
+        <arguments>
+            <argument name="isAvailable" xsi:type="boolean">true</argument>
+        </arguments>
+    </type>
 </config>
diff --git a/app/code/Magento/Catalog/i18n/de_DE.csv b/app/code/Magento/Catalog/i18n/de_DE.csv
index 74d31880fe1..ef810ff0aa7 100644
--- a/app/code/Magento/Catalog/i18n/de_DE.csv
+++ b/app/code/Magento/Catalog/i18n/de_DE.csv
@@ -129,7 +129,7 @@
 "Can be Divided into Multiple Boxes for Shipping","Kann für den Versand in mehrere Pakete unterteilt werden"
 "Can be used only with catalog input type Dropdown","Kann nur mit Katalogeingabeart Dropdown verwendet werden"
 "Can be used only with catalog input type Dropdown, Multiple Select and Price","Kann nur mit Katalogeingabeart Dropdown, Mehrfachauswahl und Preis verwendet werden."
-"Can\'t create image.","Kann kein Bild erzeugen."
+"Can't create image.","Kann kein Bild erzeugen."
 "Cancel","Abbrechen"
 "Cannot create image.","Kann kein Bild erzeugen."
 "Cannot create writeable directory '%s'.","Kann keine schreibbares Verzeichnis erstellen.'%s'."
@@ -393,7 +393,7 @@
 "Minimum Advertised Price","Beworbener Mindestpreis"
 "Minimum Lines per Page","Minimale Zeilenanzahl pro Seite"
 "Minimum Quantity Allowed in Shopping Cart","Minimal im Warenkorb zulässige Menge"
-"Minimum Quantity for Item\'s Status to be Out of Stock","Minimale Stückzahl für Nicht auf Lager-Status"
+"Minimum Quantity for Item's Status to be Out of Stock","Minimale Stückzahl für Nicht auf Lager-Status"
 "Missing SKU, skipping the record.","Artikelnummer fehlt, Eintrag übersprungen."
 "More Views","Mehr Ansichten"
 "Move","Verschieben"
@@ -460,8 +460,8 @@
 "Please specify the number of products, that will not be divided into subintervals.","Geben sie bitte die Anzahl an Artikeln an, die nicht in Teilintervalle geteilt werden."
 "Please specify the product required option(s)","Bitte die obligatorischen Produktoption(en) angeben"
 "Please specify the product required option(s).","Geben Sie bitte die obligatorischen Produktoption(en) an."
-"Please specify the product\'s option(s).","Bitte die Produkt-Optionen angeben."
-"Please specify the product\'s required option(s).","Geben Sie bitte die obligatorischen Option(en) für das Produkt an."
+"Please specify the product's option(s).","Bitte die Produkt-Optionen angeben."
+"Please specify the product's required option(s).","Geben Sie bitte die obligatorischen Option(en) für das Produkt an."
 "Please specify the quantity of product(s).","Geben Sie bitte die Anzahl an Produkten an."
 "Please specify time required option(s).","Bitte die benötigten Zeit-Optionen angeben."
 "Please wait...","Bitte warten..."
@@ -526,7 +526,7 @@
 "Quantity","Anzahl"
 "Quantity Increments","Menge Zuwachsrate"
 "Quantity Uses Decimals","Stückzahl kann dezimal sein"
-"Quantity for Item\'s Status to Become Out of Stock","Menge, bei der der Produktstatus zu ""Nicht vorrätig"" wechselt"
+"Quantity for Item's Status to Become Out of Stock","Menge, bei der der Produktstatus zu ""Nicht vorrätig"" wechselt"
 "Quantity:","Anzahl:"
 "Quantity","Menge"
 "Quick Create","Schnellanlegen"
diff --git a/app/code/Magento/Catalog/i18n/en_US.csv b/app/code/Magento/Catalog/i18n/en_US.csv
index 1107cf1fbd1..a558c4df832 100644
--- a/app/code/Magento/Catalog/i18n/en_US.csv
+++ b/app/code/Magento/Catalog/i18n/en_US.csv
@@ -129,7 +129,7 @@
 "Can be Divided into Multiple Boxes for Shipping","Can be Divided into Multiple Boxes for Shipping"
 "Can be used only with catalog input type Dropdown","Can be used only with catalog input type Dropdown"
 "Can be used only with catalog input type Dropdown, Multiple Select and Price","Can be used only with catalog input type Dropdown, Multiple Select and Price"
-"Can\'t create image.","Can\'t create image."
+"Can't create image.","Can't create image."
 "Cancel","Cancel"
 "Cannot create image.","Cannot create image."
 "Cannot create writeable directory '%s'.","Cannot create writeable directory '%s'."
@@ -394,7 +394,7 @@
 "Minimum Advertised Price","Minimum Advertised Price"
 "Minimum Lines per Page","Minimum Lines per Page"
 "Minimum Quantity Allowed in Shopping Cart","Minimum Quantity Allowed in Shopping Cart"
-"Minimum Quantity for Item\'s Status to be Out of Stock","Minimum Quantity for Item\'s Status to be Out of Stock"
+"Minimum Quantity for Item's Status to be Out of Stock","Minimum Quantity for Item's Status to be Out of Stock"
 "Missing SKU, skipping the record.","Missing SKU, skipping the record."
 "More Views","More Views"
 "Move","Move"
@@ -461,8 +461,8 @@
 "Please specify the number of products, that will not be divided into subintervals.","Please specify the number of products, that will not be divided into subintervals."
 "Please specify the product required option(s)","Please specify the product required option(s)"
 "Please specify the product required option(s).","Please specify the product required option(s)."
-"Please specify the product\'s option(s).","Please specify the product\'s option(s)."
-"Please specify the product\'s required option(s).","Please specify the product\'s required option(s)."
+"Please specify the product's option(s).","Please specify the product's option(s)."
+"Please specify the product's required option(s).","Please specify the product's required option(s)."
 "Please specify the quantity of product(s).","Please specify the quantity of product(s)."
 "Please specify time required option(s).","Please specify time required option(s)."
 "Please wait...","Please wait..."
@@ -528,7 +528,7 @@
 "Quantity","Quantity"
 "Quantity Increments","Quantity Increments"
 "Quantity Uses Decimals","Quantity Uses Decimals"
-"Quantity for Item\'s Status to Become Out of Stock","Quantity for Item\'s Status to Become Out of Stock"
+"Quantity for Item's Status to Become Out of Stock","Quantity for Item's Status to Become Out of Stock"
 "Quantity:","Quantity:"
 "Quantity","Quantity"
 "Quick Create","Quick Create"
diff --git a/app/code/Magento/Catalog/i18n/es_ES.csv b/app/code/Magento/Catalog/i18n/es_ES.csv
index fa906909ddf..426fe135712 100644
--- a/app/code/Magento/Catalog/i18n/es_ES.csv
+++ b/app/code/Magento/Catalog/i18n/es_ES.csv
@@ -129,7 +129,7 @@
 "Can be Divided into Multiple Boxes for Shipping","Puede dividirse en varias cajas para el envío"
 "Can be used only with catalog input type Dropdown","Sólo puede utilizarse con el tipo de entrada de catálogo Lista desplegable"
 "Can be used only with catalog input type Dropdown, Multiple Select and Price","Sólo puede utilizarse con los tipos de entrada de catálogo Lista desplegable, Selección múltiple y Precio"
-"Can\'t create image.","No se puede crear la imagen."
+"Can't create image.","No se puede crear la imagen."
 "Cancel","Cancelar"
 "Cannot create image.","No se puede crear la imagen."
 "Cannot create writeable directory '%s'.","No se puede crear el directorio con permiso de escritura '%s'."
@@ -393,7 +393,7 @@
 "Minimum Advertised Price","Precio mínimo anunciado"
 "Minimum Lines per Page","Cant. máxima de líneas por página"
 "Minimum Quantity Allowed in Shopping Cart","Cantidad mínima permitida en el carro de la compra"
-"Minimum Quantity for Item\'s Status to be Out of Stock","Cant. mínima para que el estado del artículo pase a ""Sin inventario"""
+"Minimum Quantity for Item's Status to be Out of Stock","Cant. mínima para que el estado del artículo pase a ""Sin inventario"""
 "Missing SKU, skipping the record.","Falta el código de producto (SKU). Se omitirá el registro."
 "More Views","Más vistas"
 "Move","Mover"
@@ -460,8 +460,8 @@
 "Please specify the number of products, that will not be divided into subintervals.","Por favor, especifica el número de productos, que no será dividido en subintervalos."
 "Please specify the product required option(s)","Por favor, especifique la(s) opcioón/opciones obligatoria(s) de producto"
 "Please specify the product required option(s).","Por favor, especifique la(s) opción/opciones obligatoria(s) de producto"
-"Please specify the product\'s option(s).","Especifique las opciones del producto."
-"Please specify the product\'s required option(s).","Por favor, especifique la(s) opción/opciones obligatoria(s) del producto."
+"Please specify the product's option(s).","Especifique las opciones del producto."
+"Please specify the product's required option(s).","Por favor, especifique la(s) opción/opciones obligatoria(s) del producto."
 "Please specify the quantity of product(s).","Por favor, especifique la cantidad de producto(s)."
 "Please specify time required option(s).","Especifique las opciones obligatorias de la hora."
 "Please wait...","Por favor, espera..."
@@ -526,7 +526,7 @@
 "Quantity","Cantidad"
 "Quantity Increments","Incrementos de cantidad"
 "Quantity Uses Decimals","La Cantidad Usa Decimales"
-"Quantity for Item\'s Status to Become Out of Stock","La cant. para el estado del artículo se va a quedar sin unidades disponibles"
+"Quantity for Item's Status to Become Out of Stock","La cant. para el estado del artículo se va a quedar sin unidades disponibles"
 "Quantity:","Cantidad:"
 "Quantity","Cantidad"
 "Quick Create","Creación Rápida"
diff --git a/app/code/Magento/Catalog/i18n/fr_FR.csv b/app/code/Magento/Catalog/i18n/fr_FR.csv
index 73f60c7d7e8..88d596b28e6 100644
--- a/app/code/Magento/Catalog/i18n/fr_FR.csv
+++ b/app/code/Magento/Catalog/i18n/fr_FR.csv
@@ -129,7 +129,7 @@
 "Can be Divided into Multiple Boxes for Shipping","Peut être divisé en plusieurs boîtes pour le transport"
 "Can be used only with catalog input type Dropdown","Ne peut être utilisé qu'avec un type d'entrée catalogue Menu Déroulant"
 "Can be used only with catalog input type Dropdown, Multiple Select and Price","Ne peut être utilisé qu'avec un type d'entrée catalogue Menu Déroulant, Sélection Multiple et Prix"
-"Can\'t create image.","Ne peut pas créer l'image."
+"Can't create image.","Ne peut pas créer l'image."
 "Cancel","Annuler"
 "Cannot create image.","Ne peut pas créer l'image."
 "Cannot create writeable directory '%s'.","Ne peut pas créer un répertoire enregistrable '%s'."
@@ -393,7 +393,7 @@
 "Minimum Advertised Price","Prix minimum annoncés"
 "Minimum Lines per Page","Lignes minimum par page"
 "Minimum Quantity Allowed in Shopping Cart","Quantité minimum autorisée dans le panier"
-"Minimum Quantity for Item\'s Status to be Out of Stock","Quantité minimum pour que le statut de l'article soit ""Rupture de stock"""
+"Minimum Quantity for Item's Status to be Out of Stock","Quantité minimum pour que le statut de l'article soit ""Rupture de stock"""
 "Missing SKU, skipping the record.","SKU manquant, le dossier est sauté."
 "More Views","Plus de vues"
 "Move","Déplacer"
@@ -460,8 +460,8 @@
 "Please specify the number of products, that will not be divided into subintervals.","Veuillez spécifier le nombre de produits qui ne seront pas divisés en sous-intervalles."
 "Please specify the product required option(s)","Veuillez spécifier l'option/ les options requise(s) pour le produit"
 "Please specify the product required option(s).","Veuillez spécifier l'option/les options requise(s) pour le produit."
-"Please specify the product\'s option(s).","Veuillez spécifier les options du produit."
-"Please specify the product\'s required option(s).","Veuillez spécifier l'option/les options requise(s) du produit."
+"Please specify the product's option(s).","Veuillez spécifier les options du produit."
+"Please specify the product's required option(s).","Veuillez spécifier l'option/les options requise(s) du produit."
 "Please specify the quantity of product(s).","Veuillez spécifier la quantité de produit(s)."
 "Please specify time required option(s).","Veuillez spécifier les options dépendant du temps."
 "Please wait...","Veuillez patienter..."
@@ -526,7 +526,7 @@
 "Quantity","Qté"
 "Quantity Increments","Augmentation de la quantité"
 "Quantity Uses Decimals","La quantité utilise des décimales"
-"Quantity for Item\'s Status to Become Out of Stock","Nombre de statuts de produits bientôt épuisés"
+"Quantity for Item's Status to Become Out of Stock","Nombre de statuts de produits bientôt épuisés"
 "Quantity:","Qté:"
 "Quantity","Quantité"
 "Quick Create","Création Rapide"
diff --git a/app/code/Magento/Catalog/i18n/nl_NL.csv b/app/code/Magento/Catalog/i18n/nl_NL.csv
index 6cb2a1e1f0a..8cd20429f81 100644
--- a/app/code/Magento/Catalog/i18n/nl_NL.csv
+++ b/app/code/Magento/Catalog/i18n/nl_NL.csv
@@ -129,7 +129,7 @@
 "Can be Divided into Multiple Boxes for Shipping","Kan Worden Verdeeld over Meerdere Dozen bij Verzending"
 "Can be used only with catalog input type Dropdown","Kan worden gebruikt met catalogusinvoer type Dropdown"
 "Can be used only with catalog input type Dropdown, Multiple Select and Price","Kan alleen worden gebruikt met catalogusinvoer type Dropdown. Meervoudige selectie en Prijs"
-"Can\'t create image.","Kan geen beeld maken"
+"Can't create image.","Kan geen beeld maken"
 "Cancel","Annuleren"
 "Cannot create image.","Kan beeld niet creëren."
 "Cannot create writeable directory '%s'.","Kan geen beschrijfbare directory '%s' aanmaken"
@@ -393,7 +393,7 @@
 "Minimum Advertised Price","Minimum Geadverteerde Prijs"
 "Minimum Lines per Page","Minimum Regels per Pagina"
 "Minimum Quantity Allowed in Shopping Cart","Minimum Quantity Toegestaan in Winkelwagen"
-"Minimum Quantity for Item\'s Status to be Out of Stock","Minimum aantal waarbij Status van Item op geen voorraad komt"
+"Minimum Quantity for Item's Status to be Out of Stock","Minimum aantal waarbij Status van Item op geen voorraad komt"
 "Missing SKU, skipping the record.","SKU mist, record wordt overgeslagen."
 "More Views","Meer Views"
 "Move","Verplaats"
@@ -460,8 +460,8 @@
 "Please specify the number of products, that will not be divided into subintervals.","Geef het aantal producten op, die niet in sub-intervallen zullen worden verdeeld."
 "Please specify the product required option(s)","Specificeer alstublieft de benodige optie(s) voor het product."
 "Please specify the product required option(s).","Specificeer alstublieft de benodige optie(s) voor de datum."
-"Please specify the product\'s option(s).","Specificeer de product optie(s)."
-"Please specify the product\'s required option(s).","Gelieve het artikel's benodigde optie(s) te specificeren."
+"Please specify the product's option(s).","Specificeer de product optie(s)."
+"Please specify the product's required option(s).","Gelieve het artikel's benodigde optie(s) te specificeren."
 "Please specify the quantity of product(s).","Specificeer alstublieft de hoeveelheid product(en)."
 "Please specify time required option(s).","Specificeer alstublieft de benodigde optie(s) voor de tijd."
 "Please wait...","Even geduld..."
@@ -526,7 +526,7 @@
 "Quantity","Hoeveelheid"
 "Quantity Increments","Hoeveelheid Stappen"
 "Quantity Uses Decimals","Hoeveelheid Gebruikt Decimalen"
-"Quantity for Item\'s Status to Become Out of Stock","Hoeveelheid voor Status van Items die niet Op Voorraad Zijn"
+"Quantity for Item's Status to Become Out of Stock","Hoeveelheid voor Status van Items die niet Op Voorraad Zijn"
 "Quantity:","Hoeveelheid:"
 "Quantity","Hoeveelheid"
 "Quick Create","Snel aanmaken"
diff --git a/app/code/Magento/Catalog/i18n/pt_BR.csv b/app/code/Magento/Catalog/i18n/pt_BR.csv
index 12bf8bcf8a9..aacea184851 100644
--- a/app/code/Magento/Catalog/i18n/pt_BR.csv
+++ b/app/code/Magento/Catalog/i18n/pt_BR.csv
@@ -129,7 +129,7 @@
 "Can be Divided into Multiple Boxes for Shipping","Pode ser dividido em várias caixas para envio"
 "Can be used only with catalog input type Dropdown","Pode ser usado somente com o tipo de catálogo de entrada Dropdown"
 "Can be used only with catalog input type Dropdown, Multiple Select and Price","Pode ser usado somente com o tipo de catálogo de entrada Dropdown, Seleção Múltipla e Preço"
-"Can\'t create image.","Não é possível criar imagem."
+"Can't create image.","Não é possível criar imagem."
 "Cancel","Cancelar"
 "Cannot create image.","Não é possível criar imagem."
 "Cannot create writeable directory '%s'.","Não é possível criar diretório gravável ""%s"" ."
@@ -393,7 +393,7 @@
 "Minimum Advertised Price","Preço Mínimo Anunciado"
 "Minimum Lines per Page","Número Mínimo de Linhas por Página"
 "Minimum Quantity Allowed in Shopping Cart","Qtde Mínima Permitida no Carrinho de Compras"
-"Minimum Quantity for Item\'s Status to be Out of Stock","Qtde. Mínima de Itens para Estado Atual como Fora do Estoque"
+"Minimum Quantity for Item's Status to be Out of Stock","Qtde. Mínima de Itens para Estado Atual como Fora do Estoque"
 "Missing SKU, skipping the record.","Unid. Manut. Estoque ausente. Saltando o registro."
 "More Views","Mais Visualizações"
 "Move","Mover"
@@ -460,8 +460,8 @@
 "Please specify the number of products, that will not be divided into subintervals.","Por favor especifique o número de produtos, que não será dividido em subintervalos."
 "Please specify the product required option(s)","Favor especificar opção(ões) obrigatória(s) do produto"
 "Please specify the product required option(s).","Favor especificar opção(ões) obrigatória(s) do produto."
-"Please specify the product\'s option(s).","Por favor especifique a(s) opção/opções do produto."
-"Please specify the product\'s required option(s).","Por favor especifique a(s) opção/opções necessária(s) do produto."
+"Please specify the product's option(s).","Por favor especifique a(s) opção/opções do produto."
+"Please specify the product's required option(s).","Por favor especifique a(s) opção/opções necessária(s) do produto."
 "Please specify the quantity of product(s).","Favor especificar a quantidade de produto(s)."
 "Please specify time required option(s).","Favor especificar opção(ões) obrigatória(s) para hora."
 "Please wait...","Por favor aguarde..."
@@ -526,7 +526,7 @@
 "Quantity","Quant."
 "Quantity Increments","Incrementos de Quantidade"
 "Quantity Uses Decimals","Qtde: Usa Decimais"
-"Quantity for Item\'s Status to Become Out of Stock","Quantidade para que o status do item se torne ""Fora de estoque"""
+"Quantity for Item's Status to Become Out of Stock","Quantidade para que o status do item se torne ""Fora de estoque"""
 "Quantity:","Quantidade:"
 "Quantity","Quantidade"
 "Quick Create","Criação Rápida"
diff --git a/app/code/Magento/Catalog/i18n/zh_CN.csv b/app/code/Magento/Catalog/i18n/zh_CN.csv
index 8eba15cdcc8..8669e613a9c 100644
--- a/app/code/Magento/Catalog/i18n/zh_CN.csv
+++ b/app/code/Magento/Catalog/i18n/zh_CN.csv
@@ -129,7 +129,7 @@
 "Can be Divided into Multiple Boxes for Shipping","可拆分为多个箱发货"
 "Can be used only with catalog input type Dropdown","仅可用于类别输入类型 下拉"
 "Can be used only with catalog input type Dropdown, Multiple Select and Price","仅可用于类别输入类型 下拉、多选和价格"
-"Can\'t create image.","无法创建图片。"
+"Can't create image.","无法创建图片。"
 "Cancel","取消"
 "Cannot create image.","无法创建图片。"
 "Cannot create writeable directory '%s'.","无法创建可写的目录 '%s'。"
@@ -393,7 +393,7 @@
 "Minimum Advertised Price","最低广告价格"
 "Minimum Lines per Page","每页最低行数"
 "Minimum Quantity Allowed in Shopping Cart","购物车里允许的最少数量"
-"Minimum Quantity for Item\'s Status to be Out of Stock","商品状态的最小数量为缺货"
+"Minimum Quantity for Item's Status to be Out of Stock","商品状态的最小数量为缺货"
 "Missing SKU, skipping the record.","丢失SKU,正在跳过该记录。"
 "More Views","更多视图"
 "Move","移动"
@@ -460,8 +460,8 @@
 "Please specify the number of products, that will not be divided into subintervals.","请注明不会被划分成子区间的产品的数量。"
 "Please specify the product required option(s)","请指定产品需要的选项"
 "Please specify the product required option(s).","请指定产品需要的选项。"
-"Please specify the product\'s option(s).","请指定产品的选项。"
-"Please specify the product\'s required option(s).","请指定产品的必要选项。"
+"Please specify the product's option(s).","请指定产品的选项。"
+"Please specify the product's required option(s).","请指定产品的必要选项。"
 "Please specify the quantity of product(s).","请指定产品数量。"
 "Please specify time required option(s).","请指定时间需要的选项。"
 "Please wait...","请稍候..."
@@ -526,7 +526,7 @@
 "Quantity","数量"
 "Quantity Increments","数量增量"
 "Quantity Uses Decimals","数量使用小数"
-"Quantity for Item\'s Status to Become Out of Stock","项目的状态变为无货时的数量"
+"Quantity for Item's Status to Become Out of Stock","项目的状态变为无货时的数量"
 "Quantity:","数量:"
 "Quantity","数量"
 "Quick Create","快速创建"
diff --git a/app/code/Magento/CatalogInventory/Block/Qtyincrements.php b/app/code/Magento/CatalogInventory/Block/Qtyincrements.php
index febed058ee0..ca53988242a 100644
--- a/app/code/Magento/CatalogInventory/Block/Qtyincrements.php
+++ b/app/code/Magento/CatalogInventory/Block/Qtyincrements.php
@@ -46,18 +46,18 @@ class Qtyincrements extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/CatalogInventory/Block/Stockqty/AbstractStockqty.php b/app/code/Magento/CatalogInventory/Block/Stockqty/AbstractStockqty.php
index 1f2905f6592..bf8d1225087 100644
--- a/app/code/Magento/CatalogInventory/Block/Stockqty/AbstractStockqty.php
+++ b/app/code/Magento/CatalogInventory/Block/Stockqty/AbstractStockqty.php
@@ -41,18 +41,18 @@ abstract class AbstractStockqty extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php b/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php
index a20391225a9..26d6b22d3f4 100644
--- a/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php
+++ b/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php
@@ -43,8 +43,8 @@ class Managestock
     protected $_stockStatus;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\CatalogInventory\Model\Stock\Status $stockStatus
@@ -53,8 +53,8 @@ class Managestock
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\CatalogInventory\Model\Stock\Status $stockStatus,
diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php
index cfeb7dcdcec..74652796e34 100644
--- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php
+++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php
@@ -98,8 +98,8 @@ class Stock extends \Magento\Index\Model\Indexer\AbstractIndexer
     protected $_indexer;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Index\Model\Indexer $indexer
      * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -107,8 +107,8 @@ class Stock extends \Magento\Index\Model\Indexer\AbstractIndexer
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Index\Model\Indexer $indexer,
         \Magento\CatalogInventory\Helper\Data $catalogInventoryData,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/CatalogInventory/Model/Source/Backorders.php b/app/code/Magento/CatalogInventory/Model/Source/Backorders.php
index 3e5bc33cc5f..94d32b4f18b 100644
--- a/app/code/Magento/CatalogInventory/Model/Source/Backorders.php
+++ b/app/code/Magento/CatalogInventory/Model/Source/Backorders.php
@@ -26,7 +26,7 @@
 
 namespace Magento\CatalogInventory\Model\Source;
 
-class Backorders implements \Magento\Core\Model\Option\ArrayInterface
+class Backorders implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/CatalogInventory/Model/Source/Stock.php b/app/code/Magento/CatalogInventory/Model/Source/Stock.php
index 5514e9f0b50..872c0ce4fff 100644
--- a/app/code/Magento/CatalogInventory/Model/Source/Stock.php
+++ b/app/code/Magento/CatalogInventory/Model/Source/Stock.php
@@ -34,7 +34,7 @@
  */
 namespace Magento\CatalogInventory\Model\Source;
 
-class Stock implements \Magento\Core\Model\Option\ArrayInterface
+class Stock implements \Magento\Option\ArrayInterface
 {
     /**
      * Retrieve option array
diff --git a/app/code/Magento/CatalogInventory/Model/Stock.php b/app/code/Magento/CatalogInventory/Model/Stock.php
index 3145cc0a975..c68655c78ee 100644
--- a/app/code/Magento/CatalogInventory/Model/Stock.php
+++ b/app/code/Magento/CatalogInventory/Model/Stock.php
@@ -74,8 +74,8 @@ class Stock extends \Magento\Core\Model\AbstractModel
     protected $_collectionFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\CatalogInventory\Model\Resource\Stock\Item\CollectionFactory $collectionFactory
      * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -85,8 +85,8 @@ class Stock extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\CatalogInventory\Model\Resource\Stock\Item\CollectionFactory $collectionFactory,
         \Magento\CatalogInventory\Helper\Data $catalogInventoryData,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Stock/Item.php
index e2afd9b0e53..feaccc4285b 100644
--- a/app/code/Magento/CatalogInventory/Model/Stock/Item.php
+++ b/app/code/Magento/CatalogInventory/Model/Stock/Item.php
@@ -192,8 +192,8 @@ class Item extends \Magento\Core\Model\AbstractModel
     protected $mathDivision;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Index\Model\Indexer $indexer
      * @param Status $stockStatus
@@ -208,8 +208,8 @@ class Item extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Index\Model\Indexer $indexer,
         Status $stockStatus,
diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Stock/Status.php
index dbfe2d2b260..5cb0cad1315 100644
--- a/app/code/Magento/CatalogInventory/Model/Stock/Status.php
+++ b/app/code/Magento/CatalogInventory/Model/Stock/Status.php
@@ -94,8 +94,8 @@ class Status extends \Magento\Core\Model\AbstractModel
     protected $_stockItemFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param Type $productType
      * @param \Magento\Catalog\Model\Product\Website $productWebsite
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -106,8 +106,8 @@ class Status extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         Type $productType,
         \Magento\Catalog\Model\Product\Website $productWebsite,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
diff --git a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php
index cf01c32b07c..0980e26b536 100644
--- a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php
+++ b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php
@@ -40,8 +40,8 @@ class Minsaleqty extends \Magento\Core\Model\Config\Value
     protected $_catalogInventoryMinsaleqty = null;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\CatalogInventory\Helper\Minsaleqty $catalogInventoryMinsaleqty
@@ -50,8 +50,8 @@ class Minsaleqty extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\CatalogInventory\Helper\Minsaleqty $catalogInventoryMinsaleqty,
diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit.php
index 756f5f4a969..a90816ca1ee 100644
--- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit.php
+++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit.php
@@ -35,18 +35,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php
index aee7d8179c8..ccc526c66a3 100644
--- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php
+++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php
@@ -44,7 +44,7 @@ class Conditions extends Generic implements TabInterface
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Rule\Block\Conditions $conditions
      * @param \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset
@@ -52,7 +52,7 @@ class Conditions extends Generic implements TabInterface
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Rule\Block\Conditions $conditions,
         \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset,
diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php
index f618fbc299c..631c5ce80bf 100644
--- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php
+++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php
@@ -51,7 +51,7 @@ class Main extends Generic implements TabInterface
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Customer\Model\Resource\Group\CollectionFactory $customerGroup
      * @param \Magento\Core\Model\System\Store $systemStore
@@ -59,7 +59,7 @@ class Main extends Generic implements TabInterface
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Customer\Model\Resource\Group\CollectionFactory $customerGroup,
         \Magento\Core\Model\System\Store $systemStore,
diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php
index 37d081627a2..baacc29d157 100644
--- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php
+++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php
@@ -38,7 +38,7 @@ use Magento\Backend\App\Action\Context;
 use Magento\CatalogRule\Model\Rule\Job;
 use Magento\Core\Exception;
 use Magento\Core\Filter\Date;
-use Magento\Core\Model\Registry;
+use Magento\Registry;
 use Magento\Rule\Model\Condition\AbstractCondition;
 use Magento\Rule\Model\Action\AbstractAction;
 
diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Widget.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Widget.php
index 3c92ec799cc..71e478af412 100644
--- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Widget.php
+++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Widget.php
@@ -29,7 +29,7 @@ namespace Magento\CatalogRule\Controller\Adminhtml\Promo;
 use Magento\Backend\App\Action;
 use Magento\Backend\App\Action\Context;
 use Magento\Catalog\Model\Category;
-use Magento\Core\Model\Registry;
+use Magento\Registry;
 
 class Widget extends Action
 {
diff --git a/app/code/Magento/CatalogRule/Model/Observer.php b/app/code/Magento/CatalogRule/Model/Observer.php
index ffce60cff90..c89adb6b800 100644
--- a/app/code/Magento/CatalogRule/Model/Observer.php
+++ b/app/code/Magento/CatalogRule/Model/Observer.php
@@ -36,7 +36,7 @@ use Magento\CatalogRule\Model\Rule\Condition\Combine;
 use Magento\CatalogRule\Model\Rule;
 use Magento\CatalogRule\Model\Resource\Rule\Collection;
 use Magento\CatalogRule\Model\Rule\Product\Price;
-use Magento\Core\Model\Registry;
+use Magento\Registry;
 use Magento\Core\Model\StoreManagerInterface;
 use Magento\Core\Model\LocaleInterface;
 use Magento\Customer\Model\Group;
diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php
index a4e99c5474c..95f6e6ae46b 100644
--- a/app/code/Magento/CatalogRule/Model/Rule.php
+++ b/app/code/Magento/CatalogRule/Model/Rule.php
@@ -168,8 +168,8 @@ class Rule extends \Magento\Rule\Model\AbstractModel
     protected $dateTime;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory
@@ -189,8 +189,8 @@ class Rule extends \Magento\Rule\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory,
diff --git a/app/code/Magento/CatalogSearch/Block/Layer.php b/app/code/Magento/CatalogSearch/Block/Layer.php
index 02ade565f81..4d06359b0b3 100644
--- a/app/code/Magento/CatalogSearch/Block/Layer.php
+++ b/app/code/Magento/CatalogSearch/Block/Layer.php
@@ -34,7 +34,7 @@ use Magento\Catalog\Block\Layer\View;
 use Magento\CatalogSearch\Helper\Data;
 use Magento\CatalogSearch\Model\Layer as ModelLayer;
 use Magento\CatalogSearch\Model\Resource\EngineProvider;
-use Magento\Core\Model\Registry;
+use Magento\Registry;
 use Magento\View\Element\Template\Context;
 
 class Layer extends View
@@ -52,7 +52,7 @@ class Layer extends View
      * @var Registry
      */
     protected $_coreRegistry = null;
-    
+
     /**
      * Catalog search data
      *
diff --git a/app/code/Magento/CatalogSearch/Model/Advanced.php b/app/code/Magento/CatalogSearch/Model/Advanced.php
index 18cdbaafeef..0f67a594709 100644
--- a/app/code/Magento/CatalogSearch/Model/Advanced.php
+++ b/app/code/Magento/CatalogSearch/Model/Advanced.php
@@ -64,8 +64,8 @@ use Magento\CatalogSearch\Model\Resource\EngineInterface;
 use Magento\CatalogSearch\Model\Resource\EngineProvider;
 use Magento\Core\Exception;
 use Magento\Core\Model\AbstractModel;
-use Magento\Core\Model\Context;
-use Magento\Core\Model\Registry;
+use Magento\Model\Context;
+use Magento\Registry;
 use Magento\Core\Model\StoreManagerInterface;
 use Magento\Directory\Model\Currency;
 use Magento\Directory\Model\CurrencyFactory;
diff --git a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php
index 93c1087eb46..14a58625709 100644
--- a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php
+++ b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php
@@ -37,8 +37,8 @@ namespace Magento\CatalogSearch\Model\Config\Backend\Search;
 use Magento\App\ConfigInterface;
 use Magento\CatalogSearch\Model\Fulltext;
 use Magento\Core\Model\Config\Value;
-use Magento\Core\Model\Context;
-use Magento\Core\Model\Registry;
+use Magento\Model\Context;
+use Magento\Registry;
 use Magento\Core\Model\Resource\AbstractResource;
 use Magento\Core\Model\StoreManagerInterface;
 use Magento\Data\Collection\Db;
diff --git a/app/code/Magento/CatalogSearch/Model/Config/Source/Search/Type.php b/app/code/Magento/CatalogSearch/Model/Config/Source/Search/Type.php
index dcabbca5b77..fe5d4da9922 100644
--- a/app/code/Magento/CatalogSearch/Model/Config/Source/Search/Type.php
+++ b/app/code/Magento/CatalogSearch/Model/Config/Source/Search/Type.php
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Catalog search types
+ *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -18,26 +20,12 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_CatalogSearch
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
-
-/**
- * Catalog search types
- *
- * @category   Magento
- * @package    Magento_CatalogSearch
- * @author      Magento Core Team <core@magentocommerce.com>
- */
 namespace Magento\CatalogSearch\Model\Config\Source\Search;
 
-use Magento\CatalogSearch\Model\Fulltext;
-use Magento\Core\Model\Option\ArrayInterface;
-
-class Type implements ArrayInterface
+class Type implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
@@ -45,9 +33,9 @@ class Type implements ArrayInterface
     public function toOptionArray()
     {
         $types = array(
-            Fulltext::SEARCH_TYPE_LIKE     => 'Like',
-            Fulltext::SEARCH_TYPE_FULLTEXT => 'Fulltext',
-            Fulltext::SEARCH_TYPE_COMBINE  => 'Combine (Like and Fulltext)',
+            \Magento\CatalogSearch\Model\Fulltext::SEARCH_TYPE_LIKE     => 'Like',
+            \Magento\CatalogSearch\Model\Fulltext::SEARCH_TYPE_FULLTEXT => 'Fulltext',
+            \Magento\CatalogSearch\Model\Fulltext::SEARCH_TYPE_COMBINE  => 'Combine (Like and Fulltext)',
         );
         $options = array();
         foreach ($types as $k => $v) {
diff --git a/app/code/Magento/CatalogSearch/Model/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Fulltext.php
index 53d64ead391..93b49af32e7 100644
--- a/app/code/Magento/CatalogSearch/Model/Fulltext.php
+++ b/app/code/Magento/CatalogSearch/Model/Fulltext.php
@@ -45,8 +45,8 @@ namespace Magento\CatalogSearch\Model;
 use Magento\CatalogSearch\Helper\Data;
 use Magento\CatalogSearch\Model\Query;
 use Magento\Core\Model\AbstractModel;
-use Magento\Core\Model\Context;
-use Magento\Core\Model\Registry;
+use Magento\Model\Context;
+use Magento\Registry;
 use Magento\Core\Model\Resource\AbstractResource;
 use Magento\Core\Model\Store\Config;
 use Magento\Data\Collection\Db;
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php
index fc241dcc3f4..3a3184a3590 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php
@@ -38,8 +38,8 @@ use Magento\Catalog\Model\Resource\Eav\Attribute;
 use Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory;
 use Magento\CatalogSearch\Model\Fulltext as ModelFulltext;
 use Magento\CatalogSearch\Model\Resource\Indexer\Fulltext as IndexerFulltext;
-use Magento\Core\Model\Context;
-use Magento\Core\Model\Registry;
+use Magento\Model\Context;
+use Magento\Registry;
 use Magento\Core\Model\Resource\AbstractResource;
 use Magento\Core\Model\Store;
 use Magento\Core\Model\Store\Group;
diff --git a/app/code/Magento/CatalogSearch/Model/Layer.php b/app/code/Magento/CatalogSearch/Model/Layer.php
index d4df6833c1a..d246fa58ad2 100644
--- a/app/code/Magento/CatalogSearch/Model/Layer.php
+++ b/app/code/Magento/CatalogSearch/Model/Layer.php
@@ -38,7 +38,7 @@ use Magento\Catalog\Model\Resource\Product;
 use Magento\CatalogSearch\Helper\Data;
 use Magento\CatalogSearch\Model\Query;
 use Magento\CatalogSearch\Model\Resource\Fulltext\CollectionFactory;
-use Magento\Core\Model\Registry;
+use Magento\Registry;
 use Magento\Core\Model\StoreManagerInterface;
 use Magento\Customer\Model\Session;
 use Magento\Eav\Model\Entity\Attribute;
diff --git a/app/code/Magento/CatalogSearch/Model/Query.php b/app/code/Magento/CatalogSearch/Model/Query.php
index 6a01bcdae0f..737423b68e8 100644
--- a/app/code/Magento/CatalogSearch/Model/Query.php
+++ b/app/code/Magento/CatalogSearch/Model/Query.php
@@ -59,8 +59,8 @@ use Magento\CatalogSearch\Model\Resource\Query\CollectionFactory as QueryCollect
 use Magento\CatalogSearch\Model\Resource\Search\Collection;
 use Magento\CatalogSearch\Model\Resource\Search\CollectionFactory;
 use Magento\Core\Model\AbstractModel;
-use Magento\Core\Model\Context;
-use Magento\Core\Model\Registry;
+use Magento\Model\Context;
+use Magento\Registry;
 use Magento\Core\Model\Resource\AbstractResource;
 use Magento\Core\Model\Store\Config;
 use Magento\Core\Model\StoreManagerInterface;
diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php
index 0d3ed7fd4e3..12c903eb1a0 100644
--- a/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php
+++ b/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php
@@ -55,7 +55,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
      * @param \Magento\Validator\UniversalFactory $universalFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Catalog\Helper\Product\Flat $catalogProductFlat
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
      * @param \Magento\Catalog\Model\Resource\Url $catalogUrl
@@ -79,7 +79,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
         \Magento\Validator\UniversalFactory $universalFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Catalog\Helper\Product\Flat $catalogProductFlat,
+        \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
         \Magento\Catalog\Model\Resource\Url $catalogUrl,
@@ -102,7 +102,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
             $universalFactory,
             $storeManager,
             $catalogData,
-            $catalogProductFlat,
+            $catalogProductFlatState,
             $coreStoreConfig,
             $productOptionFactory,
             $catalogUrl,
diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Collection.php
index 42d43f09add..ec2f3af864d 100644
--- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Collection.php
+++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Collection.php
@@ -60,7 +60,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
      * @param \Magento\Validator\UniversalFactory $universalFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Catalog\Helper\Product\Flat $catalogProductFlat
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
      * @param \Magento\Catalog\Model\Resource\Url $catalogUrl
@@ -85,7 +85,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
         \Magento\Validator\UniversalFactory $universalFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Catalog\Helper\Product\Flat $catalogProductFlat,
+        \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
         \Magento\Catalog\Model\Resource\Url $catalogUrl,
@@ -110,7 +110,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
             $universalFactory,
             $storeManager,
             $catalogData,
-            $catalogProductFlat,
+            $catalogProductFlatState,
             $coreStoreConfig,
             $productOptionFactory,
             $catalogUrl,
diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Search/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Search/Collection.php
index 9ec480f1771..84f430c25d6 100644
--- a/app/code/Magento/CatalogSearch/Model/Resource/Search/Collection.php
+++ b/app/code/Magento/CatalogSearch/Model/Resource/Search/Collection.php
@@ -67,7 +67,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
      * @param \Magento\Validator\UniversalFactory $universalFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Catalog\Helper\Product\Flat $catalogProductFlat
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
      * @param \Magento\Catalog\Model\Resource\Url $catalogUrl
@@ -91,7 +91,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
         \Magento\Validator\UniversalFactory $universalFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Catalog\Helper\Product\Flat $catalogProductFlat,
+        \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
         \Magento\Catalog\Model\Resource\Url $catalogUrl,
@@ -114,7 +114,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
             $universalFactory,
             $storeManager,
             $catalogData,
-            $catalogProductFlat,
+            $catalogProductFlatState,
             $coreStoreConfig,
             $productOptionFactory,
             $catalogUrl,
diff --git a/app/code/Magento/Centinel/Block/Authentication/Complete.php b/app/code/Magento/Centinel/Block/Authentication/Complete.php
index 14695b31801..5e868a9a1af 100644
--- a/app/code/Magento/Centinel/Block/Authentication/Complete.php
+++ b/app/code/Magento/Centinel/Block/Authentication/Complete.php
@@ -35,18 +35,18 @@ class Complete extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Centinel/Block/Authentication/Start.php b/app/code/Magento/Centinel/Block/Authentication/Start.php
index 042e8aa842c..752f70739ad 100644
--- a/app/code/Magento/Centinel/Block/Authentication/Start.php
+++ b/app/code/Magento/Centinel/Block/Authentication/Start.php
@@ -35,18 +35,18 @@ class Start extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php b/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php
index 296bd60ceaa..6b3227be803 100644
--- a/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php
+++ b/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php
@@ -38,17 +38,17 @@ class Index extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Centinel/Controller/Index.php b/app/code/Magento/Centinel/Controller/Index.php
index 60268cdc726..7e923d607f4 100644
--- a/app/code/Magento/Centinel/Controller/Index.php
+++ b/app/code/Magento/Centinel/Controller/Index.php
@@ -35,17 +35,17 @@ class Index extends \Magento\App\Action\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Centinel/Model/Api.php b/app/code/Magento/Centinel/Model/Api.php
index 1f0a535f688..b5e8d23fad2 100644
--- a/app/code/Magento/Centinel/Model/Api.php
+++ b/app/code/Magento/Centinel/Model/Api.php
@@ -87,15 +87,15 @@ class Api extends \Magento\Object
     /**
      * Log adapter factory
      *
-     * @var \Magento\Core\Model\Log\AdapterFactory
+     * @var \Magento\Logger\AdapterFactory
      */
     protected $_logFactory;
 
     /**
-     * @param \Magento\Core\Model\Log\AdapterFactory $logFactory
+     * @param \Magento\Logger\AdapterFactory $logFactory
      * @param array $data
      */
-    public function __construct(\Magento\Core\Model\Log\AdapterFactory $logFactory, array $data = array())
+    public function __construct(\Magento\Logger\AdapterFactory $logFactory, array $data = array())
     {
         $this->_logFactory = $logFactory;
         parent::__construct($data);
diff --git a/app/code/Magento/Checkout/Block/Adminhtml/Agreement.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement.php
index 2ddcb120c80..64d2d37c456 100644
--- a/app/code/Magento/Checkout/Block/Adminhtml/Agreement.php
+++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Adminhtml;
 
 /**
  * Admin tax rule content block
@@ -31,11 +32,11 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-
-namespace Magento\Checkout\Block\Adminhtml;
-
 class Agreement extends \Magento\Backend\Block\Widget\Grid\Container
 {
+    /**
+     * @return void
+     */
     protected function _construct()
     {
         $this->_controller = 'adminhtml_agreement';
diff --git a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit.php
index c325bb832f7..bdd9addcbf6 100644
--- a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit.php
+++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit.php
@@ -23,7 +23,6 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Checkout\Block\Adminhtml\Agreement;
 
 class Edit extends \Magento\Backend\Block\Widget\Form\Container
@@ -31,18 +30,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
@@ -52,6 +51,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Init class
      *
+     * @return void
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php
index bdd0e50bed9..985ddf04301 100644
--- a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php
+++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php
@@ -23,7 +23,6 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Checkout\Block\Adminhtml\Agreement\Edit;
 
 class Form extends \Magento\Backend\Block\Widget\Form\Generic
@@ -35,14 +34,14 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\System\Store $systemStore
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\System\Store $systemStore,
         array $data = array()
@@ -54,6 +53,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
     /**
      * Init class
      *
+     * @return void
      */
     protected function _construct()
     {
@@ -64,8 +64,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
     }
 
     /**
-     *
-     * return \Magento\Backend\Block\Widget\Form
+     * @return $this
      */
     protected function _prepareForm()
     {
diff --git a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Grid.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Grid.php
index 3103a36713f..8f619165247 100644
--- a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Grid.php
+++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Grid.php
@@ -48,6 +48,9 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
         parent::__construct($context, $backendHelper, $data);
     }
 
+    /**
+     * @return void
+     */
     protected function _construct()
     {
         parent::_construct();
@@ -57,12 +60,18 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
         $this->setSaveParametersInSession(true);
     }
 
+    /**
+     * @return $this
+     */
     protected function _prepareCollection()
     {
         $this->setCollection($this->_collectionFactory->create());
         return parent::_prepareCollection();
     }
 
+    /**
+     * @return $this
+     */
     protected function _prepareColumns()
     {
         $this->addColumn('agreement_id',
@@ -113,12 +122,20 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
         return parent::_prepareColumns();
     }
 
+    /**
+     * @return void
+     */
     protected function _afterLoadCollection()
     {
         $this->getCollection()->walk('afterLoad');
         parent::_afterLoadCollection();
     }
 
+    /**
+     * @param \Magento\Data\Collection $collection
+     * @param \Magento\Backend\Block\Widget\Grid\Column $column
+     * @return void
+     */
     protected function _filterStoreCondition($collection, $column)
     {
         if (!$value = $column->getFilter()->getValue()) {
@@ -128,6 +145,10 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
         $this->getCollection()->addStoreFilter($value);
     }
 
+    /**
+     * @param \Magento\Object $row
+     * @return string
+     */
     public function getRowUrl($row)
     {
         return $this->getUrl('checkout/*/edit', array('id' => $row->getId()));
diff --git a/app/code/Magento/Checkout/Block/Cart.php b/app/code/Magento/Checkout/Block/Cart.php
index 658a01cb0ee..8592712fbca 100644
--- a/app/code/Magento/Checkout/Block/Cart.php
+++ b/app/code/Magento/Checkout/Block/Cart.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block;
 
 /**
  * Shopping cart block
@@ -31,8 +32,6 @@
  * @package     Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block;
-
 class Cart extends \Magento\Checkout\Block\Cart\AbstractCart
 {
     /**
@@ -72,6 +71,7 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart
     /**
      * Prepare Quote Item Product URLs
      *
+     * @return void
      */
     protected function _construct()
     {
@@ -81,6 +81,8 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart
 
     /**
      * prepare cart items URLs
+     *
+     * @return void
      */
     public function prepareItemUrls()
     {
@@ -157,7 +159,7 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart
     }
 
     /**
-     * @return mixed
+     * @return string
      */
     public function getContinueShoppingUrl()
     {
diff --git a/app/code/Magento/Checkout/Block/Cart/AbstractCart.php b/app/code/Magento/Checkout/Block/Cart/AbstractCart.php
index 4ab8b85cf33..c7d2896a013 100644
--- a/app/code/Magento/Checkout/Block/Cart/AbstractCart.php
+++ b/app/code/Magento/Checkout/Block/Cart/AbstractCart.php
@@ -23,6 +23,10 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Cart;
+
+use Magento\Customer\Model\Customer;
+use Magento\Sales\Model\Quote;
 
 /**
  * Shopping cart abstract block
@@ -31,8 +35,6 @@
  * @package     Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Cart;
-
 class AbstractCart extends \Magento\View\Element\Template
 {
     /**
@@ -40,9 +42,24 @@ class AbstractCart extends \Magento\View\Element\Template
      */
     const DEFAULT_TYPE = 'default';
 
+    /**
+     * @var Customer|null
+     */
     protected $_customer = null;
+
+    /**
+     * @var Quote|null
+     */
     protected $_quote    = null;
+
+    /**
+     * @var array
+     */
     protected $_totals;
+
+    /**
+     * @var array
+     */
     protected $_itemRenders = array();
 
     /**
@@ -99,7 +116,6 @@ class AbstractCart extends \Magento\View\Element\Template
      * Retrieve item renderer block
      *
      * @param string $type
-     *
      * @return \Magento\View\Element\Template
      * @throws \RuntimeException
      */
@@ -117,7 +133,7 @@ class AbstractCart extends \Magento\View\Element\Template
     /**
      * Get logged in customer
      *
-     * @return \Magento\Customer\Model\Customer
+     * @return Customer
      */
     public function getCustomer()
     {
@@ -130,7 +146,7 @@ class AbstractCart extends \Magento\View\Element\Template
     /**
      * Get active quote
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return Quote
      */
     public function getQuote()
     {
@@ -162,11 +178,17 @@ class AbstractCart extends \Magento\View\Element\Template
         return $renderer->toHtml();
     }
 
+    /**
+     * @return array
+     */
     public function getTotals()
     {
         return $this->getTotalsCache();
     }
 
+    /**
+     * @return array
+     */
     public function getTotalsCache()
     {
         if (empty($this->_totals)) {
diff --git a/app/code/Magento/Checkout/Block/Cart/Coupon.php b/app/code/Magento/Checkout/Block/Cart/Coupon.php
index 49186d3a5bd..bbe11d4d9bd 100644
--- a/app/code/Magento/Checkout/Block/Cart/Coupon.php
+++ b/app/code/Magento/Checkout/Block/Cart/Coupon.php
@@ -23,7 +23,6 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Checkout\Block\Cart;
 
 class Coupon extends \Magento\Checkout\Block\Cart\AbstractCart
@@ -46,6 +45,9 @@ class Coupon extends \Magento\Checkout\Block\Cart\AbstractCart
         $this->_isScopePrivate = true;
     }
 
+    /**
+     * @return string
+     */
     public function getCouponCode()
     {
         return $this->getQuote()->getCouponCode();
diff --git a/app/code/Magento/Checkout/Block/Cart/Crosssell.php b/app/code/Magento/Checkout/Block/Cart/Crosssell.php
index 9690e80677b..049a818fe1d 100644
--- a/app/code/Magento/Checkout/Block/Cart/Crosssell.php
+++ b/app/code/Magento/Checkout/Block/Cart/Crosssell.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Cart;
 
 /**
  * Cart crosssell list
@@ -31,8 +32,6 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Cart;
-
 class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct
 {
     /**
@@ -70,7 +69,7 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -92,7 +91,7 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Checkout/Block/Cart/Item/Configure.php b/app/code/Magento/Checkout/Block/Cart/Item/Configure.php
index 818b3087316..c1718f3537e 100644
--- a/app/code/Magento/Checkout/Block/Cart/Item/Configure.php
+++ b/app/code/Magento/Checkout/Block/Cart/Item/Configure.php
@@ -23,7 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Checkout\Block\Cart\Item;
 
 /**
  * Cart Item Configure block
@@ -33,15 +33,13 @@
  * @package    Magento_Checkout
  * @module     Checkout
  */
-namespace Magento\Checkout\Block\Cart\Item;
-
 class Configure extends \Magento\View\Element\Template
 {
 
     /**
      * Configure product view blocks
      *
-     * @return \Magento\Checkout\Block\Cart\Item\Configure
+     * @return $this
      */
     protected function _prepareLayout()
     {
diff --git a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php
index 4b290598b16..06d93bdd350 100644
--- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php
+++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php
@@ -23,6 +23,9 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Cart\Item;
+
+use Magento\Sales\Model\Quote\Item;
 
 /**
  * Shopping cart item render block
@@ -34,13 +37,22 @@
  * @method \Magento\Checkout\Block\Cart\Item\Renderer setProductName(string)
  * @method \Magento\Checkout\Block\Cart\Item\Renderer setDeleteUrl(string)
  */
-namespace Magento\Checkout\Block\Cart\Item;
 
 class Renderer extends \Magento\View\Element\Template
 {
-    /** @var \Magento\Checkout\Model\Session */
+    /**
+     * @var \Magento\Checkout\Model\Session
+     */
     protected $_checkoutSession;
+
+    /**
+     * @var Item
+     */
     protected $_item;
+
+    /**
+     * @var string
+     */
     protected $_productUrl;
 
     /**
@@ -121,7 +133,7 @@ class Renderer extends \Magento\View\Element\Template
     /**
      * Get quote item
      *
-     * @return \Magento\Sales\Model\Quote\Item
+     * @return Item
      */
     public function getItem()
     {
@@ -200,6 +212,10 @@ class Renderer extends \Magento\View\Element\Template
         return $this->getVar('product_thumbnail_image_sidebar_size', 'Magento_Catalog');
     }
 
+    /**
+     * @param string $productUrl
+     * @return $this
+     */
     public function overrideProductUrl($productUrl)
     {
         $this->_productUrl = $productUrl;
@@ -280,7 +296,7 @@ class Renderer extends \Magento\View\Element\Template
     /**
      * Get product customize options
      *
-     * @return array || false
+     * @return array
      */
     public function getProductOptions()
     {
@@ -336,7 +352,7 @@ class Renderer extends \Magento\View\Element\Template
     /**
      * Get quote item qty
      *
-     * @return float|int|string
+     * @return float|int
      */
     public function getQty()
     {
@@ -401,7 +417,7 @@ class Renderer extends \Magento\View\Element\Template
     /**
      * Accept option value and return its formatted view
      *
-     * @param mixed $optionValue
+     * @param string|array $optionValue
      * Method works well with these $optionValue format:
      *      1. String
      *      2. Indexed array e.g. array(val1, val2, ...)
@@ -452,7 +468,7 @@ class Renderer extends \Magento\View\Element\Template
     /**
      * Get html for MAP product enabled
      *
-     * @param \Magento\Sales\Model\Quote\Item $item
+     * @param Item $item
      * @return string
      */
     public function getMsrpHtml($item)
@@ -467,7 +483,7 @@ class Renderer extends \Magento\View\Element\Template
      * Set qty mode to be strict or not
      *
      * @param bool $strict
-     * @return \Magento\Checkout\Block\Cart\Item\Renderer
+     * @return $this
      */
     public function setQtyMode($strict)
     {
@@ -479,7 +495,7 @@ class Renderer extends \Magento\View\Element\Template
      * Set ignore product URL rendering
      *
      * @param bool $ignore
-     * @return \Magento\Checkout\Block\Cart\Item\Renderer
+     * @return $this
      */
     public function setIgnoreProductUrl($ignore = true)
     {
diff --git a/app/code/Magento/Checkout/Block/Cart/Link.php b/app/code/Magento/Checkout/Block/Cart/Link.php
index a2c4a1fc537..09be85ec999 100644
--- a/app/code/Magento/Checkout/Block/Cart/Link.php
+++ b/app/code/Magento/Checkout/Block/Cart/Link.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Cart;
 
 /**
  * "My Cart" link
  */
-namespace Magento\Checkout\Block\Cart;
-
 class Link extends \Magento\View\Element\Html\Link
 {
     /**
diff --git a/app/code/Magento/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php
index 7d773b392cc..a9a10aa2f65 100644
--- a/app/code/Magento/Checkout/Block/Cart/Shipping.php
+++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php
@@ -23,7 +23,6 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Checkout\Block\Cart;
 
 class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
@@ -93,7 +92,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
      * Get config
      *
      * @param string $path
-     * @return mixed
+     * @return string|null
      */
     public function getConfig($path)
     {
@@ -139,7 +138,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
      * Get Carrier Name
      *
      * @param string $carrierCode
-     * @return mixed
+     * @return string
      */
     public function getCarrierName($carrierCode)
     {
diff --git a/app/code/Magento/Checkout/Block/Cart/Sidebar.php b/app/code/Magento/Checkout/Block/Cart/Sidebar.php
index 6fb944ca95d..eca95e13f06 100644
--- a/app/code/Magento/Checkout/Block/Cart/Sidebar.php
+++ b/app/code/Magento/Checkout/Block/Cart/Sidebar.php
@@ -23,7 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Checkout\Block\Cart;
 
 /**
  * Wishlist sidebar block
@@ -32,8 +32,6 @@
  * @package     Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Cart;
-
 class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart
 {
     const XML_PATH_CHECKOUT_SIDEBAR_COUNT   = 'checkout/sidebar/count';
@@ -126,6 +124,7 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart
     /**
      * Get array of last added items
      *
+     * @param int|null $count
      * @return array
      */
     public function getRecentItems($count = null)
@@ -169,7 +168,7 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart
      * It will include tax, if required by config settings.
      *
      * @param   bool $skipTax flag for getting price with tax or not. Ignored in case when we display just subtotal incl.tax
-     * @return  decimal
+     * @return  float
      */
     public function getSubtotal($skipTax = true)
     {
@@ -198,7 +197,7 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart
      * Get subtotal, including tax.
      * Will return > 0 only if appropriate config settings are enabled.
      *
-     * @return decimal
+     * @return float
      */
     public function getSubtotalInclTax()
     {
@@ -241,7 +240,7 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart
     /**
      * Get shopping cart items qty based on configuration (summary qty or items qty)
      *
-     * @return int | float
+     * @return int|float
      */
     public function getSummaryCount()
     {
@@ -307,7 +306,7 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart
         return parent::getItems();
     }
 
-    /*
+    /**
      * Return totals from custom quote if needed
      *
      * @return array
@@ -354,7 +353,7 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart
     }
 
     /**
-     * Deserialize renders from string
+     * De-serialize renders from string
      *
      * @param string $renders
      * @return $this
diff --git a/app/code/Magento/Checkout/Block/Cart/Totals.php b/app/code/Magento/Checkout/Block/Cart/Totals.php
index b0d1098508a..3bd99c3e6a7 100644
--- a/app/code/Magento/Checkout/Block/Cart/Totals.php
+++ b/app/code/Magento/Checkout/Block/Cart/Totals.php
@@ -23,13 +23,25 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Checkout\Block\Cart;
 
+use Magento\View\Element\BlockInterface;
+
 class Totals extends \Magento\Checkout\Block\Cart\AbstractCart
 {
+    /**
+     * @var array
+     */
     protected $_totalRenderers;
+
+    /**
+     * @var string
+     */
     protected $_defaultRenderer = 'Magento\Checkout\Block\Total\DefaultTotal';
+
+    /**
+     * @var array
+     */
     protected $_totals = null;
 
     /**
@@ -59,6 +71,9 @@ class Totals extends \Magento\Checkout\Block\Cart\AbstractCart
 
     }
 
+    /**
+     * @return array
+     */
     public function getTotals()
     {
         if (is_null($this->_totals)) {
@@ -67,12 +82,20 @@ class Totals extends \Magento\Checkout\Block\Cart\AbstractCart
         return $this->_totals;
     }
 
+    /**
+     * @param array $value
+     * @return $this
+     */
     public function setTotals($value)
     {
         $this->_totals = $value;
         return $this;
     }
 
+    /**
+     * @param string $code
+     * @return BlockInterface
+     */
     protected function _getTotalRenderer($code)
     {
         $blockName = $code . '_total_renderer';
@@ -94,6 +117,12 @@ class Totals extends \Magento\Checkout\Block\Cart\AbstractCart
         return $block;
     }
 
+    /**
+     * @param mixed $total
+     * @param int|null $area
+     * @param int $colspan
+     * @return string
+     */
     public function renderTotal($total, $area = null, $colspan = 1)
     {
         $code = $total->getCode();
diff --git a/app/code/Magento/Checkout/Block/Link.php b/app/code/Magento/Checkout/Block/Link.php
index 65df91ad801..817ed06dd7e 100644
--- a/app/code/Magento/Checkout/Block/Link.php
+++ b/app/code/Magento/Checkout/Block/Link.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block;
 
 /**
  * "Checkout" link
  */
-namespace Magento\Checkout\Block;
-
 class Link extends \Magento\View\Element\Html\Link
 {
     /**
diff --git a/app/code/Magento/Checkout/Block/Onepage.php b/app/code/Magento/Checkout/Block/Onepage.php
index b986495dff1..4cfb8c68d87 100644
--- a/app/code/Magento/Checkout/Block/Onepage.php
+++ b/app/code/Magento/Checkout/Block/Onepage.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block;
 
 /**
  * Onepage checkout block
@@ -31,8 +32,6 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block;
-
 class Onepage extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 {
     /**
diff --git a/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php b/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php
index 9958455c25c..3007d30bd18 100644
--- a/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php
+++ b/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php
@@ -23,14 +23,18 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Onepage;
+
+use Magento\Customer\Model\Customer;
+use Magento\Directory\Model\Resource\Country\Collection;
+use Magento\Directory\Model\Resource\Region\Collection as RegionCollection;
+use Magento\Sales\Model\Quote;
 
 /**
  * One page common functionality block
  *
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Onepage;
-
 abstract class AbstractOnepage extends \Magento\View\Element\Template
 {
     /**
@@ -38,10 +42,29 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template
      */
     protected $_configCacheType;
 
+    /**
+     * @var Customer
+     */
     protected $_customer;
+
+    /**
+     * @var Quote
+     */
     protected $_quote;
+
+    /**
+     * @var  Collection
+     */
     protected $_countryCollection;
+
+    /**
+     * @var RegionCollection
+     */
     protected $_regionCollection;
+
+    /**
+     * @var mixed
+     */
     protected $_addressesCollection;
 
     /**
@@ -98,7 +121,7 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template
      * Get config
      *
      * @param string $path
-     * @return mixed
+     * @return string|null
      */
     public function getConfig($path)
     {
@@ -108,7 +131,7 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template
     /**
      * Get logged in customer
      *
-     * @return \Magento\Customer\Model\Customer
+     * @return Customer
      */
     public function getCustomer()
     {
@@ -131,7 +154,7 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template
     /**
      * Retrieve sales quote model
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return Quote
      */
     public function getQuote()
     {
@@ -141,11 +164,17 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template
         return $this->_quote;
     }
 
+    /**
+     * @return bool
+     */
     public function isCustomerLoggedIn()
     {
         return $this->_customerSession->isLoggedIn();
     }
 
+    /**
+     * @return Collection
+     */
     public function getCountryCollection()
     {
         if (!$this->_countryCollection) {
@@ -154,6 +183,9 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template
         return $this->_countryCollection;
     }
 
+    /**
+     * @return RegionCollection
+     */
     public function getRegionCollection()
     {
         if (!$this->_regionCollection) {
@@ -164,11 +196,18 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template
         return $this->_regionCollection;
     }
 
+    /**
+     * @return int
+     */
     public function customerHasAddresses()
     {
         return count($this->getCustomer()->getAddresses());
     }
 
+    /**
+     * @param string $type
+     * @return string
+     */
     public function getAddressesHtmlSelect($type)
     {
         if ($this->isCustomerLoggedIn()) {
@@ -208,6 +247,10 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template
         return '';
     }
 
+    /**
+     * @param string $type
+     * @return string
+     */
     public function getCountryHtmlSelect($type)
     {
         $countryId = $this->getAddress()->getCountryId();
@@ -225,6 +268,10 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template
     }
 
 
+    /**
+     * @param string $type
+     * @return string
+     */
     public function getRegionHtmlSelect($type)
     {
         $select = $this->getLayout()->createBlock('Magento\View\Element\Html\Select')
@@ -238,6 +285,9 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template
         return $select->getHtml();
     }
 
+    /**
+     * @return mixed
+     */
     public function getCountryOptions()
     {
         $options = false;
@@ -256,7 +306,7 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template
     /**
      * Get checkout steps codes
      *
-     * @return array
+     * @return string[]
      */
     protected function _getStepCodes()
     {
diff --git a/app/code/Magento/Checkout/Block/Onepage/Billing.php b/app/code/Magento/Checkout/Block/Onepage/Billing.php
index b0f0f9914da..3ddc970b74b 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Billing.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Billing.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Onepage;
 
 /**
  * One page checkout status
@@ -32,8 +33,6 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Onepage;
-
 class Billing extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 {
     /**
@@ -93,6 +92,8 @@ class Billing extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 
     /**
      * Initialize billing address step
+     *
+     * @return void
      */
     protected function _construct()
     {
@@ -107,6 +108,9 @@ class Billing extends \Magento\Checkout\Block\Onepage\AbstractOnepage
         parent::_construct();
     }
 
+    /**
+     * @return bool
+     */
     public function isUseBillingAddressForShipping()
     {
         if (($this->getQuote()->getIsVirtual())
@@ -193,13 +197,16 @@ class Billing extends \Magento\Checkout\Block\Onepage\AbstractOnepage
     /**
      * Check is Quote items can ship to
      *
-     * @return boolean
+     * @return bool
      */
     public function canShip()
     {
         return !$this->getQuote()->isVirtual();
     }
 
+    /**
+     * @return void
+     */
     public function getSaveUrl()
     {
     }
@@ -228,6 +235,9 @@ class Billing extends \Magento\Checkout\Block\Onepage\AbstractOnepage
         return $this->_getTaxvat()->isEnabled();
     }
 
+    /**
+     * @return string
+     */
     public function getTaxvatHtml()
     {
         return $this->_getTaxvat()
diff --git a/app/code/Magento/Checkout/Block/Onepage/Failure.php b/app/code/Magento/Checkout/Block/Onepage/Failure.php
index 7569ebe8e50..d7fadb13e54 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Failure.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Failure.php
@@ -23,8 +23,6 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
-
 namespace Magento\Checkout\Block\Onepage;
 
 class Failure extends \Magento\View\Element\Template
@@ -49,6 +47,9 @@ class Failure extends \Magento\View\Element\Template
         $this->_isScopePrivate = true;
     }
 
+    /**
+     * @return mixed
+     */
     public function getRealOrderId()
     {
         return $this->_checkoutSession->getLastRealOrderId();
@@ -57,7 +58,7 @@ class Failure extends \Magento\View\Element\Template
     /**
      *  Payment custom error message
      *
-     *  @return	  string
+     *  @return	string
      */
     public function getErrorMessage ()
     {
@@ -68,7 +69,7 @@ class Failure extends \Magento\View\Element\Template
     /**
      * Continue shopping URL
      *
-     *  @return	  string
+     * @return string
      */
     public function getContinueShoppingUrl()
     {
diff --git a/app/code/Magento/Checkout/Block/Onepage/Link.php b/app/code/Magento/Checkout/Block/Onepage/Link.php
index 6481984b0eb..7912977eb8e 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Link.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Link.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Onepage;
 
 /**
  * One page checkout cart link
@@ -31,8 +32,6 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Onepage;
-
 class Link extends \Magento\View\Element\Template
 {
     /**
diff --git a/app/code/Magento/Checkout/Block/Onepage/Login.php b/app/code/Magento/Checkout/Block/Onepage/Login.php
index 59006e91e9b..ae9139947a9 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Login.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Login.php
@@ -23,6 +23,9 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Onepage;
+
+use Magento\Message\Collection;
 
 /**
  * One page checkout status
@@ -32,8 +35,6 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Onepage;
-
 class Login extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 {
     /**
@@ -88,6 +89,9 @@ class Login extends \Magento\Checkout\Block\Onepage\AbstractOnepage
         $this->_isScopePrivate = true;
     }
 
+    /**
+     * @return void
+     */
     protected function _construct()
     {
         if (!$this->isCustomerLoggedIn()) {
@@ -96,31 +100,49 @@ class Login extends \Magento\Checkout\Block\Onepage\AbstractOnepage
         parent::_construct();
     }
 
+    /**
+     * @return Collection
+     */
     public function getMessages()
     {
         return $this->messageManager->getMessages(true);
     }
 
+    /**
+     * @return string
+     */
     public function getPostAction()
     {
         return $this->getUrl('customer/account/loginPost', array('_secure'=>true));
     }
 
+    /**
+     * @return string
+     */
     public function getMethod()
     {
         return $this->getQuote()->getMethod();
     }
 
+    /**
+     * @return mixed
+     */
     public function getMethodData()
     {
         return $this->getCheckout()->getMethodData();
     }
 
+    /**
+     * @return string
+     */
     public function getSuccessUrl()
     {
         return $this->getUrl('*/*');
     }
 
+    /**
+     * @return string
+     */
     public function getErrorUrl()
     {
         return $this->getUrl('*/*');
diff --git a/app/code/Magento/Checkout/Block/Onepage/Payment.php b/app/code/Magento/Checkout/Block/Onepage/Payment.php
index f9f9776a6ad..0a3ee6a831b 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Payment.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Payment.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Onepage;
 
 /**
  * One page checkout status
@@ -32,10 +33,11 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Onepage;
-
 class Payment extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 {
+    /**
+     * @return void
+     */
     protected function _construct()
     {
         $this->getCheckout()->setStepData('payment', array(
@@ -56,12 +58,40 @@ class Payment extends \Magento\Checkout\Block\Onepage\AbstractOnepage
     }
 
     /**
-     * Check whether the quote has recurring items
+     * Get options
      *
-     * @return bool
+     * @return array
      */
-    public function hasRecurringItems()
+    public function getOptions()
     {
-       return $this->getQuote()->hasRecurringItems();
+        $registerParam = $this->getRequest()->getParam('register');
+        return [
+            'quoteBaseGrandTotal' => $this->getQuoteBaseGrandTotal(),
+            'progressUrl' => $this->getUrl('checkout/onepage/progress'),
+            'reviewUrl' => $this->getUrl('checkout/onepage/review'),
+            'failureUrl' => $this->getUrl('checkout/cart'),
+            'getAddressUrl' => $this->getUrl('checkout/onepage/getAddress') . 'address/',
+            'checkout' => [
+                'suggestRegistration' => $registerParam || $registerParam === '',
+                'saveUrl' => $this->getUrl('checkout/onepage/saveMethod'),
+            ],
+            'billing' => [
+                'saveUrl' => $this->getUrl('checkout/onepage/saveBilling'),
+            ],
+            'shipping' => [
+                'saveUrl' => $this->getUrl('checkout/onepage/saveShipping'),
+            ],
+            'shippingMethod' => [
+                'saveUrl' => $this->getUrl('checkout/onepage/saveShippingMethod'),
+            ],
+            'payment' => [
+                'defaultPaymentMethod' => $this->getChildBlock('methods')->getSelectedMethodCode(),
+                'saveUrl' => $this->getUrl('checkout/onepage/savePayment'),
+            ],
+            'review' => [
+                'saveUrl' => $this->getUrl('checkout/onepage/saveOrder'),
+                'successUrl' => $this->getUrl('checkout/onepage/success'),
+            ],
+        ];
     }
 }
diff --git a/app/code/Magento/Checkout/Block/Onepage/Payment/Info.php b/app/code/Magento/Checkout/Block/Onepage/Payment/Info.php
index 5b27f0066d8..6d7b19a430e 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Payment/Info.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Payment/Info.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Onepage\Payment;
 
 /**
  * Checkout payment information data
@@ -31,8 +32,6 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Onepage\Payment;
-
 class Info extends \Magento\Payment\Block\Info\AbstractContainer
 {
     /**
@@ -60,7 +59,7 @@ class Info extends \Magento\Payment\Block\Info\AbstractContainer
     /**
      * Retrieve payment info model
      *
-     * @return \Magento\Payment\Model\Info
+     * @return \Magento\Payment\Model\Info|false
      */
     public function getPaymentInfo()
     {
@@ -71,6 +70,9 @@ class Info extends \Magento\Payment\Block\Info\AbstractContainer
         return false;
     }
 
+    /**
+     * @return string
+     */
     protected function _toHtml()
     {
         $html = '';
diff --git a/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php b/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php
index e76b366ef8b..0137117317d 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php
@@ -59,7 +59,7 @@ class Methods extends \Magento\Payment\Block\Form\Container
     }
 
     /**
-     * @return \Magento\Sales\Model\Quote|\Magento\Sales\Model\Quote
+     * @return \Magento\Sales\Model\Quote
      */
     public function getQuote()
     {
@@ -93,6 +93,7 @@ class Methods extends \Magento\Payment\Block\Form\Container
 
     /**
      * Payment method form html getter
+     *
      * @param \Magento\Payment\Model\Method\AbstractMethod $method
      * @return string
      */
@@ -118,7 +119,9 @@ class Methods extends \Magento\Payment\Block\Form\Container
 
     /**
      * Payment method additional label part getter
+     *
      * @param \Magento\Payment\Model\Method\AbstractMethod $method
+     * @return string
      */
     public function getMethodLabelAfterHtml(\Magento\Payment\Model\Method\AbstractMethod $method)
     {
diff --git a/app/code/Magento/Checkout/Block/Onepage/Progress.php b/app/code/Magento/Checkout/Block/Onepage/Progress.php
index 3bae66bb9eb..8507617bf00 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Progress.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Progress.php
@@ -23,6 +23,9 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Onepage;
+
+use Magento\Sales\Model\Quote\Address;
 
 /**
  * One page checkout status
@@ -31,35 +34,51 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Onepage;
-
 class Progress extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 {
+    /**
+     * @return Address
+     */
     public function getBilling()
     {
         return $this->getQuote()->getBillingAddress();
     }
 
+    /**
+     * @return Address
+     */
     public function getShipping()
     {
         return $this->getQuote()->getShippingAddress();
     }
 
+    /**
+     * @return string
+     */
     public function getShippingMethod()
     {
         return $this->getQuote()->getShippingAddress()->getShippingMethod();
     }
 
+    /**
+     * @return string
+     */
     public function getShippingDescription()
     {
         return $this->getQuote()->getShippingAddress()->getShippingDescription();
     }
 
+    /**
+     * @return float
+     */
     public function getShippingAmount()
     {
         return $this->getQuote()->getShippingAddress()->getShippingAmount();
     }
 
+    /**
+     * @return string
+     */
     public function getPaymentHtml()
     {
         return $this->getChildHtml('payment_info');
@@ -69,8 +88,9 @@ class Progress extends \Magento\Checkout\Block\Onepage\AbstractOnepage
      * Get is step completed. if is set 'toStep' then all steps after him is not completed.
      *
      * @param string $currentStep
-     *  @see: \Magento\Checkout\Block\Onepage\AbstractOnepage::_getStepCodes() for allowed values
      * @return bool
+     *
+     *  @see: \Magento\Checkout\Block\Onepage\AbstractOnepage::_getStepCodes() for allowed values
      */
     public function isStepComplete($currentStep)
     {
@@ -91,6 +111,7 @@ class Progress extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 
     /**
      * Get quote shipping price including tax
+     *
      * @return float
      */
     public function getShippingPriceInclTax()
@@ -99,11 +120,18 @@ class Progress extends \Magento\Checkout\Block\Onepage\AbstractOnepage
         return $this->formatPrice($inclTax);
     }
 
+    /**
+     * @return string
+     */
     public function getShippingPriceExclTax()
     {
         return $this->formatPrice($this->getQuote()->getShippingAddress()->getShippingAmount());
     }
 
+    /**
+     * @param float $price
+     * @return string
+     */
     public function formatPrice($price)
     {
         return $this->getQuote()->getStore()->formatPrice($price);
diff --git a/app/code/Magento/Checkout/Block/Onepage/Review.php b/app/code/Magento/Checkout/Block/Onepage/Review.php
index 10ed4fe26c2..6ab72b00eb9 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Review.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Review.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Onepage;
 
 /**
  * One page checkout status
@@ -32,10 +33,11 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Onepage;
-
 class Review extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 {
+    /**
+     * @return void
+     */
     protected function _construct()
     {
         $this->getCheckout()->setStepData('review', array(
diff --git a/app/code/Magento/Checkout/Block/Onepage/Review/Info.php b/app/code/Magento/Checkout/Block/Onepage/Review/Info.php
index ebbddbe7640..d5ad2eba02a 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Review/Info.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Review/Info.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Onepage\Review;
 
 /**
  * One page checkout order review
  */
-namespace Magento\Checkout\Block\Onepage\Review;
-
 class Info extends \Magento\Sales\Block\Items\AbstractItems
 {
     /**
diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping.php b/app/code/Magento/Checkout/Block/Onepage/Shipping.php
index b0d132d7b32..48e04a2b921 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Shipping.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Shipping.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Onepage;
 
 /**
  * One page checkout status
  */
-namespace Magento\Checkout\Block\Onepage;
-
 class Shipping extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 {
     /**
@@ -81,6 +80,8 @@ class Shipping extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 
     /**
      * Initialize shipping address step
+     *
+     * @return void
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method.php b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method.php
index d25aab88e85..4c506348ba6 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Onepage\Shipping;
 
 /**
  * One page checkout status
@@ -32,8 +33,6 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Onepage\Shipping;
-
 class Method extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 {
     protected function _construct()
diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Additional.php b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Additional.php
index eb1ecb6c417..34d2c2f5ecf 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Additional.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Additional.php
@@ -23,7 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Checkout\Block\Onepage\Shipping\Method;
 
 /**
  * Block for additional information in shipping method
@@ -32,8 +32,6 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Onepage\Shipping\Method;
-
 class Additional extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 {
 
diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php
index bfbd855468a..65dd8b61af2 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php
@@ -23,6 +23,9 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Onepage\Shipping\Method;
+
+use Magento\Sales\Model\Quote\Address;
 
 /**
  * One page checkout status
@@ -32,11 +35,16 @@
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Onepage\Shipping\Method;
-
 class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage
 {
+    /**
+     * @var array
+     */
     protected $_rates;
+
+    /**
+     * @var Address
+     */
     protected $_address;
 
     /**
@@ -82,6 +90,9 @@ class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage
         $this->_isScopePrivate = true;
     }
 
+    /**
+     * @return array
+     */
     public function getShippingRates()
     {
         if (empty($this->_rates)) {
@@ -91,6 +102,9 @@ class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage
         return $this->_rates;
     }
 
+    /**
+     * @return Address
+     */
     public function getAddress()
     {
         if (empty($this->_address)) {
@@ -99,6 +113,10 @@ class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage
         return $this->_address;
     }
 
+    /**
+     * @param string $carrierCode
+     * @return string
+     */
     public function getCarrierName($carrierCode)
     {
         if ($name = $this->_storeConfig->getConfig('carriers/'.$carrierCode.'/title')) {
@@ -107,11 +125,19 @@ class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage
         return $carrierCode;
     }
 
+    /**
+     * @return string
+     */
     public function getAddressShippingMethod()
     {
         return $this->getAddress()->getShippingMethod();
     }
 
+    /**
+     * @param float $price
+     * @param bool|null $flag
+     * @return float
+     */
     public function getShippingPrice($price, $flag)
     {
         return $this->getQuote()->getStore()->convertPrice(
diff --git a/app/code/Magento/Checkout/Block/Onepage/Success.php b/app/code/Magento/Checkout/Block/Onepage/Success.php
index 1b74a6cc030..f847d14eb1b 100644
--- a/app/code/Magento/Checkout/Block/Onepage/Success.php
+++ b/app/code/Magento/Checkout/Block/Onepage/Success.php
@@ -110,7 +110,7 @@ class Success extends \Magento\View\Element\Template
     /**
      * Getter for recurring profile view page
      *
-     * @param $profile
+     * @param \Magento\Object $profile
      * @return string
      */
     public function getProfileUrl(\Magento\Object $profile)
@@ -120,6 +120,8 @@ class Success extends \Magento\View\Element\Template
 
     /**
      * Initialize data and prepare it for output
+     *
+     * @return string
      */
     protected function _beforeToHtml()
     {
@@ -130,6 +132,8 @@ class Success extends \Magento\View\Element\Template
 
     /**
      * Get last order ID from session, fetch it and check whether it can be viewed, printed etc
+     *
+     * @return void
      */
     protected function _prepareLastOrder()
     {
@@ -152,6 +156,8 @@ class Success extends \Magento\View\Element\Template
 
     /**
      * Prepare recurring payment profiles from the session
+     *
+     * @return void
      */
     protected function _prepareLastRecurringProfiles()
     {
diff --git a/app/code/Magento/Checkout/Block/QuoteShortcutButtons.php b/app/code/Magento/Checkout/Block/QuoteShortcutButtons.php
index 44757f0a754..5e11a6902c4 100644
--- a/app/code/Magento/Checkout/Block/QuoteShortcutButtons.php
+++ b/app/code/Magento/Checkout/Block/QuoteShortcutButtons.php
@@ -21,7 +21,6 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Checkout\Block;
 
 use Magento\View\Element\Template;
diff --git a/app/code/Magento/Checkout/Block/Success.php b/app/code/Magento/Checkout/Block/Success.php
index 74561440166..7b3a2465957 100644
--- a/app/code/Magento/Checkout/Block/Success.php
+++ b/app/code/Magento/Checkout/Block/Success.php
@@ -23,7 +23,6 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Checkout\Block;
 
 class Success extends \Magento\View\Element\Template
diff --git a/app/code/Magento/Checkout/Block/Total/DefaultTotal.php b/app/code/Magento/Checkout/Block/Total/DefaultTotal.php
index b25404e12ff..47fca28b2b3 100644
--- a/app/code/Magento/Checkout/Block/Total/DefaultTotal.php
+++ b/app/code/Magento/Checkout/Block/Total/DefaultTotal.php
@@ -23,13 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Checkout\Block\Total;
 
 /**
  * Default Total Row Renderer
  */
-namespace Magento\Checkout\Block\Total;
-
 class DefaultTotal extends \Magento\Checkout\Block\Cart\Totals
 {
     /**
@@ -42,6 +40,9 @@ class DefaultTotal extends \Magento\Checkout\Block\Cart\Totals
      */
     protected $_store;
 
+    /**
+     * @return void
+     */
     protected function _construct()
     {
         parent::_construct();
@@ -59,7 +60,7 @@ class DefaultTotal extends \Magento\Checkout\Block\Cart\Totals
     }
 
     /**
-     * @param $total
+     * @param float $total
      * @return $this
      */
     public function setTotal($total)
diff --git a/app/code/Magento/Checkout/Block/Total/Nominal.php b/app/code/Magento/Checkout/Block/Total/Nominal.php
index 30ff002fdc8..5d870dbd4d2 100644
--- a/app/code/Magento/Checkout/Block/Total/Nominal.php
+++ b/app/code/Magento/Checkout/Block/Total/Nominal.php
@@ -23,14 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Block\Total;
 
 /**
  * Nominal total rendered
  *
  * Each item is rendered as separate total with its details
  */
-namespace Magento\Checkout\Block\Total;
-
 class Nominal extends \Magento\Checkout\Block\Total\DefaultTotal
 {
     /**
diff --git a/app/code/Magento/Checkout/Block/Total/Tax.php b/app/code/Magento/Checkout/Block/Total/Tax.php
index afe6248d24e..7f35041523a 100644
--- a/app/code/Magento/Checkout/Block/Total/Tax.php
+++ b/app/code/Magento/Checkout/Block/Total/Tax.php
@@ -23,16 +23,17 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Checkout\Block\Total;
 
 /**
  * Tax Total Row Renderer
  *
  * @author Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Block\Total;
-
 class Tax extends \Magento\Checkout\Block\Total\DefaultTotal
 {
+    /**
+     * @var string
+     */
     protected $_template = 'total/tax.phtml';
 }
diff --git a/app/code/Magento/Checkout/Controller/Action.php b/app/code/Magento/Checkout/Controller/Action.php
index 5f8f808d314..317b1247bea 100644
--- a/app/code/Magento/Checkout/Controller/Action.php
+++ b/app/code/Magento/Checkout/Controller/Action.php
@@ -18,18 +18,19 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Checkout
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Controller;
 
+use Magento\Customer\Service\V1\CustomerServiceInterface as CustomerService;
+use Magento\Customer\Service\V1\CustomerAccountServiceInterface as CustomerAccountService;
+use Magento\Customer\Service\V1\CustomerMetadataServiceInterface as CustomerMetadataService;
+use Magento\Exception\NoSuchEntityException;
 
 /**
  * Controller for onepage checkouts
  */
-namespace Magento\Checkout\Controller;
-
 abstract class Action extends \Magento\App\Action\Action
 {
     /**
@@ -37,20 +38,45 @@ abstract class Action extends \Magento\App\Action\Action
      */
     protected $_customerSession;
 
+    /**
+     * @var CustomerService
+     */
+    protected $_customerService;
+
+    /**
+     * @var CustomerAccountService
+     */
+    protected $_customerAccountService;
+
+    /**
+     * @var CustomerMetadataService
+     */
+    protected $_customerMetadataService;
+
     /**
      * @param \Magento\App\Action\Context $context
      * @param \Magento\Customer\Model\Session $customerSession
+     * @param CustomerService $customerService
+     * @param CustomerAccountService $customerAccountService
+     * @param CustomerMetadataService $customerMetadataService
      */
     public function __construct(
         \Magento\App\Action\Context $context,
-        \Magento\Customer\Model\Session $customerSession
+        \Magento\Customer\Model\Session $customerSession,
+        CustomerService $customerService,
+        CustomerAccountService $customerAccountService,
+        CustomerMetadataService $customerMetadataService
     ) {
         $this->_customerSession = $customerSession;
+        $this->_customerService = $customerService;
+        $this->_customerAccountService = $customerAccountService;
+        $this->_customerMetadataService = $customerMetadataService;
         parent::__construct($context);
     }
 
     /**
      * Make sure customer is valid, if logged in
+     *
      * By default will add error messages and redirect to customer edit form
      *
      * @param bool $redirect - stop dispatch and redirect?
@@ -59,9 +85,18 @@ abstract class Action extends \Magento\App\Action\Action
      */
     protected function _preDispatchValidateCustomer($redirect = true, $addErrors = true)
     {
-        $customer = $this->_customerSession->getCustomer();
-        if ($customer && $customer->getId()) {
-            $validationResult = $customer->validate();
+        try {
+            $customerId = $this->_customerSession->getCustomerId();
+            $customer = $this->_customerService->getCustomer($customerId);
+        } catch (NoSuchEntityException $e) {
+            return true;
+        }
+
+        if (isset($customer)) {
+            $validationResult = $this->_customerAccountService->validateCustomerData(
+                $customer,
+                $this->_customerMetadataService->getAllCustomerAttributeMetadata()
+            );
             if ((true !== $validationResult) && is_array($validationResult)) {
                 if ($addErrors) {
                     foreach ($validationResult as $error) {
diff --git a/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php b/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php
index b9178463400..b92872289ae 100644
--- a/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php
+++ b/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php
@@ -23,7 +23,6 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Checkout\Controller\Adminhtml;
 
 class Agreement extends \Magento\Backend\App\Action
@@ -31,22 +30,25 @@ class Agreement extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
     }
 
+    /**
+     * @return void
+     */
     public function indexAction()
     {
         $this->_title->add(__('Terms and Conditions'));
@@ -58,11 +60,17 @@ class Agreement extends \Magento\Backend\App\Action
         $this->_view->renderLayout();
     }
 
+    /**
+     * @return void
+     */
     public function newAction()
     {
         $this->_forward('edit');
     }
 
+    /**
+     * @return void
+     */
     public function editAction()
     {
         $this->_title->add(__('Terms and Conditions'));
@@ -101,6 +109,9 @@ class Agreement extends \Magento\Backend\App\Action
         $this->_view->renderLayout();
     }
 
+    /**
+     * @return void
+     */
     public function saveAction()
     {
         $postData = $this->getRequest()->getPost();
@@ -126,6 +137,9 @@ class Agreement extends \Magento\Backend\App\Action
         }
     }
 
+    /**
+     * @return void
+     */
     public function deleteAction()
     {
         $id = (int)$this->getRequest()->getParam('id');
@@ -154,7 +168,7 @@ class Agreement extends \Magento\Backend\App\Action
     /**
      * Initialize action
      *
-     * @return \Magento\Backend\App\Action
+     * @return $this
      */
     protected function _initAction()
     {
@@ -165,6 +179,9 @@ class Agreement extends \Magento\Backend\App\Action
         return $this;
     }
 
+    /**
+     * @return bool
+     */
     protected function _isAllowed()
     {
         return $this->_authorization->isAllowed('Magento_Checkout::checkoutagreement');
diff --git a/app/code/Magento/Checkout/Controller/Cart.php b/app/code/Magento/Checkout/Controller/Cart.php
index 34c043e7c32..a8cb2355b5f 100644
--- a/app/code/Magento/Checkout/Controller/Cart.php
+++ b/app/code/Magento/Checkout/Controller/Cart.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Controller;
 
 /**
  * Shopping cart controller
  */
-namespace Magento\Checkout\Controller;
-
 class Cart
     extends \Magento\App\Action\Action
     implements \Magento\Catalog\Controller\Product\View\ViewInterface
@@ -97,7 +96,7 @@ class Cart
     /**
      * Set back redirect url to response
      *
-     * @return \Magento\Checkout\Controller\Cart
+     * @return $this
      */
     protected function _goBack()
     {
@@ -141,6 +140,8 @@ class Cart
 
     /**
      * Shopping cart display action
+     *
+     * @return void
      */
     public function indexAction()
     {
@@ -194,6 +195,8 @@ class Cart
 
     /**
      * Add product to shopping cart action
+     *
+     * @return void
      */
     public function addAction()
     {
@@ -235,7 +238,7 @@ class Cart
             );
 
             if (!$this->_checkoutSession->getNoCartRedirect(true)) {
-                if (!$cart->getQuote()->getHasError()){
+                if (!$cart->getQuote()->getHasError()) {
                     $message = __('You added %1 to your shopping cart.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getName()));
                     $this->messageManager->addSuccess($message);
                 }
@@ -269,6 +272,9 @@ class Cart
         }
     }
 
+    /**
+     * @return void
+     */
     public function addgroupAction()
     {
         $orderItemIds = $this->getRequest()->getParam('order_items', array());
@@ -302,6 +308,8 @@ class Cart
 
     /**
      * Action to reconfigure cart item
+     *
+     * @return void
      */
     public function configureAction()
     {
@@ -338,6 +346,8 @@ class Cart
 
     /**
      * Update product configuration for a cart item
+     *
+     * @return void
      */
     public function updateItemOptionsAction()
     {
@@ -382,7 +392,7 @@ class Cart
                 array('item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse())
             );
             if (!$this->_checkoutSession->getNoCartRedirect(true)) {
-                if (!$cart->getQuote()->getHasError()){
+                if (!$cart->getQuote()->getHasError()) {
                     $message = __(
                         '%1 was updated in your shopping cart.',
                         $this->_objectManager->get('Magento\Escaper')->escapeHtml($item->getProduct()->getName())
@@ -418,6 +428,8 @@ class Cart
 
     /**
      * Update shopping cart data action
+     *
+     * @return void
      */
     public function updatePostAction()
     {
@@ -444,6 +456,8 @@ class Cart
 
     /**
      * Update customer's shopping cart
+     *
+     * @return void
      */
     protected function _updateShoppingCart()
     {
@@ -459,7 +473,7 @@ class Cart
                     }
                 }
                 $cart = $this->_getCart();
-                if (! $cart->getCustomerSession()->getCustomer()->getId() && $cart->getQuote()->getCustomerId()) {
+                if (!$cart->getCustomerSession()->getCustomerId() && $cart->getQuote()->getCustomerId()) {
                     $cart->getQuote()->setCustomerId(null);
                 }
 
@@ -469,7 +483,9 @@ class Cart
             }
             $this->_checkoutSession->setCartWasUpdated(true);
         } catch (\Magento\Core\Exception $e) {
-            $this->messageManager->addError($this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage()));
+            $this->messageManager->addError(
+                $this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage())
+            );
         } catch (\Exception $e) {
             $this->messageManager->addException($e, __('We cannot update the shopping cart.'));
             $this->_objectManager->get('Magento\Logger')->logException($e);
@@ -478,6 +494,8 @@ class Cart
 
     /**
      * Empty customer's shopping cart
+     *
+     * @return void
      */
     protected function _emptyShoppingCart()
     {
@@ -493,6 +511,8 @@ class Cart
 
     /**
      * Delete shopping cart item action
+     *
+     * @return void
      */
     public function deleteAction()
     {
@@ -512,6 +532,8 @@ class Cart
 
     /**
      * Initialize shipping information
+     *
+     * @return void
      */
     public function estimatePostAction()
     {
@@ -532,6 +554,9 @@ class Cart
         $this->_goBack();
     }
 
+    /**
+     * @return void
+     */
     public function estimateUpdatePostAction()
     {
         $code = (string) $this->getRequest()->getParam('estimate_method');
@@ -543,6 +568,8 @@ class Cart
 
     /**
      * Initialize coupon
+     *
+     * @return void
      */
     public function couponPostAction()
     {
@@ -604,7 +631,7 @@ class Cart
     }
 
     /**
-     * check if URL corresponds store
+     * Check if URL corresponds store
      *
      * @param string $url
      * @return bool
diff --git a/app/code/Magento/Checkout/Controller/Index.php b/app/code/Magento/Checkout/Controller/Index.php
index fce539baa6f..43911e83a92 100644
--- a/app/code/Magento/Checkout/Controller/Index.php
+++ b/app/code/Magento/Checkout/Controller/Index.php
@@ -23,12 +23,14 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Checkout\Controller;
 
 class Index extends \Magento\App\Action\Action
 {
-    function indexAction()
+    /**
+     * @return void
+     */
+    public function indexAction()
     {
         $this->_redirect('checkout/onepage', array('_secure'=>true));
     }
diff --git a/app/code/Magento/Checkout/Controller/Onepage.php b/app/code/Magento/Checkout/Controller/Onepage.php
index 6c9145018c5..bdcf5c7e25f 100644
--- a/app/code/Magento/Checkout/Controller/Onepage.php
+++ b/app/code/Magento/Checkout/Controller/Onepage.php
@@ -23,13 +23,15 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Checkout\Controller;
 
 use Magento\App\Action\NotFoundException;
 use Magento\App\RequestInterface;
+use Magento\Customer\Service\V1\CustomerServiceInterface as CustomerService;
+use Magento\Customer\Service\V1\CustomerAccountServiceInterface as CustomerAccountService;
+use Magento\Customer\Service\V1\CustomerMetadataServiceInterface as CustomerMetadataService;
 
-class Onepage extends \Magento\Checkout\Controller\Action
+class Onepage extends Action
 {
     /**
      * @var array
@@ -48,7 +50,7 @@ class Onepage extends \Magento\Checkout\Controller\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -65,21 +67,33 @@ class Onepage extends \Magento\Checkout\Controller\Action
     /**
      * @param \Magento\App\Action\Context $context
      * @param \Magento\Customer\Model\Session $customerSession
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param CustomerService $customerService
+     * @param CustomerAccountService $customerAccountService
+     * @param CustomerMetadataService $customerMetadataService
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Translate\InlineInterface $translateInline,
      * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator
      */
     public function __construct(
         \Magento\App\Action\Context $context,
         \Magento\Customer\Model\Session $customerSession,
-        \Magento\Core\Model\Registry $coreRegistry,
+        CustomerService $customerService,
+        CustomerAccountService $customerAccountService,
+        CustomerMetadataService $customerMetadataService,
+        \Magento\Registry $coreRegistry,
         \Magento\Translate\InlineInterface $translateInline,
         \Magento\Core\App\Action\FormKeyValidator $formKeyValidator
     ) {
         $this->_coreRegistry = $coreRegistry;
         $this->_translateInline = $translateInline;
         $this->_formKeyValidator = $formKeyValidator;
-        parent::__construct($context, $customerSession);
+        parent::__construct(
+            $context,
+            $customerSession,
+            $customerService,
+            $customerAccountService,
+            $customerMetadataService
+        );
     }
 
     /**
@@ -107,7 +121,7 @@ class Onepage extends \Magento\Checkout\Controller\Action
     }
 
     /**
-     * @return \Magento\Checkout\Controller\Onepage
+     * @return $this
      */
     protected function _ajaxRedirectResponse()
     {
@@ -209,6 +223,8 @@ class Onepage extends \Magento\Checkout\Controller\Action
 
     /**
      * Checkout page
+     *
+     * @return void
      */
     public function indexAction()
     {
@@ -245,6 +261,8 @@ class Onepage extends \Magento\Checkout\Controller\Action
 
     /**
      * Checkout status block
+     *
+     * @return void
      */
     public function progressAction()
     {
@@ -256,6 +274,9 @@ class Onepage extends \Magento\Checkout\Controller\Action
         $this->_view->renderLayout();
     }
 
+    /**
+     * @return void
+     */
     public function shippingMethodAction()
     {
         if ($this->_expireAjax()) {
@@ -266,6 +287,9 @@ class Onepage extends \Magento\Checkout\Controller\Action
         $this->_view->renderLayout();
     }
 
+    /**
+     * @return void
+     */
     public function reviewAction()
     {
         if ($this->_expireAjax()) {
@@ -278,6 +302,8 @@ class Onepage extends \Magento\Checkout\Controller\Action
 
     /**
      * Order success action
+     *
+     * @return void
      */
     public function successAction()
     {
@@ -305,6 +331,9 @@ class Onepage extends \Magento\Checkout\Controller\Action
         $this->_view->renderLayout();
     }
 
+    /**
+     * @return void
+     */
     public function failureAction()
     {
         $lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId();
@@ -320,35 +349,18 @@ class Onepage extends \Magento\Checkout\Controller\Action
     }
 
 
-    public function getAdditionalAction()
-    {
-        $this->getResponse()->setBody($this->_getAdditionalHtml());
-    }
-
     /**
-     * Address JSON
+     * @return void
      */
-    public function getAddressAction()
+    public function getAdditionalAction()
     {
-        if ($this->_expireAjax()) {
-            return;
-        }
-        $addressId = $this->getRequest()->getParam('address', false);
-        if ($addressId) {
-            $address = $this->getOnepage()->getAddress($addressId);
-
-            $customerSession = $this->_objectManager->get('Magento\Customer\Model\Session');
-            if ($customerSession->getCustomer()->getId() == $address->getCustomerId()) {
-                $this->getResponse()->setHeader('Content-type', 'application/x-json');
-                $this->getResponse()->setBody($address->toJson());
-            } else {
-                $this->getResponse()->setHeader('HTTP/1.1', '403 Forbidden');
-            }
-        }
+        $this->getResponse()->setBody($this->_getAdditionalHtml());
     }
 
     /**
      * Save checkout method
+     *
+     * @return void
      */
     public function saveMethodAction()
     {
@@ -363,7 +375,9 @@ class Onepage extends \Magento\Checkout\Controller\Action
     }
 
     /**
-     * save checkout billing address
+     * Save checkout billing address
+     *
+     * @return void
      */
     public function saveBillingAction()
     {
@@ -406,6 +420,8 @@ class Onepage extends \Magento\Checkout\Controller\Action
 
     /**
      * Shipping address save action
+     *
+     * @return void
      */
     public function saveShippingAction()
     {
@@ -430,6 +446,8 @@ class Onepage extends \Magento\Checkout\Controller\Action
 
     /**
      * Shipping method save action
+     *
+     * @return void
      */
     public function saveShippingMethodAction()
     {
@@ -440,7 +458,7 @@ class Onepage extends \Magento\Checkout\Controller\Action
             $data = $this->getRequest()->getPost('shipping_method', '');
             $result = $this->getOnepage()->saveShippingMethod($data);
             // $result will contain error data if shipping method is empty
-            if(!$result) {
+            if (!$result) {
                 $this->_eventManager->dispatch('checkout_controller_onepage_save_shipping_method',
                         array('request'=>$this->getRequest(),
                             'quote'=>$this->getOnepage()->getQuote()));
@@ -462,6 +480,8 @@ class Onepage extends \Magento\Checkout\Controller\Action
      * Save payment ajax action
      *
      * Sets either redirect or a JSON response
+     *
+     * @return void
      */
     public function savePaymentAction()
     {
@@ -546,6 +566,8 @@ class Onepage extends \Magento\Checkout\Controller\Action
 
     /**
      * Create order action
+     *
+     * @return void
      */
     public function saveOrderAction()
     {
diff --git a/app/code/Magento/Checkout/Helper/Cart.php b/app/code/Magento/Checkout/Helper/Cart.php
index a6c511ec723..77c15159d45 100644
--- a/app/code/Magento/Checkout/Helper/Cart.php
+++ b/app/code/Magento/Checkout/Helper/Cart.php
@@ -23,14 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Helper;
 
 /**
  * Shopping cart helper
  *
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Helper;
-
 class Cart extends \Magento\Core\Helper\Url
 {
     const XML_PATH_REDIRECT_TO_CART = 'checkout/cart/redirect_to_cart';
@@ -149,7 +148,7 @@ class Cart extends \Magento\Core\Helper\Url
     /**
      * Retrieve shopping cart url
      *
-     * @return unknown
+     * @return string
      */
     public function getCartUrl()
     {
@@ -179,7 +178,7 @@ class Cart extends \Magento\Core\Helper\Url
     /**
      * Get shopping cart summary qty
      *
-     * @return decimal
+     * @return int|float
      */
     public function getItemsQty()
     {
@@ -187,9 +186,9 @@ class Cart extends \Magento\Core\Helper\Url
     }
 
     /**
-     * Get shopping cart items summary (inchlude config settings)
+     * Get shopping cart items summary (include config settings)
      *
-     * @return decimal
+     * @return int|float
      */
     public function getSummaryCount()
     {
@@ -197,7 +196,7 @@ class Cart extends \Magento\Core\Helper\Url
     }
 
     /**
-     * Check qoute for virtual products only
+     * Check quote for virtual products only
      *
      * @return bool
      */
diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php
index 7b50097ace4..0e95aa6ed78 100644
--- a/app/code/Magento/Checkout/Helper/Data.php
+++ b/app/code/Magento/Checkout/Helper/Data.php
@@ -23,19 +23,24 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Helper;
+
+use Magento\Core\Model\Store;
+use Magento\Sales\Model\Quote\Item\AbstractItem;
 
 /**
  * Checkout default helper
  *
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Helper;
-
 class Data extends \Magento\App\Helper\AbstractHelper
 {
     const XML_PATH_GUEST_CHECKOUT = 'checkout/options/guest_checkout';
     const XML_PATH_CUSTOMER_MUST_BE_LOGGED = 'checkout/options/customer_must_be_logged';
 
+    /**
+     * @var array|null
+     */
     protected $_agreements = null;
 
     /**
@@ -66,9 +71,9 @@ class Data extends \Magento\App\Helper\AbstractHelper
     protected $_agreementCollectionFactory;
 
     /**
-     * @var \Magento\Email\Model\TemplateFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_emailTemplFactory;
+    protected $_transportBuilder;
 
     /**
      * Translator model
@@ -84,7 +89,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
      * @param \Magento\Checkout\Model\Session $checkoutSession
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollectionFactory
-     * @param \Magento\Email\Model\TemplateFactory $emailTemplFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param \Magento\TranslateInterface $translator
      */
     public function __construct(
@@ -94,7 +99,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
         \Magento\Checkout\Model\Session $checkoutSession,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollectionFactory,
-        \Magento\Email\Model\TemplateFactory $emailTemplFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\TranslateInterface $translator
     ) {
         $this->_coreStoreConfig = $coreStoreConfig;
@@ -102,7 +107,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
         $this->_checkoutSession = $checkoutSession;
         $this->_locale = $locale;
         $this->_agreementCollectionFactory = $agreementCollectionFactory;
-        $this->_emailTemplFactory = $emailTemplFactory;
+        $this->_transportBuilder = $transportBuilder;
         $this->_translator = $translator;
         parent::__construct($context);
     }
@@ -127,16 +132,28 @@ class Data extends \Magento\App\Helper\AbstractHelper
         return $this->getCheckout()->getQuote();
     }
 
+    /**
+     * @param float $price
+     * @return string
+     */
     public function formatPrice($price)
     {
         return $this->getQuote()->getStore()->formatPrice($price);
     }
 
+    /**
+     * @param float $price
+     * @param bool $format
+     * @return float
+     */
     public function convertPrice($price, $format=true)
     {
         return $this->getQuote()->getStore()->convertPrice($price, $format);
     }
 
+    /**
+     * @return array
+     */
     public function getRequiredAgreementIds()
     {
         if (is_null($this->_agreements)) {
@@ -194,6 +211,10 @@ class Data extends \Magento\App\Helper\AbstractHelper
         return $item->getRowTotal() + $tax;
     }
 
+    /**
+     * @param AbstractItem $item
+     * @return float
+     */
     public function getBasePriceInclTax($item)
     {
         $qty = ($item->getQty() ? $item->getQty() : ($item->getQtyOrdered() ? $item->getQtyOrdered() : 1));
@@ -202,6 +223,10 @@ class Data extends \Magento\App\Helper\AbstractHelper
         return $this->_storeManager->getStore()->roundPrice($price);
     }
 
+    /**
+     * @param AbstractItem $item
+     * @return float
+     */
     public function getBaseSubtotalInclTax($item)
     {
         $tax = $item->getBaseTaxAmount() + $item->getBaseDiscountTaxCompensation();
@@ -214,23 +239,21 @@ class Data extends \Magento\App\Helper\AbstractHelper
      * @param \Magento\Sales\Model\Quote $checkout
      * @param string $message
      * @param string $checkoutType
-     * @return \Magento\Checkout\Helper\Data
+     * @return $this
      */
     public function sendPaymentFailedEmail($checkout, $message, $checkoutType = 'onepage')
     {
         $this->_translator->setTranslateInline(false);
 
-        /** @var \Magento\Email\Model\Template $mailTemplate */
-        $mailTemplate = $this->_emailTemplFactory->create();
-
         $template = $this->_coreStoreConfig->getConfig('checkout/payment_failed/template', $checkout->getStoreId());
 
         $copyTo = $this->_getEmails('checkout/payment_failed/copy_to', $checkout->getStoreId());
         $copyMethod = $this->_coreStoreConfig->getConfig(
             'checkout/payment_failed/copy_method', $checkout->getStoreId()
         );
+        $bcc = array();
         if ($copyTo && $copyMethod == 'bcc') {
-            $mailTemplate->addBcc($copyTo);
+            $bcc = $copyTo;
         }
 
         $_receiver = $this->_coreStoreConfig->getConfig('checkout/payment_failed/receiver', $checkout->getStoreId());
@@ -268,35 +291,37 @@ class Data extends \Magento\App\Helper\AbstractHelper
         foreach ($checkout->getAllVisibleItems() as $_item) {
             /* @var $_item \Magento\Sales\Model\Quote\Item */
             $items .= $_item->getProduct()->getName() . '  x '. $_item->getQty() . '  '
-                    . $checkout->getStoreCurrencyCode() . ' '
-                    . $_item->getProduct()->getFinalPrice($_item->getQty()) . "\n";
+                . $checkout->getStoreCurrencyCode() . ' '
+                . $_item->getProduct()->getFinalPrice($_item->getQty()) . "\n";
         }
         $total = $checkout->getStoreCurrencyCode() . ' ' . $checkout->getGrandTotal();
 
         foreach ($sendTo as $recipient) {
-            $mailTemplate->setDesignConfig(array(
-                'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
-                'store' => $checkout->getStoreId()
-            ))
-                ->sendTransactional(
-                    $template,
-                    $this->_coreStoreConfig->getConfig('checkout/payment_failed/identity', $checkout->getStoreId()),
-                    $recipient['email'],
-                    $recipient['name'],
-                    array(
-                        'reason' => $message,
-                        'checkoutType' => $checkoutType,
-                        'dateAndTime' => $this->_locale->date(),
-                        'customer' => $checkout->getCustomerFirstname() . ' ' . $checkout->getCustomerLastname(),
-                        'customerEmail' => $checkout->getCustomerEmail(),
-                        'billingAddress' => $checkout->getBillingAddress(),
-                        'shippingAddress' => $checkout->getShippingAddress(),
-                        'shippingMethod' => $this->_coreStoreConfig->getConfig('carriers/'.$shippingMethod.'/title'),
-                        'paymentMethod' => $this->_coreStoreConfig->getConfig('payment/'.$paymentMethod.'/title'),
-                        'items' => nl2br($items),
-                        'total' => $total
-                    )
-                );
+            $transport = $this->_transportBuilder
+                ->setTemplateIdentifier($template)
+                ->setTemplateOptions(array(
+                    'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                    'store' => $checkout->getStoreId()
+                ))
+                ->setTemplateVars(array(
+                    'reason' => $message,
+                    'checkoutType' => $checkoutType,
+                    'dateAndTime' => $this->_locale->date(),
+                    'customer' => $checkout->getCustomerFirstname() . ' ' . $checkout->getCustomerLastname(),
+                    'customerEmail' => $checkout->getCustomerEmail(),
+                    'billingAddress' => $checkout->getBillingAddress(),
+                    'shippingAddress' => $checkout->getShippingAddress(),
+                    'shippingMethod' => $this->_coreStoreConfig->getConfig('carriers/'.$shippingMethod.'/title'),
+                    'paymentMethod' => $this->_coreStoreConfig->getConfig('payment/'.$paymentMethod.'/title'),
+                    'items' => nl2br($items),
+                    'total' => $total
+                ))
+                ->setFrom($this->_coreStoreConfig->getConfig('checkout/payment_failed/identity', $checkout->getStoreId()))
+                ->addTo($recipient['email'], $recipient['name'])
+                ->addBcc($bcc)
+                ->getTransport();
+
+            $transport->sendMessage();
         }
 
         $this->_translator->setTranslateInline(true);
@@ -304,6 +329,11 @@ class Data extends \Magento\App\Helper\AbstractHelper
         return $this;
     }
 
+    /**
+     * @param string $configPath
+     * @param null|string|bool|int|Store $storeId
+     * @return array|false
+     */
     protected function _getEmails($configPath, $storeId)
     {
         $data = $this->_coreStoreConfig->getConfig($configPath, $storeId);
@@ -318,7 +348,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
      * Use config settings and observer
      *
      * @param \Magento\Sales\Model\Quote $quote
-     * @param int|\Magento\Core\Model\Store $store
+     * @param int|Store $store
      * @return bool
      */
     public function isAllowedGuestCheckout(\Magento\Sales\Model\Quote $quote, $store = null)
diff --git a/app/code/Magento/Checkout/Helper/Url.php b/app/code/Magento/Checkout/Helper/Url.php
index 3d53ca4a9b4..18b050db4ba 100644
--- a/app/code/Magento/Checkout/Helper/Url.php
+++ b/app/code/Magento/Checkout/Helper/Url.php
@@ -55,6 +55,8 @@ class Url extends \Magento\Core\Helper\Url
 
     /**
      * One Page (OP) checkout urls
+     *
+     * @return string
      */
     public function getOPCheckoutUrl()
     {
diff --git a/app/code/Magento/Checkout/Model/Agreement.php b/app/code/Magento/Checkout/Model/Agreement.php
index d053f4b50fe..06c7cb32729 100644
--- a/app/code/Magento/Checkout/Model/Agreement.php
+++ b/app/code/Magento/Checkout/Model/Agreement.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Model;
 
 /**
  * @method \Magento\Checkout\Model\Resource\Agreement _getResource()
@@ -44,10 +45,11 @@
  * @package     Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Model;
-
 class Agreement extends \Magento\Core\Model\AbstractModel
 {
+    /**
+     * @return void
+     */
     protected function _construct()
     {
         $this->_init('Magento\Checkout\Model\Resource\Agreement');
diff --git a/app/code/Magento/Checkout/Model/Cart.php b/app/code/Magento/Checkout/Model/Cart.php
index ca76d4068db..09b3eb999d0 100644
--- a/app/code/Magento/Checkout/Model/Cart.php
+++ b/app/code/Magento/Checkout/Model/Cart.php
@@ -23,6 +23,9 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Model;
+
+use Magento\Catalog\Model\Product;
 
 /**
  * Shopping cart model
@@ -31,8 +34,6 @@
  * @package     Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Model;
-
 class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartInterface
 {
     /**
@@ -45,7 +46,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     /**
      * List of product ids in shopping cart
      *
-     * @var array|null
+     * @var int[]|null
      */
     protected $_productIds;
 
@@ -79,7 +80,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     protected $_resourceCart;
 
     /**
-     * @var \Magento\Checkout\Model\Session
+     * @var Session
      */
     protected $_checkoutSession;
 
@@ -99,7 +100,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Checkout\Model\Resource\Cart $resourceCart
-     * @param \Magento\Checkout\Model\Session $checkoutSession
+     * @param Session $checkoutSession
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Message\ManagerInterface $messageManager
      * @param array $data
@@ -110,7 +111,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Checkout\Model\Resource\Cart $resourceCart,
-        \Magento\Checkout\Model\Session $checkoutSession,
+        Session $checkoutSession,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Message\ManagerInterface $messageManager,
         array $data = array()
@@ -139,7 +140,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     /**
      * Retrieve checkout session model
      *
-     * @return \Magento\Checkout\Model\Session
+     * @return Session
      */
     public function getCheckoutSession()
     {
@@ -149,7 +150,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     /**
      * Retrieve customer session model
      *
-     * @return \Magento\Customer\Model\Customer
+     * @return \Magento\Customer\Model\Session
      */
     public function getCustomerSession()
     {
@@ -204,7 +205,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
      * Set quote object associated with the cart
      *
      * @param \Magento\Sales\Model\Quote $quote
-     * @return \Magento\Checkout\Model\Cart
+     * @return $this
      */
     public function setQuote(\Magento\Sales\Model\Quote $quote)
     {
@@ -215,13 +216,13 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     /**
      * Initialize cart quote state to be able use it on cart page
      *
-     * @return \Magento\Checkout\Model\Cart
+     * @return $this
      */
     public function init()
     {
         $quote = $this->getQuote()->setCheckoutMethod('');
 
-        if ($this->_checkoutSession->getCheckoutState() !== \Magento\Checkout\Model\Session::CHECKOUT_STATE_BEGIN) {
+        if ($this->_checkoutSession->getCheckoutState() !== Session::CHECKOUT_STATE_BEGIN) {
             $quote->removeAllAddresses()->removePayment();
             $this->_checkoutSession->resetCheckout();
         }
@@ -238,8 +239,8 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
      * Convert order item to quote item
      *
      * @param \Magento\Sales\Model\Order\Item $orderItem
-     * @param mixed $qtyFlag if is null set product qty like in order
-     * @return \Magento\Checkout\Model\Cart
+     * @param true|null $qtyFlag if is null set product qty like in order
+     * @return $this
      */
     public function addOrderItem($orderItem, $qtyFlag = null)
     {
@@ -268,14 +269,14 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     /**
      * Get product object based on requested product information
      *
-     * @param   mixed $productInfo
-     * @return  \Magento\Catalog\Model\Product
+     * @param   Product|int|string $productInfo
+     * @return  Product
      * @throws \Magento\Core\Exception
      */
     protected function _getProduct($productInfo)
     {
         $product = null;
-        if ($productInfo instanceof \Magento\Catalog\Model\Product) {
+        if ($productInfo instanceof Product) {
             $product = $productInfo;
         } elseif (is_int($productInfo) || is_string($productInfo)) {
             $product = $this->_productFactory->create()
@@ -296,7 +297,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     /**
      * Get request for product add to cart procedure
      *
-     * @param   mixed $requestInfo
+     * @param   \Magento\Object|int|array $requestInfo
      * @return  \Magento\Object
      */
     protected function _getProductRequest($requestInfo)
@@ -319,9 +320,9 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     /**
      * Add product to shopping cart (quote)
      *
-     * @param int|\Magento\Catalog\Model\Product $productInfo
-     * @param mixed $requestInfo
-     * @return \Magento\Checkout\Model\Cart
+     * @param int|Product $productInfo
+     * @param \Magento\Object|int|array $requestInfo
+     * @return $this
      * @throws \Magento\Core\Exception
      */
     public function addProduct($productInfo, $requestInfo = null)
@@ -381,8 +382,8 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     /**
      * Adding products to cart by ids
      *
-     * @param   array $productIds
-     * @return  \Magento\Checkout\Model\Cart
+     * @param  int[] $productIds
+     * @return $this
      */
     public function addProductsByIds($productIds)
     {
@@ -422,7 +423,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
      * Can be used to automatically fix user entered quantities before updating cart
      * so that cart contains valid qty values
      *
-     * $data is an array of ($quoteItemId => (item info array with 'qty' key), ...)
+     * The $data is an array of ($quoteItemId => (item info array with 'qty' key), ...)
      *
      * @param   array $data
      * @return  array
@@ -464,8 +465,8 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     /**
      * Update cart items information
      *
-     * @param   array $data
-     * @return  \Magento\Checkout\Model\Cart
+     * @param  array $data
+     * @return $this
      * @throws \Magento\Core\Exception
      */
     public function updateItems($data)
@@ -517,8 +518,8 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     /**
      * Remove item from cart
      *
-     * @param   int $itemId
-     * @return  \Magento\Checkout\Model\Cart
+     * @param  int $itemId
+     * @return $this
      */
     public function removeItem($itemId)
     {
@@ -529,7 +530,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     /**
      * Save cart
      *
-     * @return \Magento\Checkout\Model\Cart
+     * @return $this
      */
     public function save()
     {
@@ -549,6 +550,8 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
 
     /**
      * Save cart (implement interface method)
+     *
+     * @return void
      */
     public function saveQuote()
     {
@@ -558,7 +561,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     /**
      * Mark all quote items as deleted (empty shopping cart)
      *
-     * @return \Magento\Checkout\Model\Cart
+     * @return $this
      */
     public function truncate()
     {
@@ -567,16 +570,16 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
     }
 
     /**
-     * @return array|null
+     * @return int[]
      */
     public function getProductIds()
     {
         if (null === $this->_productIds) {
             $this->_productIds = array();
             if ($this->getSummaryQty()>0) {
-               foreach ($this->getQuote()->getAllItems() as $item) {
-                   $this->_productIds[] = $item->getProductId();
-               }
+                foreach ($this->getQuote()->getAllItems() as $item) {
+                    $this->_productIds[] = $item->getProductId();
+                }
             }
             $this->_productIds = array_unique($this->_productIds);
         }
@@ -635,13 +638,13 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI
      * $requestInfo - either qty (int) or buyRequest in form of array or \Magento\Object
      * $updatingParams - information on how to perform update, passed to Quote->updateItem() method
      *
-     * @see \Magento\Sales\Model\Quote::updateItem()
-     *
      * @param int $itemId
      * @param int|array|\Magento\Object $requestInfo
      * @param null|array|\Magento\Object $updatingParams
      * @return \Magento\Sales\Model\Quote\Item|string
      * @throws \Magento\Core\Exception
+     *
+     * @see \Magento\Sales\Model\Quote::updateItem()
      */
     public function updateItem($itemId, $requestInfo = null, $updatingParams = null)
     {
diff --git a/app/code/Magento/Checkout/Model/Cart/CartInterface.php b/app/code/Magento/Checkout/Model/Cart/CartInterface.php
index 64e4d3be73c..082bb78a9dd 100644
--- a/app/code/Magento/Checkout/Model/Cart/CartInterface.php
+++ b/app/code/Magento/Checkout/Model/Cart/CartInterface.php
@@ -23,6 +23,9 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Model\Cart;
+
+use Magento\Sales\Model\Quote;
 
 /**
  * Shopping cart interface
@@ -31,41 +34,39 @@
  * @package     Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-
-namespace Magento\Checkout\Model\Cart;
-
 interface CartInterface
 {
     /**
      * Add product to shopping cart (quote)
      *
-     * @param   int|\Magento\Catalog\Model\Product $productInfo
-     * @param   mixed                          $requestInfo
-     * @return  \Magento\Checkout\Model\Cart\CartInterface
+     * @param int|\Magento\Catalog\Model\Product $productInfo
+     * @param array|float|int|\Magento\Object|null $requestInfo
+     * @return $this
      */
     public function addProduct($productInfo, $requestInfo = null);
 
     /**
      * Save cart
      *
+     * @return $this
      * @abstract
-     * @return \Magento\Checkout\Model\Cart\CartInterface
      */
     public function saveQuote();
 
     /**
      * Associate quote with the cart
      *
+     * @param Quote $quote
+     * @return $this
      * @abstract
-     * @param $quote \Magento\Sales\Model\Quote
-     * @return \Magento\Checkout\Model\Cart\CartInterface
      */
-    public function setQuote(\Magento\Sales\Model\Quote $quote);
+    public function setQuote(Quote $quote);
 
     /**
      * Get quote object associated with cart
+     *
+     * @return Quote
      * @abstract
-     * @return \Magento\Sales\Model\Quote
      */
     public function getQuote();
 }
diff --git a/app/code/Magento/Checkout/Model/Config/Source/Cart/Summary.php b/app/code/Magento/Checkout/Model/Config/Source/Cart/Summary.php
index 085c0251900..7e62210bbfb 100644
--- a/app/code/Magento/Checkout/Model/Config/Source/Cart/Summary.php
+++ b/app/code/Magento/Checkout/Model/Config/Source/Cart/Summary.php
@@ -25,8 +25,11 @@
  */
 namespace Magento\Checkout\Model\Config\Source\Cart;
 
-class Summary implements \Magento\Core\Model\Option\ArrayInterface
+class Summary implements \Magento\Option\ArrayInterface
 {
+    /**
+     * @return array
+     */
     public function toOptionArray()
     {
         return array(
diff --git a/app/code/Magento/Checkout/Model/Observer.php b/app/code/Magento/Checkout/Model/Observer.php
index ec120274fab..fd92853fde2 100644
--- a/app/code/Magento/Checkout/Model/Observer.php
+++ b/app/code/Magento/Checkout/Model/Observer.php
@@ -36,7 +36,7 @@ namespace Magento\Checkout\Model;
 class Observer
 {
     /**
-     * @var \Magento\Checkout\Model\Session
+     * @var Session
      */
     protected $_checkoutSession;
 
@@ -46,22 +46,28 @@ class Observer
     protected $messageManager;
 
     /**
-     * @param \Magento\Checkout\Model\Session $checkoutSession
+     * @param Session $checkoutSession
      * @param \Magento\Message\ManagerInterface $messageManager
      */
     public function __construct(
-        \Magento\Checkout\Model\Session $checkoutSession,
+        Session $checkoutSession,
         \Magento\Message\ManagerInterface $messageManager
     ) {
         $this->_checkoutSession = $checkoutSession;
         $this->messageManager = $messageManager;
     }
 
+    /**
+     * @return void
+     */
     public function unsetAll()
     {
         $this->_checkoutSession->clearQuote()->clearStorage();
     }
 
+    /**
+     * @return void
+     */
     public function loadCustomerQuote()
     {
         try {
@@ -73,6 +79,10 @@ class Observer
         }
     }
 
+    /**
+     * @param Observer $observer
+     * @return void
+     */
     public function salesQuoteSaveAfter($observer)
     {
         $quote = $observer->getEvent()->getQuote();
diff --git a/app/code/Magento/Checkout/Model/Resource/Agreement.php b/app/code/Magento/Checkout/Model/Resource/Agreement.php
index bd0132c899a..11b98da5665 100644
--- a/app/code/Magento/Checkout/Model/Resource/Agreement.php
+++ b/app/code/Magento/Checkout/Model/Resource/Agreement.php
@@ -23,7 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Checkout\Model\Resource;
 
 /**
  * Resource Model for Checkout Agreement
@@ -32,8 +32,6 @@
  * @package     Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Model\Resource;
-
 class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb
 {
     /**
@@ -54,6 +52,7 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb
     /**
      * Model initialization
      *
+     * @return void
      */
     protected function _construct()
     {
@@ -64,7 +63,7 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb
      * Method to run before save
      *
      * @param \Magento\Core\Model\AbstractModel $object
-     * @return \Magento\Core\Model\Resource\Db\AbstractDb
+     * @return $this
      */
     protected function _beforeSave(\Magento\Core\Model\AbstractModel $object)
     {
@@ -85,7 +84,7 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb
      * Method to run after save
      *
      * @param \Magento\Core\Model\AbstractModel $object
-     * @return \Magento\Core\Model\Resource\Db\AbstractDb
+     * @return $this
      */
     protected function _afterSave(\Magento\Core\Model\AbstractModel $object)
     {
@@ -106,7 +105,7 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb
      * Method to run after load
      *
      * @param \Magento\Core\Model\AbstractModel $object
-     * @return \Magento\Core\Model\Resource\Db\AbstractDb
+     * @return $this
      */
     protected function _afterLoad(\Magento\Core\Model\AbstractModel $object)
     {
@@ -125,8 +124,8 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb
      * Get load select
      *
      * @param string $field
-     * @param value $value
-     * @param \Magento\Object $object
+     * @param mixed $value
+     * @param \Magento\Core\Model\AbstractModel $object
      * @return \Magento\DB\Select
      */
     protected function _getLoadSelect($field, $value, $object)
diff --git a/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php b/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php
index 7cde4a19346..7bd1eb5b938 100644
--- a/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php
+++ b/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php
@@ -23,7 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Checkout\Model\Resource\Agreement;
 
 /**
  * Resource Model for Agreement Collection
@@ -32,10 +32,11 @@
  * @package     Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Model\Resource\Agreement;
-
 class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection
 {
+    /**
+     * @var array
+     */
     protected $_map = array('fields' => array(
         'agreement_id' => 'main_table.agreement_id',
     ));
@@ -50,6 +51,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl
     /**
      * Initialize resource
      *
+     * @return void
      */
     protected function _construct()
     {
@@ -60,7 +62,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl
      * Filter collection by specified store ids
      *
      * @param int|\Magento\Core\Model\Store $store
-     * @return \Magento\Checkout\Model\Resource\Agreement\Collection
+     * @return $this
      */
     public function addStoreFilter($store)
     {
@@ -98,7 +100,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl
      * Make store filter using admin website or not
      *
      * @param bool $value
-     * @return \Magento\Checkout\Model\Resource\Agreement\Collection
+     * @return $this
      */
     public function setIsStoreFilterWithAdmin($value)
     {
diff --git a/app/code/Magento/Checkout/Model/Resource/Cart.php b/app/code/Magento/Checkout/Model/Resource/Cart.php
index 5e7931a55d0..f8e5bae8fc6 100644
--- a/app/code/Magento/Checkout/Model/Resource/Cart.php
+++ b/app/code/Magento/Checkout/Model/Resource/Cart.php
@@ -23,7 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Checkout\Model\Resource;
 
 /**
  * Resource model for Checkout Cart
@@ -32,13 +32,12 @@
  * @package     Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Model\Resource;
-
 class Cart extends \Magento\Core\Model\Resource\Db\AbstractDb
 {
     /**
      * Model initialization
      *
+     * @return void
      */
     protected function _construct()
     {
@@ -84,7 +83,7 @@ class Cart extends \Magento\Core\Model\Resource\Db\AbstractDb
      *
      * @param \Magento\Catalog\Model\Resource\Product\Collection $collection
      * @param int $quoteId
-     * @return \Magento\Checkout\Model\Resource\Cart
+     * @return $this
      */
     public function addExcludeProductFilter($collection, $quoteId)
     {
diff --git a/app/code/Magento/Checkout/Model/Resource/Setup.php b/app/code/Magento/Checkout/Model/Resource/Setup.php
index 0e42f6edc97..2e355cddc30 100644
--- a/app/code/Magento/Checkout/Model/Resource/Setup.php
+++ b/app/code/Magento/Checkout/Model/Resource/Setup.php
@@ -34,7 +34,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup
 
     /**
      * @param \Magento\Eav\Model\Entity\Setup\Context $context
-     * @param $resourceName
+     * @param string $resourceName
      * @param \Magento\App\CacheInterface $cache
      * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory
      * @param \Magento\Customer\Helper\Address $customerAddress
diff --git a/app/code/Magento/Checkout/Model/Session.php b/app/code/Magento/Checkout/Model/Session.php
index 49a15cc19da..198157fb3b3 100644
--- a/app/code/Magento/Checkout/Model/Session.php
+++ b/app/code/Magento/Checkout/Model/Session.php
@@ -26,6 +26,10 @@
 
 namespace Magento\Checkout\Model;
 
+use Magento\Sales\Model\Quote;
+use Magento\Customer\Service\V1\Dto\Customer as CustomerDto;
+use \Magento\Customer\Service\V1\Dto\CustomerBuilder;
+
 class Session extends \Magento\Session\SessionManager
 {
     /**
@@ -36,17 +40,24 @@ class Session extends \Magento\Session\SessionManager
     /**
      * Quote instance
      *
-     * @var \Magento\Sales\Model\Quote
+     * @var Quote
      */
     protected $_quote;
 
     /**
-     * Customer instance
+     * Customer DTO
      *
-     * @var null|\Magento\Customer\Model\Customer
+     * @var null|CustomerDto
      */
     protected $_customer;
 
+    /**
+     * Customer DTO builder
+     *
+     * @var CustomerBuilder
+     */
+    protected $_customerBuilder;
+
     /**
      * Whether load only active quote
      *
@@ -104,6 +115,7 @@ class Session extends \Magento\Session\SessionManager
      * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
+     * @param CustomerBuilder $customerBuilder
      * @param null $sessionName
      */
     public function __construct(
@@ -119,6 +131,7 @@ class Session extends \Magento\Session\SessionManager
         \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress,
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
+        CustomerBuilder $customerBuilder,
         $sessionName = null
     ) {
         $this->_orderFactory = $orderFactory;
@@ -127,6 +140,7 @@ class Session extends \Magento\Session\SessionManager
         $this->_remoteAddress = $remoteAddress;
         $this->_eventManager = $eventManager;
         $this->_storeManager = $storeManager;
+        $this->_customerBuilder = $customerBuilder;
         parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage);
         $this->start($sessionName);
     }
@@ -134,10 +148,31 @@ class Session extends \Magento\Session\SessionManager
     /**
      * Set customer instance
      *
+     * TODO: Remove after elimination of dependencies from \Magento\Persistent\Model\Observer
+     *
      * @param \Magento\Customer\Model\Customer|null $customer
-     * @return \Magento\Checkout\Model\Session
+     * @return $this
+     * @deprecated Use \Magento\Checkout\Model\Session::setCustomerData() instead
      */
     public function setCustomer($customer)
+    {
+        if ($customer instanceof \Magento\Customer\Model\Customer) {
+            $this->_customerBuilder->populateWithArray($customer->getData());
+            $this->_customerBuilder->setCustomerId($customer->getId());
+            $this->_customer = $this->_customerBuilder->create();
+        } else {
+            $this->_customer = $customer;
+        }
+        return $this;
+    }
+
+    /**
+     * Set customer data.
+     *
+     * @param CustomerDto|null $customer
+     * @return \Magento\Checkout\Model\Session
+     */
+    public function setCustomerData($customer)
     {
         $this->_customer = $customer;
         return $this;
@@ -157,7 +192,7 @@ class Session extends \Magento\Session\SessionManager
      * Set quote to be loaded even if inactive
      *
      * @param bool $load
-     * @return \Magento\Checkout\Model\Session
+     * @return $this
      */
     public function setLoadInactive($load = true)
     {
@@ -168,14 +203,14 @@ class Session extends \Magento\Session\SessionManager
     /**
      * Get checkout quote instance by current session
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return Quote
      */
     public function getQuote()
     {
         $this->_eventManager->dispatch('custom_quote_process', array('checkout_session' => $this));
 
         if ($this->_quote === null) {
-            /** @var $quote \Magento\Sales\Model\Quote */
+            /** @var $quote Quote */
             $quote = $this->_quoteFactory->create()->setStoreId($this->_storeManager->getStore()->getId());
             if ($this->getQuoteId()) {
                 if ($this->_loadInactive) {
@@ -206,8 +241,10 @@ class Session extends \Magento\Session\SessionManager
 
             if (!$this->getQuoteId()) {
                 if ($this->_customerSession->isLoggedIn() || $this->_customer) {
-                    $customer = ($this->_customer) ? $this->_customer : $this->_customerSession->getCustomer();
-                    $quote->loadByCustomer($customer);
+                    $customerId = $this->_customer
+                        ? $this->_customer->getCustomerId()
+                        : $this->_customerSession->getCustomerId();
+                    $quote->loadByCustomer($customerId);
                     $this->setQuoteId($quote->getId());
                 } else {
                     $quote->setIsCheckoutCart(true);
@@ -216,9 +253,10 @@ class Session extends \Magento\Session\SessionManager
             }
 
             if ($this->getQuoteId()) {
-                if ($this->_customerSession->isLoggedIn() || $this->_customer) {
-                    $customer = ($this->_customer) ? $this->_customer : $this->_customerSession->getCustomer();
-                    $quote->setCustomer($customer);
+                if ($this->_customer) {
+                    $quote->setCustomerData($this->_customer);
+                } else if ($this->_customerSession->isLoggedIn()) {
+                    $quote->setCustomerData($this->_customerSession->getCustomerData());
                 }
             }
 
@@ -234,16 +272,26 @@ class Session extends \Magento\Session\SessionManager
         return $this->_quote;
     }
 
+    /**
+     * @return string
+     */
     protected function _getQuoteIdKey()
     {
         return 'quote_id_' . $this->_storeManager->getStore()->getWebsiteId();
     }
 
+    /**
+     * @param int $quoteId
+     * @return void
+     */
     public function setQuoteId($quoteId)
     {
         $this->setData($this->_getQuoteIdKey(), $quoteId);
     }
 
+    /**
+     * @return int
+     */
     public function getQuoteId()
     {
         return $this->getData($this->_getQuoteIdKey());
@@ -252,7 +300,7 @@ class Session extends \Magento\Session\SessionManager
     /**
      * Load data for customer quote and merge with current quote
      *
-     * @return \Magento\Checkout\Model\Session
+     * @return $this
      */
     public function loadCustomerQuote()
     {
@@ -282,7 +330,7 @@ class Session extends \Magento\Session\SessionManager
         } else {
             $this->getQuote()->getBillingAddress();
             $this->getQuote()->getShippingAddress();
-            $this->getQuote()->setCustomer($this->_customerSession->getCustomer())
+            $this->getQuote()->setCustomerData($this->_customerSession->getCustomerData())
                 ->setTotalsCollectedFlag(false)
                 ->collectTotals()
                 ->save();
@@ -290,6 +338,12 @@ class Session extends \Magento\Session\SessionManager
         return $this;
     }
 
+    /**
+     * @param string $step
+     * @param array|string $data
+     * @param bool|string|null $value
+     * @return $this
+     */
     public function setStepData($step, $data, $value=null)
     {
         $steps = $this->getSteps();
@@ -310,6 +364,11 @@ class Session extends \Magento\Session\SessionManager
         return $this;
     }
 
+    /**
+     * @param string|null $step
+     * @param string|null $data
+     * @return array|string|bool
+     */
     public function getStepData($step=null, $data=null)
     {
         $steps = $this->getSteps();
@@ -357,6 +416,8 @@ class Session extends \Magento\Session\SessionManager
 
     /**
      * Clear misc checkout parameters
+     *
+     * @return void
      */
     public function clearHelperData()
     {
@@ -368,12 +429,19 @@ class Session extends \Magento\Session\SessionManager
         ;
     }
 
+    /**
+     * @return $this
+     */
     public function resetCheckout()
     {
         $this->setCheckoutState(self::CHECKOUT_STATE_BEGIN);
         return $this;
     }
 
+    /**
+     * @param Quote $quote
+     * @return $this
+     */
     public function replaceQuote($quote)
     {
         $this->_quote = $quote;
diff --git a/app/code/Magento/Checkout/Model/Type/AbstractType.php b/app/code/Magento/Checkout/Model/Type/AbstractType.php
index 7f73e08c865..e0fe6a35049 100644
--- a/app/code/Magento/Checkout/Model/Type/AbstractType.php
+++ b/app/code/Magento/Checkout/Model/Type/AbstractType.php
@@ -23,16 +23,19 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Checkout\Model\Type;
+
+use Magento\Customer\Service\V1\CustomerAddressServiceInterface;
+use Magento\Sales\Model\Order;
+use Magento\Sales\Model\Quote\Item;
 
 /**
- * Cehckout type abstract class
+ * Checkout type abstract class
  *
  * @category   Magento
  * @package    Magento_Checkout
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Checkout\Model\Type;
-
 abstract class AbstractType extends \Magento\Object
 {
     /**
@@ -50,22 +53,30 @@ abstract class AbstractType extends \Magento\Object
      */
     protected $_orderFactory;
 
+    /**
+     * @var CustomerAddressServiceInterface
+     */
+    protected $_customerAddressService;
+
     /**
      * @param \Magento\Checkout\Model\Session $checkoutSession
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Sales\Model\OrderFactory $orderFactory
+     * @param CustomerAddressServiceInterface $customerAddressService
      * @param array $data
      */
     public function __construct(
         \Magento\Checkout\Model\Session $checkoutSession,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Sales\Model\OrderFactory $orderFactory,
+        CustomerAddressServiceInterface $customerAddressService,
         array $data = array()
     ) {
-        parent::__construct();
+        parent::__construct($data);
         $this->_checkoutSession = $checkoutSession;
         $this->_customerSession = $customerSession;
         $this->_orderFactory = $orderFactory;
+        $this->_customerAddressService = $customerAddressService;
     }
 
     /**
@@ -96,7 +107,7 @@ abstract class AbstractType extends \Magento\Object
     /**
      * Retrieve quote items
      *
-     * @return array
+     * @return Item[]
      */
     public function getQuoteItems()
     {
@@ -104,7 +115,7 @@ abstract class AbstractType extends \Magento\Object
     }
 
     /**
-     * Retrieve customer session vodel
+     * Retrieve customer session model
      *
      * @return \Magento\Customer\Model\Session
      */
@@ -116,29 +127,28 @@ abstract class AbstractType extends \Magento\Object
     /**
      * Retrieve customer object
      *
-     * @return \Magento\Customer\Model\Customer
+     * @return \Magento\Customer\Service\V1\Dto\Customer
      */
     public function getCustomer()
     {
-        return $this->_customerSession->getCustomer();
+        return $this->_customerSession->getCustomerData();
     }
 
     /**
      * Retrieve customer default shipping address
      *
-     * @return \Magento\Customer\Model\Address || false
+     * @return \Magento\Customer\Service\V1\Dto\Address|null
      */
     public function getCustomerDefaultShippingAddress()
     {
         $address = $this->getData('customer_default_shipping_address');
         if (is_null($address)) {
-            $address = $this->getCustomer()->getDefaultShippingAddress();
+            $customerId = $this->getCustomer()->getCustomerId();
+            $address = $this->_customerAddressService->getDefaultShippingAddress($customerId);
             if (!$address) {
-                foreach ($this->getCustomer()->getAddresses() as $address) {
-                    if($address){
-                        break;
-                    }
-                }
+                /** Default shipping address is not available, try to find any customer address */
+                $allAddresses = $this->_customerAddressService->getAddresses($customerId);
+                $address = count($allAddresses) ? reset($allAddresses) : null;
             }
             $this->setData('customer_default_shipping_address', $address);
         }
@@ -148,36 +158,21 @@ abstract class AbstractType extends \Magento\Object
     /**
      * Retrieve customer default billing address
      *
-     * @return \Magento\Customer\Model\Address || false
+     * @return \Magento\Customer\Service\V1\Dto\Address|null
      */
     public function getCustomerDefaultBillingAddress()
     {
         $address = $this->getData('customer_default_billing_address');
         if (is_null($address)) {
-            $address = $this->getCustomer()->getDefaultBillingAddress();
+            $customerId = $this->getCustomer()->getCustomerId();
+            $address = $this->_customerAddressService->getDefaultBillingAddress($customerId);
             if (!$address) {
-                foreach ($this->getCustomer()->getAddresses() as $address) {
-                    if($address){
-                        break;
-                    }
-                }
+                /** Default billing address is not available, try to find any customer address */
+                $allAddresses = $this->_customerAddressService->getAddresses($customerId);
+                $address = count($allAddresses) ? reset($allAddresses) : null;
             }
             $this->setData('customer_default_billing_address', $address);
         }
         return $address;
     }
-
-    protected function _createOrderFromAddress($address)
-    {
-        $order = $this->_orderFactory->create()
-            ->createFromQuoteAddress($address)
-            ->setCustomerId($this->getCustomer()->getId())
-            ->setGlobalCurrencyCode('USD')
-            ->setBaseCurrencyCode('USD')
-            ->setStoreCurrencyCode('USD')
-            ->setOrderCurrencyCode('USD')
-            ->setStoreToBaseRate(1)
-            ->setStoreToOrderRate(1);
-        return $order;
-    }
 }
diff --git a/app/code/Magento/Checkout/Model/Type/Onepage.php b/app/code/Magento/Checkout/Model/Type/Onepage.php
index 492ba824d31..95e9a77dd32 100644
--- a/app/code/Magento/Checkout/Model/Type/Onepage.php
+++ b/app/code/Magento/Checkout/Model/Type/Onepage.php
@@ -29,6 +29,18 @@
  */
 namespace Magento\Checkout\Model\Type;
 
+use Magento\Customer\Service\V1\Dto\CustomerBuilder;
+use Magento\Customer\Service\V1\Dto\AddressBuilder;
+use Magento\Customer\Service\V1\Dto\Address as AddressDto;
+use Magento\Customer\Service\V1\CustomerGroupServiceInterface;
+use Magento\Customer\Model\Metadata\Form;
+use Magento\Customer\Service\V1\Dto\Response\CreateCustomerAccountResponse;
+use Magento\Customer\Service\V1\CustomerAccountServiceInterface;
+use Magento\Exception\NoSuchEntityException;
+use Magento\Customer\Service\V1\CustomerAddressServiceInterface;
+use Magento\Customer\Service\V1\CustomerServiceInterface;
+use Magento\Customer\Service\V1\CustomerMetadataServiceInterface as CustomerMetadata;
+
 class Onepage
 {
     /**
@@ -38,13 +50,6 @@ class Onepage
     const METHOD_REGISTER = 'register';
     const METHOD_CUSTOMER = 'customer';
 
-    /**
-     * Error message of "customer already exists"
-     *
-     * @var string
-     */
-    protected $_customerEmailExistsMessage = '';
-
     /**
      * @var \Magento\Customer\Model\Session
      */
@@ -129,6 +134,29 @@ class Onepage
      */
     protected $messageManager;
 
+    /**
+     * @var CustomerAccountServiceInterface
+     */
+    protected $_accountService;
+
+    /** @var \Magento\Customer\Model\Metadata\FormFactory */
+    protected $_formFactory;
+
+    /** @var CustomerBuilder */
+    protected $_customerBuilder;
+
+    /** @var AddressBuilder */
+    protected $_addressBuilder;
+
+    /** @var \Magento\Math\Random */
+    protected $mathRandom;
+
+    /** @var CustomerServiceInterface */
+    protected $_customerService;
+
+    /** @var CustomerAddressServiceInterface */
+    protected $_customerAddressService;
+
     /**
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Checkout\Helper\Data $helper
@@ -145,6 +173,14 @@ class Onepage
      * @param \Magento\Sales\Model\OrderFactory $orderFactory
      * @param \Magento\Object\Copy $objectCopyService
      * @param \Magento\Message\ManagerInterface $messageManager
+     * @param CustomerAccountServiceInterface $accountService
+     * @param \Magento\Customer\Model\Metadata\FormFactory $formFactory
+     * @param CustomerBuilder $customerBuilder
+     * @param AddressBuilder $addressBuilder
+     * @param \Magento\Math\Random $mathRandom
+     * @param \Magento\Encryption\EncryptorInterface $encryptor
+     * @param CustomerServiceInterface $customerService
+     * @param CustomerAddressServiceInterface $customerAddressService
      */
     public function __construct(
         \Magento\Event\ManagerInterface $eventManager,
@@ -161,12 +197,19 @@ class Onepage
         \Magento\Sales\Model\Service\QuoteFactory $serviceQuoteFactory,
         \Magento\Sales\Model\OrderFactory $orderFactory,
         \Magento\Object\Copy $objectCopyService,
-        \Magento\Message\ManagerInterface $messageManager
+        \Magento\Message\ManagerInterface $messageManager,
+        CustomerAccountServiceInterface $accountService,
+        \Magento\Customer\Model\Metadata\FormFactory $formFactory,
+        CustomerBuilder $customerBuilder,
+        AddressBuilder $addressBuilder,
+        \Magento\Math\Random $mathRandom,
+        \Magento\Encryption\EncryptorInterface $encryptor,
+        CustomerServiceInterface $customerService,
+        CustomerAddressServiceInterface $customerAddressService
     ) {
         $this->_eventManager = $eventManager;
         $this->_customerData = $customerData;
         $this->_helper = $helper;
-        $this->_customerEmailExistsMessage = __('There is already a registered customer using this email address. Please log in using this email address or enter a different email address to register your account.');
         $this->_checkoutSession = $checkoutSession;
         $this->_customerSession = $customerSession;
         $this->_logger = $logger;
@@ -179,6 +222,14 @@ class Onepage
         $this->_orderFactory = $orderFactory;
         $this->_objectCopyService = $objectCopyService;
         $this->messageManager = $messageManager;
+        $this->_accountService = $accountService;
+        $this->_formFactory = $formFactory;
+        $this->_customerBuilder = $customerBuilder;
+        $this->_addressBuilder = $addressBuilder;
+        $this->mathRandom = $mathRandom;
+        $this->_encryptor = $encryptor;
+        $this->_customerService = $customerService;
+        $this->_customerAddressService = $customerAddressService;
     }
 
     /**
@@ -208,7 +259,7 @@ class Onepage
      * Declare checkout quote instance
      *
      * @param \Magento\Sales\Model\Quote $quote
-     * @return \Magento\Checkout\Model\Type\Onepage
+     * @return $this
      */
     public function setQuote(\Magento\Sales\Model\Quote $quote)
     {
@@ -229,7 +280,7 @@ class Onepage
     /**
      * Initialize quote state to be valid for one page checkout
      *
-     * @return \Magento\Checkout\Model\Type\Onepage
+     * @return $this
      */
     public function initCheckout()
     {
@@ -253,7 +304,7 @@ class Onepage
         * want to load the correct customer information by assigning to address
         * instead of just loading from sales/quote_address
         */
-        $customer = $customerSession->getCustomer();
+        $customer = $customerSession->getCustomerData();
         if ($customer) {
             $quote->assignCustomer($customer);
         }
@@ -297,29 +348,13 @@ class Onepage
         return array();
     }
 
-    /**
-     * Get customer address by identifier
-     *
-     * @param   int $addressId
-     * @return  \Magento\Customer\Model\Address
-     */
-    public function getAddress($addressId)
-    {
-        $address = $this->_customrAddrFactory->create()->load((int)$addressId);
-        $address->explodeStreetAddress();
-        if ($address->getRegionId()) {
-            $address->setRegion($address->getRegionId());
-        }
-        return $address;
-    }
-
     /**
      * Save billing address information to quote
      * This method is called by One Page Checkout JS (AJAX) while saving the billing information.
      *
      * @param   array $data
      * @param   int $customerAddressId
-     * @return  \Magento\Checkout\Model\Type\Onepage
+     * @return  array
      */
     public function saveBilling($data, $customerAddressId)
     {
@@ -328,37 +363,43 @@ class Onepage
         }
 
         $address = $this->getQuote()->getBillingAddress();
-        /* @var $addressForm \Magento\Customer\Model\Form */
-        $addressForm = $this->_customerFormFactory->create();
-        $addressForm->setFormCode('customer_address_edit')
-            ->setEntityType('customer_address')
-            ->setIsAjaxRequest($this->_request->isAjax());
+        $addressForm = $this->_formFactory->create(
+            \Magento\Customer\Service\V1\CustomerMetadataServiceInterface::ENTITY_TYPE_ADDRESS,
+            'customer_address_edit',
+            [],
+            Form::IGNORE_INVISIBLE,
+            [],
+            $this->_request->isAjax()
+        );
 
         if (!empty($customerAddressId)) {
-            $customerAddress = $this->_customrAddrFactory->create()->load($customerAddressId);
-            if ($customerAddress->getId()) {
+            try {
+                $customerAddress = $this->_customerAddressService->getAddressById($customerAddressId);
+            } catch (Exception $e) {
+                /** Address does not exist */
+            }
+            if (isset($customerAddress)) {
                 if ($customerAddress->getCustomerId() != $this->getQuote()->getCustomerId()) {
                     return array('error' => 1,
                         'message' => __('The customer address is not valid.')
                     );
                 }
 
-                $address->importCustomerAddress($customerAddress)->setSaveInAddressBook(0);
-                $addressForm->setEntity($address);
-                $addressErrors  = $addressForm->validateData($address->getData());
+                $address->importCustomerAddressData($customerAddress)->setSaveInAddressBook(0);
+                $addressErrors = $addressForm->validateData($address->getData());
                 if ($addressErrors !== true) {
                     return array('error' => 1, 'message' => $addressErrors);
                 }
             }
         } else {
-            $addressForm->setEntity($address);
             // emulate request object
-            $addressData    = $addressForm->extractData($addressForm->prepareRequest($data));
-            $addressErrors  = $addressForm->validateData($addressData);
+            $addressData = $addressForm->extractData($addressForm->prepareRequest($data));
+            $addressErrors = $addressForm->validateData($addressData);
             if ($addressErrors !== true) {
                 return array('error' => 1, 'message' => array_values($addressErrors));
             }
-            $addressForm->compactData($addressData);
+            $addressData = $addressForm->compactData($addressData);
+            $address->addData($addressData);
             //unset billing address attributes which were not shown in form
             foreach ($addressForm->getAttributes() as $attribute) {
                 if (!isset($data[$attribute->getAttributeCode()])) {
@@ -368,6 +409,7 @@ class Onepage
             $address->setCustomerAddressId(null);
             // Additional form data, not fetched by extractData (as it fetches only attributes)
             $address->setSaveInAddressBook(empty($data['save_in_address_book']) ? 0 : 1);
+            $this->getQuote()->setBillingAddress($address);
         }
 
         // validate billing address
@@ -377,17 +419,23 @@ class Onepage
 
         if (true !== ($result = $this->_validateCustomerData($data))) {
             return $result;
+        } else {
+            /** Even though _validateCustomerData should not modify data, it does */
+            $address = $this->getQuote()->getBillingAddress();
         }
 
         if (!$this->getQuote()->getCustomerId() && self::METHOD_REGISTER == $this->getQuote()->getCheckoutMethod()) {
             if ($this->_customerEmailExists($address->getEmail(), $this->_storeManager->getWebsite()->getId())) {
-                return array('error' => 1, 'message' => $this->_customerEmailExistsMessage);
+                return array(
+                    'error' => 1,
+                    'message' => __('There is already a registered customer using this email address. Please log in using this email address or enter a different email address to register your account.')
+                );
             }
         }
 
         if (!$this->getQuote()->isVirtual()) {
             /**
-             * Billing address using otions
+             * Billing address using options
              */
             $usingCase = isset($data['use_for_shipping']) ? (int)$data['use_for_shipping'] : 0;
 
@@ -441,27 +489,30 @@ class Onepage
 
     /**
      * Validate customer data and set some its data for further usage in quote
+     *
      * Will return either true or array with error messages
      *
      * @param array $data
-     * @return true|array
+     * @return bool|array
      */
     protected function _validateCustomerData(array $data)
     {
-        /** @var $customerForm \Magento\Customer\Model\Form */
-        $customerForm = $this->_customerFormFactory->create();
-        $customerForm->setFormCode('checkout_register')
-            ->setIsAjaxRequest($this->_request->isAjax());
-
         $quote = $this->getQuote();
-        if ($quote->getCustomerId()) {
-            $customer = $quote->getCustomer();
-            $customerForm->setEntity($customer);
-            $customerData = $quote->getCustomer()->getData();
-        } else {
-            /* @var $customer \Magento\Customer\Model\Customer */
-            $customer = $this->_customerFactory->create();
-            $customerForm->setEntity($customer);
+        $isCustomerNew = !$quote->getCustomerId();
+        $customer = $quote->getCustomerData();
+        $customerData = $customer->__toArray();
+
+        /** @var Form $customerForm */
+        $customerForm = $this->_formFactory->create(
+            CustomerMetadata::ENTITY_TYPE_CUSTOMER,
+            'checkout_register',
+            $customerData,
+            Form::IGNORE_INVISIBLE,
+            [],
+            $this->_request->isAjax()
+        );
+
+        if ($isCustomerNew) {
             $customerRequest = $customerForm->prepareRequest($data);
             $customerData = $customerForm->extractData($customerRequest);
         }
@@ -474,27 +525,33 @@ class Onepage
             );
         }
 
-        if ($quote->getCustomerId()) {
+        if (!$isCustomerNew) {
             return true;
         }
 
-        $customerForm->compactData($customerData);
+        $this->_customerBuilder->populateWithArray($customerData);
+        $customer = $this->_customerBuilder->create();
 
         if ($quote->getCheckoutMethod() == self::METHOD_REGISTER) {
-            // set customer password
-            $customer->setPassword($customerRequest->getParam('customer_password'));
-            $customer->setConfirmation($customerRequest->getParam('confirm_password'));
+            // We always have $customerRequest here, otherwise we would have been kicked off the function several
+            // lines above
+            if ($customerRequest->getParam('customer_password') != $customerRequest->getParam('confirm_password')) {
+                return array(
+                    'error'   => -1,
+                    'message' => __('Password and password confirmation are not equal.')
+                );
+            }
         } else {
-            // spoof customer password for guest
-            $password = $customer->generatePassword();
-            $customer->setPassword($password);
-            $customer->setConfirmation($password);
             // set NOT LOGGED IN group id explicitly,
             // otherwise copyFieldsetToTarget('customer_account', 'to_quote') will fill it with default group id value
-            $customer->setGroupId(\Magento\Customer\Model\Group::NOT_LOGGED_IN_ID);
+            $this->_customerBuilder->populate($customer);
+            $this->_customerBuilder->setGroupId(CustomerGroupServiceInterface::NOT_LOGGED_IN_ID);
+            $customer = $this->_customerBuilder->create();
         }
 
-        $result = $customer->validate();
+        //validate customer
+        $attributes = $customerForm->getAllowedAttributes();
+        $result = $this->_accountService->validateCustomerData($customer, $attributes);
         if (true !== $result && is_array($result)) {
             return array(
                 'error'   => -1,
@@ -502,16 +559,11 @@ class Onepage
             );
         }
 
-        if ($quote->getCheckoutMethod() == self::METHOD_REGISTER) {
-            // save customer encrypted password in quote
-            $quote->setPasswordHash($customer->encryptPassword($customer->getPassword()));
-        }
-
         // copy customer/guest email to address
         $quote->getBillingAddress()->setEmail($customer->getEmail());
 
         // copy customer data to quote
-        $this->_objectCopyService->copyFieldsetToTarget('customer_account', 'to_quote', $customer, $quote);
+        $this->_objectCopyService->copyFieldsetToTarget('customer_account', 'to_quote', $customer->__toArray(), $quote);
 
         return true;
     }
@@ -521,7 +573,7 @@ class Onepage
      *
      * @param   array $data
      * @param   int $customerAddressId
-     * @return  \Magento\Checkout\Model\Type\Onepage
+     * @return  array
      */
     public function saveShipping($data, $customerAddressId)
     {
@@ -530,41 +582,50 @@ class Onepage
         }
         $address = $this->getQuote()->getShippingAddress();
 
-        /* @var $addressForm \Magento\Customer\Model\Form */
-        $addressForm    = $this->_customerFormFactory->create();
-        $addressForm->setFormCode('customer_address_edit')
-            ->setEntityType('customer_address')
-            ->setIsAjaxRequest($this->_request->isAjax());
+        $addressForm  = $this->_formFactory->create(
+            'customer_address',
+            'customer_address_edit',
+            [],
+            Form::IGNORE_INVISIBLE,
+            [],
+            $this->_request->isAjax()
+        );
 
         if (!empty($customerAddressId)) {
-            $customerAddress = $this->_customrAddrFactory->create()->load($customerAddressId);
-            if ($customerAddress->getId()) {
-                if ($customerAddress->getCustomerId() != $this->getQuote()->getCustomerId()) {
-                    return array('error' => 1,
-                        'message' => __('The customer address is not valid.')
-                    );
-                }
+            $addressData = null;
+            try {
+                $addressData = $this->_customerAddressService->getAddressById($customerAddressId);
+            } catch (NoSuchEntityException $e) {
+                // do nothing if customer is not found by id
+            }
 
-                $address->importCustomerAddress($customerAddress)->setSaveInAddressBook(0);
-                $addressForm->setEntity($address);
-                $addressErrors  = $addressForm->validateData($address->getData());
-                if ($addressErrors !== true) {
-                    return array('error' => 1, 'message' => $addressErrors);
-                }
+            if ($addressData->getCustomerId() != $this->getQuote()->getCustomerId()) {
+                return array('error' => 1,
+                    'message' => __('The customer address is not valid.')
+                );
             }
+
+            $address->importCustomerAddressData($addressData)->setSaveInAddressBook(0);
+            $addressErrors  = $addressForm->validateData($address->getData());
+            if ($addressErrors !== true) {
+                return array('error' => 1, 'message' => $addressErrors);
+            }
+
         } else {
-            $addressForm->setEntity($address);
             // emulate request object
             $addressData    = $addressForm->extractData($addressForm->prepareRequest($data));
             $addressErrors  = $addressForm->validateData($addressData);
             if ($addressErrors !== true) {
                 return array('error' => 1, 'message' => $addressErrors);
             }
-            $addressForm->compactData($addressData);
+            $compactedData = $addressForm->compactData($addressData);
             // unset shipping address attributes which were not shown in form
             foreach ($addressForm->getAttributes() as $attribute) {
-                if (!isset($data[$attribute->getAttributeCode()])) {
-                    $address->setData($attribute->getAttributeCode(), NULL);
+                $attributeCode = $attribute->getAttributeCode();
+                if (!isset($data[$attributeCode])) {
+                    $address->setData($attributeCode, NULL);
+                } else {
+                    $address->setDataUsingMethod($attributeCode, $compactedData[$attributeCode]);
                 }
             }
 
@@ -658,6 +719,7 @@ class Onepage
     /**
      * Validate quote state to be integrated with one page checkout process
      *
+     * @return void
      * @throws \Magento\Core\Exception
      */
     protected function validate()
@@ -678,7 +740,7 @@ class Onepage
     /**
      * Prepare quote for guest checkout order submit
      *
-     * @return \Magento\Checkout\Model\Type\Onepage
+     * @return $this
      */
     protected function _prepareGuestQuote()
     {
@@ -686,14 +748,14 @@ class Onepage
         $quote->setCustomerId(null)
             ->setCustomerEmail($quote->getBillingAddress()->getEmail())
             ->setCustomerIsGuest(true)
-            ->setCustomerGroupId(\Magento\Customer\Model\Group::NOT_LOGGED_IN_ID);
+            ->setCustomerGroupId(\Magento\Customer\Service\V1\CustomerGroupServiceInterface::NOT_LOGGED_IN_ID);
         return $this;
     }
 
     /**
      * Prepare quote for customer registration and customer order submit
      *
-     * @return \Magento\Checkout\Model\Type\Onepage
+     * @return void
      */
     protected function _prepareNewCustomerQuote()
     {
@@ -701,38 +763,57 @@ class Onepage
         $billing    = $quote->getBillingAddress();
         $shipping   = $quote->isVirtual() ? null : $quote->getShippingAddress();
 
-        /** @var $customer \Magento\Customer\Model\Customer */
-        $customer = $quote->getCustomer();
+        $customerData = $quote->getCustomerData();
         // Need to set proper attribute id or future updates will cause data loss.
-        $customer->setData('attribute_set_id', 1);
-        /** @var $customerBilling \Magento\Customer\Model\Address */
-        $customerBilling = $billing->exportCustomerAddress();
-        $customer->addAddress($customerBilling);
-        $billing->setCustomerAddress($customerBilling);
-        $customerBilling->setIsDefaultBilling(true);
-        if ($shipping && !$shipping->getSameAsBilling()) {
-            $customerShipping = $shipping->exportCustomerAddress();
-            $customer->addAddress($customerShipping);
-            $shipping->setCustomerAddress($customerShipping);
-            $customerShipping->setIsDefaultShipping(true);
-        } elseif ($shipping && $shipping->getSameAsBilling()) {
-            $shipping->setCustomerAddress($billing->getCustomerAddress());
-            $customerBilling->setIsDefaultShipping(true);
+        $customerData = $this->_customerBuilder->mergeDtoWithArray(
+            $customerData,
+            [CustomerMetadata::ATTRIBUTE_SET_ID_CUSTOMER => 1]
+        );
+
+        $customerBillingData = $billing->exportCustomerAddressData();
+        $customerBillingData = $this->_addressBuilder->mergeDtoWithArray(
+            $customerBillingData,
+            [AddressDto::KEY_DEFAULT_BILLING => true]
+        );
+
+        if ($shipping) {
+            if( !$shipping->getSameAsBilling()) {
+                $customerShippingData = $shipping->exportCustomerAddressData();
+                $customerShippingData = $this->_addressBuilder->populate($customerShippingData)
+                    ->setDefaultShipping(true)->create();
+                $shipping->setCustomerAddress($customerShippingData);
+                // Add shipping address to quote since customer DTO does not hold address information
+                $quote->addCustomerAddressData($customerShippingData);
+            } else {
+                $shipping->setCustomerAddressData($customerBillingData);
+                $customerBillingData = $this->_addressBuilder->populate($customerBillingData)->setDefaultShipping(true)
+                    ->create();
+            }
         } else {
-            $customerBilling->setIsDefaultShipping(true);
+            $customerBillingData = $this->_addressBuilder->populate($customerBillingData)->setDefaultShipping(true)
+                ->create();
         }
+        $billing->setCustomerAddressData($customerBillingData);
 
-        $this->_objectCopyService->copyFieldsetToTarget('checkout_onepage_quote', 'to_customer', $quote, $customer);
-        $customer->setPassword($customer->decryptPassword($quote->getPasswordHash()));
-        $customer->setPasswordHash($customer->hashPassword($customer->getPassword()));
-        $quote->setCustomer($customer)
-            ->setCustomerId(true);
+        $dataArray = $this->_objectCopyService->getDataFromFieldset(
+            'checkout_onepage_quote',
+            'to_customer',
+            $quote
+        );
+        $customerData = $this->_customerBuilder->mergeDtoWithArray(
+            $customerData,
+            $dataArray
+        );
+        $quote->setCustomerData($customerData)
+            ->setCustomerId(true); // TODO : Eventually need to remove this legacy hack
+        // Add billing address to quote since customer DTO does not hold address information
+        $quote->addCustomerAddressData($customerBillingData);
     }
 
     /**
      * Prepare quote for customer order submit
      *
-     * @return \Magento\Checkout\Model\Type\Onepage
+     * @return void
      */
     protected function _prepareCustomerQuote()
     {
@@ -740,47 +821,52 @@ class Onepage
         $billing    = $quote->getBillingAddress();
         $shipping   = $quote->isVirtual() ? null : $quote->getShippingAddress();
 
-        $customer = $this->getCustomerSession()->getCustomer();
+        $customer = $this->_customerService->getCustomer($this->getCustomerSession()->getCustomerId());
         if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) {
-            $customerBilling = $billing->exportCustomerAddress();
-            $customer->addAddress($customerBilling);
-            $billing->setCustomerAddress($customerBilling);
+            $billingAddress = $billing->exportCustomerAddressData();
+            $billing->setCustomerAddressData($billingAddress);
         }
         if ($shipping && !$shipping->getSameAsBilling() &&
             (!$shipping->getCustomerId() || $shipping->getSaveInAddressBook())) {
-            $customerShipping = $shipping->exportCustomerAddress();
-            $customer->addAddress($customerShipping);
-            $shipping->setCustomerAddress($customerShipping);
+            $shippingAddress = $shipping->exportCustomerAddressData();
+            $shipping->setCustomerAddressData($shippingAddress);
         }
 
-        if (isset($customerBilling) && !$customer->getDefaultBilling()) {
-            $customerBilling->setIsDefaultBilling(true);
+        if (isset($billingAddress)) {
+            if (!$customer->getDefaultBilling() || !$customer->getDefaultShipping()) {
+                $billingAddress = $this->_addressBuilder
+                    ->populate($billingAddress)
+                    ->setDefaultBilling(!$customer->getDefaultBilling())
+                    ->setDefaultShipping(!$customer->getDefaultShipping())
+                    ->create();
+            }
+
+            $quote->addCustomerAddressData($billingAddress);
         }
-        if ($shipping && isset($customerShipping) && !$customer->getDefaultShipping()) {
-            $customerShipping->setIsDefaultShipping(true);
-        } else if (isset($customerBilling) && !$customer->getDefaultShipping()) {
-            $customerBilling->setIsDefaultShipping(true);
+
+        if ($shipping && isset($shippingAddress) && !$customer->getDefaultShipping()) {
+            $shippingAddress = $this->_addressBuilder
+                ->mergeDtoWithArray($shippingAddress, [AddressDto::KEY_DEFAULT_SHIPPING => true]);
+            $quote->addCustomerAddressData($shippingAddress);
         }
-        $quote->setCustomer($customer);
     }
 
     /**
      * Involve new customer to system
      *
-     * @return \Magento\Checkout\Model\Type\Onepage
+     * @param CreateCustomerAccountResponse $createCustomerResponse
+     * @return $this
      */
-    protected function _involveNewCustomer()
+    protected function _involveNewCustomer(CreateCustomerAccountResponse $createCustomerResponse)
     {
-        $customer = $this->getQuote()->getCustomer();
-        if ($customer->isConfirmationRequired()) {
-            $customer->sendNewAccountEmail('confirmation', '', $this->getQuote()->getStoreId());
+        $customer = $this->getQuote()->getCustomerData();
+        if ($createCustomerResponse->getStatus() == CustomerAccountServiceInterface::ACCOUNT_CONFIRMATION) {
             $url = $this->_customerData->getEmailConfirmationUrl($customer->getEmail());
             $this->messageManager->addSuccess(
                 __('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%1">click here</a>.', $url)
             );
         } else {
-            $customer->sendNewAccountEmail('registered', '', $this->getQuote()->getStoreId());
-            $this->getCustomerSession()->loginById($customer->getId());
+            $this->getCustomerSession()->loginById($customer->getCustomerId());
         }
         return $this;
     }
@@ -788,7 +874,7 @@ class Onepage
     /**
      * Create order based on checkout type. Create customer if necessary.
      *
-     * @return \Magento\Checkout\Model\Type\Onepage
+     * @return $this
      */
     public function saveOrder()
     {
@@ -807,12 +893,13 @@ class Onepage
                 break;
         }
 
-        $service = $this->_serviceQuoteFactory->create(array('quote' => $this->getQuote()));
-        $service->submitAll();
+        /** @var \Magento\Sales\Model\Service\Quote $quoteService */
+        $quoteService = $this->_serviceQuoteFactory->create(['quote' => $this->getQuote()]);
+        $quoteService->submitAllWithDto();
 
         if ($isNewCustomer) {
             try {
-                $this->_involveNewCustomer();
+                $this->_involveNewCustomer($quoteService->getCreateCustomerResponse());
             } catch (\Exception $e) {
                 $this->_logger->logException($e);
             }
@@ -822,10 +909,12 @@ class Onepage
             ->setLastSuccessQuoteId($this->getQuote()->getId())
             ->clearHelperData();
 
-        $order = $service->getOrder();
+        $order = $quoteService->getOrder();
         if ($order) {
-            $this->_eventManager->dispatch('checkout_type_onepage_save_order_after',
-                array('order'=>$order, 'quote'=>$this->getQuote()));
+            $this->_eventManager->dispatch(
+                'checkout_type_onepage_save_order_after',
+                ['order' => $order, 'quote' => $this->getQuote()]
+            );
 
             /**
              * a flag to set that there will be redirect to third party after confirmation
@@ -849,21 +938,7 @@ class Onepage
                 ->setLastRealOrderId($order->getIncrementId());
         }
 
-        // add recurring profiles information to the session
-        $profiles = $service->getRecurringPaymentProfiles();
-        if ($profiles) {
-            $ids = array();
-            foreach ($profiles as $profile) {
-                $ids[] = $profile->getId();
-            }
-            $this->_checkoutSession->setLastRecurringProfileIds($ids);
-            // TODO: send recurring profile emails
-        }
-
-        $this->_eventManager->dispatch(
-            'checkout_submit_all_after',
-            array('order' => $order, 'quote' => $this->getQuote(), 'recurring_profiles' => $profiles)
-        );
+        $this->_eventManager->dispatch('checkout_submit_all_after', ['order' => $order, 'quote' => $this->getQuote()]);
 
         return $this;
     }
@@ -877,15 +952,13 @@ class Onepage
      */
     protected function _customerEmailExists($email, $websiteId = null)
     {
-        $customer = $this->_customerFactory->create();
-        if ($websiteId) {
-            $customer->setWebsiteId($websiteId);
-        }
-        $customer->loadByEmail($email);
-        if ($customer->getId()) {
-            return $customer;
+        try {
+            $this->_customerService->getCustomerByEmail($email, $websiteId);
+            return true;
+        } catch (\Exception $e) {
+            /** Customer email does not exist */
+            return false;
         }
-        return false;
     }
 
     /**
diff --git a/app/code/Magento/Checkout/etc/module.xml b/app/code/Magento/Checkout/etc/module.xml
index 939013e0dff..094a5071875 100755
--- a/app/code/Magento/Checkout/etc/module.xml
+++ b/app/code/Magento/Checkout/etc/module.xml
@@ -45,7 +45,6 @@
             <module name="Magento_Weee"/>
             <module name="Magento_Backend"/>
             <module name="Magento_Theme"/>
-            <module name="Magento_Email"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/Checkout/i18n/de_DE.csv b/app/code/Magento/Checkout/i18n/de_DE.csv
index c373fb13cea..d0463af9226 100644
--- a/app/code/Magento/Checkout/i18n/de_DE.csv
+++ b/app/code/Magento/Checkout/i18n/de_DE.csv
@@ -59,7 +59,7 @@
 "Checkout with Multiple Addresses","Checkout mit mutiplen Adressen"
 "City","Stadt"
 "Clear Shopping Cart","Einkaufswagen leeren"
-"Click <a href=""%s"" onclick=""this.target=\'_blank\'"">here to print</a> a copy of your order confirmation.","Klicken sie <a href=""%s"">hier um ihre Bestellbestätigung auszudrucken </a>."
+"Click <a href=""%s"" onclick=""this.target='_blank'"">here to print</a> a copy of your order confirmation.","Klicken sie <a href=""%s"">hier um ihre Bestellbestätigung auszudrucken </a>."
 "Click <a href=""%s"">here</a> to continue shopping.","<a href=""%s"">Hier</a> klicken, um das Einkaufen fortzusetzen."
 "Close","Schließen"
 "Company","Firma"
diff --git a/app/code/Magento/Checkout/i18n/en_US.csv b/app/code/Magento/Checkout/i18n/en_US.csv
index 4eb60d26e01..1ffe458757a 100644
--- a/app/code/Magento/Checkout/i18n/en_US.csv
+++ b/app/code/Magento/Checkout/i18n/en_US.csv
@@ -59,7 +59,7 @@
 "Checkout with Multiple Addresses","Checkout with Multiple Addresses"
 "City","City"
 "Clear Shopping Cart","Clear Shopping Cart"
-"Click <a href=""%s"" onclick=""this.target=\'_blank\'"">here to print</a> a copy of your order confirmation.","Click <a href=""%s"" onclick=""this.target=\'_blank\'"">here to print</a> a copy of your order confirmation."
+"Click <a href=""%s"" onclick=""this.target='_blank'"">here to print</a> a copy of your order confirmation.","Click <a href=""%s"" onclick=""this.target='_blank'"">here to print</a> a copy of your order confirmation."
 "Click <a href=""%s"">here</a> to continue shopping.","Click <a href=""%s"">here</a> to continue shopping."
 "Close","Close"
 "Company","Company"
diff --git a/app/code/Magento/Checkout/i18n/es_ES.csv b/app/code/Magento/Checkout/i18n/es_ES.csv
index 1f9805d506f..03cc4758343 100644
--- a/app/code/Magento/Checkout/i18n/es_ES.csv
+++ b/app/code/Magento/Checkout/i18n/es_ES.csv
@@ -59,7 +59,7 @@
 "Checkout with Multiple Addresses","Pedido con varias direcciones"
 "City","Ciudad"
 "Clear Shopping Cart","Vaciar carro de la compra"
-"Click <a href=""%s"" onclick=""this.target=\'_blank\'"">here to print</a> a copy of your order confirmation.","Pulse <a href=""%s"">aquí para imprimir</a> una copia de la confirmación del pedido."
+"Click <a href=""%s"" onclick=""this.target='_blank'"">here to print</a> a copy of your order confirmation.","Pulse <a href=""%s"">aquí para imprimir</a> una copia de la confirmación del pedido."
 "Click <a href=""%s"">here</a> to continue shopping.","Click <a href=""%s"">aquí</a> para continuar comprando."
 "Close","Cerrar"
 "Company","Compañía"
diff --git a/app/code/Magento/Checkout/i18n/fr_FR.csv b/app/code/Magento/Checkout/i18n/fr_FR.csv
index 706a26d1eae..8556b313143 100644
--- a/app/code/Magento/Checkout/i18n/fr_FR.csv
+++ b/app/code/Magento/Checkout/i18n/fr_FR.csv
@@ -59,7 +59,7 @@
 "Checkout with Multiple Addresses","Paiement avec des adresses multiples"
 "City","Ville"
 "Clear Shopping Cart","Vider le panier"
-"Click <a href=""%s"" onclick=""this.target=\'_blank\'"">here to print</a> a copy of your order confirmation.","Cliquez <a href=""%s"">ici pour imprimer</a> une copie de votre confirmation de commande."
+"Click <a href=""%s"" onclick=""this.target='_blank'"">here to print</a> a copy of your order confirmation.","Cliquez <a href=""%s"">ici pour imprimer</a> une copie de votre confirmation de commande."
 "Click <a href=""%s"">here</a> to continue shopping.","Cliquez <a href=""%s"">ici</a> pour continuer vos achats"
 "Close","Fermer"
 "Company","Société"
diff --git a/app/code/Magento/Checkout/i18n/nl_NL.csv b/app/code/Magento/Checkout/i18n/nl_NL.csv
index 92867e48034..5000657cbb4 100644
--- a/app/code/Magento/Checkout/i18n/nl_NL.csv
+++ b/app/code/Magento/Checkout/i18n/nl_NL.csv
@@ -59,7 +59,7 @@
 "Checkout with Multiple Addresses","Met meerdere adressen uitchecken"
 "City","Stad"
 "Clear Shopping Cart","Maak winkelwagen leeg"
-"Click <a href=""%s"" onclick=""this.target=\'_blank\'"">here to print</a> a copy of your order confirmation.","Klik <a href=""%s"">hier</a> om een kopie van uw bestellingsbevestiging te printen."
+"Click <a href=""%s"" onclick=""this.target='_blank'"">here to print</a> a copy of your order confirmation.","Klik <a href=""%s"">hier</a> om een kopie van uw bestellingsbevestiging te printen."
 "Click <a href=""%s"">here</a> to continue shopping.","Klik <a href=""%s"">here</a> om door te gaan met winkelen."
 "Close","Sluiten"
 "Company","Bedrijf"
diff --git a/app/code/Magento/Checkout/i18n/pt_BR.csv b/app/code/Magento/Checkout/i18n/pt_BR.csv
index 08fda0620db..b772581da66 100644
--- a/app/code/Magento/Checkout/i18n/pt_BR.csv
+++ b/app/code/Magento/Checkout/i18n/pt_BR.csv
@@ -59,7 +59,7 @@
 "Checkout with Multiple Addresses","Encerrar Compra com Vários Endereços"
 "City","Cidade"
 "Clear Shopping Cart","Limpar Carrinho de Compras"
-"Click <a href=""%s"" onclick=""this.target=\'_blank\'"">here to print</a> a copy of your order confirmation.","Clique <a href=""%s"">aqui para imprimir</a> uma cópia da confirmação de seu pedido."
+"Click <a href=""%s"" onclick=""this.target='_blank'"">here to print</a> a copy of your order confirmation.","Clique <a href=""%s"">aqui para imprimir</a> uma cópia da confirmação de seu pedido."
 "Click <a href=""%s"">here</a> to continue shopping.","Clique <a href=""%s"">aqui</a> para continuar as compras."
 "Close","Fechar"
 "Company","Companhia"
diff --git a/app/code/Magento/Checkout/i18n/zh_CN.csv b/app/code/Magento/Checkout/i18n/zh_CN.csv
index 66cecb1b948..8a7e461efe8 100644
--- a/app/code/Magento/Checkout/i18n/zh_CN.csv
+++ b/app/code/Magento/Checkout/i18n/zh_CN.csv
@@ -59,7 +59,7 @@
 "Checkout with Multiple Addresses","按多个地址支付"
 "City","城市"
 "Clear Shopping Cart","清空购物车"
-"Click <a href=""%s"" onclick=""this.target=\'_blank\'"">here to print</a> a copy of your order confirmation.","单击<a href=""%s"">这里来打印</a>您订单确认信息的拷贝。"
+"Click <a href=""%s"" onclick=""this.target='_blank'"">here to print</a> a copy of your order confirmation.","单击<a href=""%s"">这里来打印</a>您订单确认信息的拷贝。"
 "Click <a href=""%s"">here</a> to continue shopping.","单击<a href=""%s"">这里</a>来继续购物。"
 "Close","关闭"
 "Company","公司"
diff --git a/app/code/Magento/Checkout/view/frontend/onepage.phtml b/app/code/Magento/Checkout/view/frontend/onepage.phtml
index 07933cab4a0..de7cbe0c5d8 100644
--- a/app/code/Magento/Checkout/view/frontend/onepage.phtml
+++ b/app/code/Magento/Checkout/view/frontend/onepage.phtml
@@ -22,11 +22,9 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-?>
-<?php
+
 /** @var \Magento\Checkout\Block\Onepage\Payment $_paymentBlock */
 $_paymentBlock = $this->getLayout()->getBlock('checkout.onepage.payment');
-$_registerParam = $this->getRequest()->getParam('register');
 ?>
 <div class="opc wrapper">
     <ol class="opc" id="checkoutSteps">
@@ -57,40 +55,13 @@ $_registerParam = $this->getRequest()->getParam('register');
                         .accordion({
                             activeSelector: '#opc-<?php echo $this->getActiveStep() ?>'
                         })
-                        .opcheckout({
-                            quoteBaseGrandTotal: <?php echo (float)$_paymentBlock->getQuoteBaseGrandTotal() ?>,
-                            hasRecurringItems: <?php echo $_paymentBlock->hasRecurringItems() ? 'true' : 'false' ?>,
-                            progressUrl: '<?php echo $this->getUrl('checkout/onepage/progress') ?>',
-                            reviewUrl: '<?php echo $this->getUrl('checkout/onepage/review') ?>',
-                            failureUrl: '<?php echo $this->getUrl('checkout/cart') ?>',
-                            getAddressUrl: '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/',
+                        .opcheckout($.extend({
                             checkoutAgreements: '#checkout-agreements',
                             checkoutProgressContainer: '#checkout-progress-wrapper',
-                            checkout: {
-                                suggestRegistration: <?php echo ($_registerParam || $_registerParam === '') ? 'true' : 'false' ?>,
-                                saveUrl: '<?php echo $this->getUrl('checkout/onepage/saveMethod') ?>'
-                            },
-                            billing: {
-                                saveUrl: '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>'
-                            },
-                            shipping: {
-                                saveUrl: '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>'
-                            },
-                            shippingMethod: {
-                                saveUrl: "<?php echo $this->getUrl('checkout/onepage/saveShippingMethod') ?>"
-                            },
-                            payment: {
-                                <?php if ($_paymentBlock->getChildBlock('methods')->getSelectedMethodCode()): ?>
-                                    defaultPaymentMethod: "<?php echo $_paymentBlock->getChildBlock('methods')->getSelectedMethodCode() ?>",
-                                <?php endif ?>
-                                saveUrl: '<?php echo $this->getUrl('checkout/onepage/savePayment') ?>'
-                            },
-                            review: {
-                                saveUrl: '<?php echo $this->getUrl('checkout/onepage/saveOrder') ?>',
-                                successUrl: '<?php echo $this->getUrl('checkout/onepage/success') ?>'
+                            methodDescription: '.items'
                             },
-                            methodDescription : '.items'
-                        });
+                            <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($_paymentBlock->getOptions()); ?>
+                        ));
                 });
         })(jQuery);
     </script>
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Block.php b/app/code/Magento/Cms/Block/Adminhtml/Block.php
index f94e46e9b59..fb6ff699ace 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Block.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Block.php
@@ -27,14 +27,9 @@ namespace Magento\Cms\Block\Adminhtml;
 
 /**
  * Adminhtml cms blocks content block
- *
- * @category   Magento
- * @package    Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Block extends \Magento\Backend\Block\Widget\Grid\Container
 {
-
     /**
      * @return void
      */
@@ -46,5 +41,4 @@ class Block extends \Magento\Backend\Block\Widget\Grid\Container
         $this->_addButtonLabel = __('Add New Block');
         parent::_construct();
     }
-
 }
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php
index 7bdf790be55..64462b19af7 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php
@@ -27,28 +27,24 @@ namespace Magento\Cms\Block\Adminhtml\Block;
 
 /**
  * CMS block edit form container
- *
- * @category   Magento
- * @package    Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Edit extends \Magento\Backend\Block\Widget\Form\Container
 {
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php
index a4d9645cbdd..f44ca955302 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php
@@ -27,10 +27,6 @@ namespace Magento\Cms\Block\Adminhtml\Block\Edit;
 
 /**
  * Adminhtml cms block edit form
- *
- * @category   Magento
- * @package    Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Form extends \Magento\Backend\Block\Widget\Form\Generic
 {
@@ -46,7 +42,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig
      * @param \Magento\Core\Model\System\Store $systemStore
@@ -54,7 +50,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig,
         \Magento\Core\Model\System\Store $systemStore,
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php b/app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php
index 1dafdf94b5b..9686c95b1a6 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php
@@ -27,10 +27,6 @@ namespace Magento\Cms\Block\Adminhtml\Block\Widget;
 
 /**
  * CMS block chooser for Wysiwyg CMS widget
- *
- * @category   Magento
- * @package    Magento_Cms
- * @author     Magento Core Team <core@magentocommerce.com>
  */
 class Chooser extends \Magento\Backend\Block\Widget\Grid\Extended
 {
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page.php b/app/code/Magento/Cms/Block/Adminhtml/Page.php
index 2728db98613..7a30d901b06 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Page.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Page.php
@@ -27,10 +27,6 @@ namespace Magento\Cms\Block\Adminhtml;
 
 /**
  * Adminhtml cms pages content block
- *
- * @category   Magento
- * @package    Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Page extends \Magento\Backend\Block\Widget\Grid\Container
 {
@@ -65,5 +61,4 @@ class Page extends \Magento\Backend\Block\Widget\Grid\Container
     {
         return $this->_authorization->isAllowed($resourceId);
     }
-
 }
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit.php
index a82c876df27..76754cb5ae5 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit.php
@@ -37,18 +37,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php
index c356cf8024c..e2a05ee6647 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php
@@ -39,14 +39,14 @@ class Content
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig,
         array $data = array()
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php
index 7ee655dd3a6..31b6b2926b5 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php
@@ -44,7 +44,7 @@ class Design
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Theme\Model\Layout\Source\Layout $pageLayout
      * @param \Magento\View\Design\Theme\LabelFactory $labelFactory
@@ -52,7 +52,7 @@ class Design
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Theme\Model\Layout\Source\Layout $pageLayout,
         \Magento\View\Design\Theme\LabelFactory $labelFactory,
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Main.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Main.php
index 9bc98eb3276..beba824fd26 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Main.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Main.php
@@ -39,14 +39,14 @@ class Main
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\System\Store $systemStore
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\System\Store $systemStore,
         array $data = array()
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tabs.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tabs.php
index 71ec8c9c3a9..dd3faa814e7 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tabs.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tabs.php
@@ -27,12 +27,7 @@ namespace Magento\Cms\Block\Adminhtml\Page\Edit;
 
 /**
  * Admin page left menu
- *
- * @category   Magento
- * @package    Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
-
 class Tabs extends \Magento\Backend\Block\Widget\Tabs
 {
     /**
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php
index 2a31ab9240e..aef61f4ca06 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php
@@ -23,27 +23,27 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Block\Adminhtml\Page\Grid\Renderer;
 
-class Action
-    extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
+class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
 {
     /**
-     * @var \Magento\UrlFactory
+     * @var Action\UrlBuilder
      */
-    protected $_urlFactory;
+    protected $actionUrlBuilder;
 
     /**
      * @param \Magento\Backend\Block\Context $context
-     * @param \Magento\UrlFactory $urlFactory
+     * @param Action\UrlBuilder $actionUrlBuilder
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Context $context,
-        \Magento\UrlFactory $urlFactory,
+        Action\UrlBuilder $actionUrlBuilder,
         array $data = array()
     ) {
-        $this->_urlFactory = $urlFactory;
+        $this->actionUrlBuilder = $actionUrlBuilder;
         parent::__construct($context, $data);
     }
 
@@ -55,14 +55,11 @@ class Action
      */
     public function render(\Magento\Object $row)
     {
-        /** @var \Magento\UrlInterface $urlModel */
-        $urlModel = $this->_urlFactory->create()->setScope($row->getData('_first_store_id'));
-        $href = $urlModel->getUrl(
-            $row->getIdentifier(), array(
-                '_current' => false,
-                '_query' => '___store='.$row->getStoreCode()
-           )
+        $href = $this->actionUrlBuilder->getUrl(
+            $row->getIdentifier(),
+            $row->getData('_first_store_id'),
+            $row->getStoreCode()
         );
-        return '<a href="'.$href.'" target="_blank">'.__('Preview').'</a>';
+        return '<a href="' . $href . '" target="_blank">' . __('Preview') . '</a>';
     }
 }
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action/UrlBuilder.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action/UrlBuilder.php
new file mode 100644
index 00000000000..b6655304f7b
--- /dev/null
+++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action/UrlBuilder.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Cms\Block\Adminhtml\Page\Grid\Renderer\Action;
+
+class UrlBuilder
+{
+    /**
+     * @var \Magento\UrlInterface
+     */
+    protected $frontendUrlBuilder;
+
+    /**
+     * @param \Magento\UrlInterface $frontendUrlBuilder
+     */
+    public function __construct(\Magento\UrlInterface $frontendUrlBuilder)
+    {
+        $this->frontendUrlBuilder = $frontendUrlBuilder;
+    }
+
+    /**
+     * Get action url
+     *
+     * @param string $routePath
+     * @param string $scope
+     * @param string $store
+     * @return string
+     */
+    public function getUrl($routePath, $scope, $store)
+    {
+        $this->frontendUrlBuilder->setScope($scope);
+        $href = $this->frontendUrlBuilder->getUrl(
+            $routePath,
+            array('_current' => false, '_query' => '___store=' . $store)
+        );
+        return $href;
+    }
+}
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php
index f802709948e..4bf140120e7 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php
@@ -24,17 +24,13 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-/**
- * Wysiwyg Images content block
- *
- * @category   Magento
- * @package    Magento_Cms
- * @author     Magento Core Team <core@magentocommerce.com>
- */
 namespace Magento\Cms\Block\Adminhtml\Wysiwyg\Images;
 
 use Magento\View\Element\Template;
 
+/**
+ * Wysiwyg Images content block
+ */
 class Content extends \Magento\Backend\Block\Widget\Container
 {
     /**
diff --git a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php
index c56e1ce519d..a49e34cbc21 100644
--- a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php
+++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php
@@ -37,7 +37,7 @@ class Tree extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -51,13 +51,13 @@ class Tree extends \Magento\Backend\Block\Template
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Cms\Helper\Wysiwyg\Images $cmsWysiwygImages
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Cms\Helper\Wysiwyg\Images $cmsWysiwygImages,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Cms/Block/Block.php b/app/code/Magento/Cms/Block/Block.php
index 93fe847707b..83bf4353e12 100644
--- a/app/code/Magento/Cms/Block/Block.php
+++ b/app/code/Magento/Cms/Block/Block.php
@@ -24,18 +24,11 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\Cms\Block;
 
 /**
  * Cms block content block
- *
- * @category   Magento
- * @package    Magento_Cms
- * @author     Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Cms\Block;
-
-use Magento\View\Element\AbstractBlock;
-
 class Block extends \Magento\View\Element\AbstractBlock
 {
     /**
diff --git a/app/code/Magento/Cms/Block/Page.php b/app/code/Magento/Cms/Block/Page.php
index 848b9ffb076..6bbfca883c2 100644
--- a/app/code/Magento/Cms/Block/Page.php
+++ b/app/code/Magento/Cms/Block/Page.php
@@ -25,14 +25,8 @@
  */
 namespace Magento\Cms\Block;
 
-use Magento\View\Element\AbstractBlock;
-
 /**
  * Cms page content block
- *
- * @category   Magento
- * @package    Magento_Cms
- * @author     Magento Core Team <core@magentocommerce.com>
  */
 class Page extends \Magento\View\Element\AbstractBlock
 {
diff --git a/app/code/Magento/Cms/Block/Widget/Page/Link.php b/app/code/Magento/Cms/Block/Widget/Page/Link.php
index e6917b991f4..fa1ea4663a0 100644
--- a/app/code/Magento/Cms/Block/Widget/Page/Link.php
+++ b/app/code/Magento/Cms/Block/Widget/Page/Link.php
@@ -27,10 +27,6 @@ namespace Magento\Cms\Block\Widget\Page;
 
 /**
  * Widget to display link to CMS page
- *
- * @category   Magento
- * @package    Magento_Cms
- * @author     Magento Core Team <core@magentocommerce.com>
  */
 class Link
     extends \Magento\View\Element\Html\Link
@@ -141,12 +137,12 @@ class Link
     {
         if ($this->getData('anchor_text')) {
             $this->_anchorText = $this->getData('anchor_text');
-        } else if ($this->getTitle()) {
+        } elseif ($this->getTitle()) {
             $this->_anchorText = $this->getTitle();
-        } else if ($this->getData('href')) {
+        } elseif ($this->getData('href')) {
             $this->_anchorText = $this->_resourcePage->setStore($this->_storeManager->getStore())
                 ->getCmsPageTitleByIdentifier($this->getData('href'));
-        } else if ($this->getData('page_id')) {
+        } elseif ($this->getData('page_id')) {
             $this->_anchorText = $this->_resourcePage->getCmsPageTitleById($this->getData('page_id'));
         } else {
             $this->_anchorText = $this->getData('href');
diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Block.php b/app/code/Magento/Cms/Controller/Adminhtml/Block.php
index 0ea283b3f06..8824835382c 100644
--- a/app/code/Magento/Cms/Controller/Adminhtml/Block.php
+++ b/app/code/Magento/Cms/Controller/Adminhtml/Block.php
@@ -37,17 +37,17 @@ class Block extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Page.php b/app/code/Magento/Cms/Controller/Adminhtml/Page.php
index c9717c42791..d0713cd0fbf 100644
--- a/app/code/Magento/Cms/Controller/Adminhtml/Page.php
+++ b/app/code/Magento/Cms/Controller/Adminhtml/Page.php
@@ -37,7 +37,7 @@ class Page extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -48,12 +48,12 @@ class Page extends \Magento\Backend\App\Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Core\Filter\Date $dateFilter
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Core\Filter\Date $dateFilter
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php
index 11e9dd26e95..fa3f1266298 100644
--- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php
+++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php
@@ -37,17 +37,17 @@ class Images extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
@@ -181,7 +181,7 @@ class Images extends \Magento\Backend\App\Action
                 $filePath = $path . '/' . $file;
                 if ($dir->isFile($dir->getRelativePath($filePath))) {
                     $this->getStorage()->deleteFile($filePath);
-                } 
+                }
             }
         } catch (\Exception $e) {
             $result = array('error' => true, 'message' => $e->getMessage());
diff --git a/app/code/Magento/Cms/Model/Block.php b/app/code/Magento/Cms/Model/Block.php
index 1f913973215..96b119da21a 100644
--- a/app/code/Magento/Cms/Model/Block.php
+++ b/app/code/Magento/Cms/Model/Block.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model;
 
 /**
@@ -42,19 +43,18 @@ namespace Magento\Cms\Model;
  * @method \Magento\Cms\Model\Block setUpdateTime(string $value)
  * @method int getIsActive()
  * @method \Magento\Cms\Model\Block setIsActive(int $value)
- *
- * @category    Magento
- * @package     Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Block extends \Magento\Core\Model\AbstractModel
 {
-    const CACHE_TAG     = 'cms_block';
+    /**
+     * CMS block cache tag
+     */
+    const CACHE_TAG = 'cms_block';
 
     /**
      * @var string
      */
-    protected $_cacheTag= 'cms_block';
+    protected $_cacheTag = 'cms_block';
 
     /**
      * Prefix of model events names
diff --git a/app/code/Magento/Cms/Model/Config/Source/Page.php b/app/code/Magento/Cms/Model/Config/Source/Page.php
index 069486f81ba..c50ad55fc55 100644
--- a/app/code/Magento/Cms/Model/Config/Source/Page.php
+++ b/app/code/Magento/Cms/Model/Config/Source/Page.php
@@ -25,10 +25,7 @@
  */
 namespace Magento\Cms\Model\Config\Source;
 
-/**
- * @SuppressWarnings(PHPMD.LongVariable)
- */
-class Page implements \Magento\Core\Model\Option\ArrayInterface
+class Page implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Cms/Model/Config/Source/Wysiwyg/Enabled.php b/app/code/Magento/Cms/Model/Config/Source/Wysiwyg/Enabled.php
index 68941c19d78..2e5d67a2f6d 100644
--- a/app/code/Magento/Cms/Model/Config/Source/Wysiwyg/Enabled.php
+++ b/app/code/Magento/Cms/Model/Config/Source/Wysiwyg/Enabled.php
@@ -23,16 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model\Config\Source\Wysiwyg;
 
 /**
  * Configuration source model for Wysiwyg toggling
- *
- * @category    Magento
- * @package     Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
-class Enabled implements \Magento\Core\Model\Option\ArrayInterface
+class Enabled implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Cms/Model/Observer.php b/app/code/Magento/Cms/Model/Observer.php
index 74cf0cc77ef..b93e9761853 100644
--- a/app/code/Magento/Cms/Model/Observer.php
+++ b/app/code/Magento/Cms/Model/Observer.php
@@ -23,14 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model;
 
 /**
  * CMS Observer model
- *
- * @category   Magento
- * @package    Magento_Cms
- * @author     Magento Core Team <core@magentocommerce.com>
  */
 class Observer
 {
@@ -39,7 +36,7 @@ class Observer
      *
      * @var \Magento\Cms\Helper\Page
      */
-    protected $_cmsPage = null;
+    protected $_cmsPage;
 
     /**
      * Core store config
@@ -91,8 +88,7 @@ class Observer
 
         if ($pageUrl) {
             $redirect->setRedirectUrl($pageUrl);
-        }
-        else {
+        } else {
             $redirect->setRedirect(true)
                 ->setPath('cms/index/noCookies')
                 ->setArguments(array());
diff --git a/app/code/Magento/Cms/Model/Page.php b/app/code/Magento/Cms/Model/Page.php
index 94bb51b6282..4ac0adb57c7 100644
--- a/app/code/Magento/Cms/Model/Page.php
+++ b/app/code/Magento/Cms/Model/Page.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model;
 
 /**
@@ -64,13 +65,12 @@ namespace Magento\Cms\Model;
  * @method \Magento\Cms\Model\Page setCustomThemeFrom(string $value)
  * @method string getCustomThemeTo()
  * @method \Magento\Cms\Model\Page setCustomThemeTo(string $value)
- *
- * @category    Magento
- * @package     Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Page extends \Magento\Core\Model\AbstractModel
 {
+    /**
+     * No route page id
+     */
     const NOROUTE_PAGE_ID = 'no-route';
 
     /**
@@ -110,7 +110,7 @@ class Page extends \Magento\Core\Model\AbstractModel
      * @param string $field
      * @return $this
      */
-    public function load($id, $field=null)
+    public function load($id, $field = null)
     {
         if (is_null($id)) {
             return $this->noRoutePage();
diff --git a/app/code/Magento/Cms/Model/Page/Urlrewrite.php b/app/code/Magento/Cms/Model/Page/Urlrewrite.php
index 3b3715b99f2..ade82bb7f4c 100644
--- a/app/code/Magento/Cms/Model/Page/Urlrewrite.php
+++ b/app/code/Magento/Cms/Model/Page/Urlrewrite.php
@@ -23,9 +23,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model\Page;
 
 /**
+ * Page Url rewrite model
+ *
  * @method \Magento\Cms\Model\Resource\Page\Urlrewrite getResource() getResource()
  * @method int getCmsPageId() getCmsPageId()
  * @method int getUrlRewriteId() getUrlRewriteId()
diff --git a/app/code/Magento/Cms/Model/Resource/Block.php b/app/code/Magento/Cms/Model/Resource/Block.php
index 2cd2e591226..fc22d5abd10 100644
--- a/app/code/Magento/Cms/Model/Resource/Block.php
+++ b/app/code/Magento/Cms/Model/Resource/Block.php
@@ -23,14 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model\Resource;
 
 /**
  * CMS block model
- *
- * @category    Magento
- * @package     Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Block extends \Magento\Core\Model\Resource\Db\AbstractDb
 {
@@ -81,9 +78,7 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb
      */
     protected function _beforeDelete(\Magento\Core\Model\AbstractModel $object)
     {
-        $condition = array(
-            'block_id = ?'     => (int) $object->getId(),
-        );
+        $condition = array('block_id = ?' => (int) $object->getId());
 
         $this->_getWriteAdapter()->delete($this->getTable('cms_block_store'), $condition);
 
@@ -101,7 +96,8 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb
     {
         if (!$this->getIsUniqueBlockToStores($object)) {
             throw new \Magento\Core\Exception(
-                __('A block identifier with the same properties already exists in the selected store.'));
+                __('A block identifier with the same properties already exists in the selected store.')
+            );
         }
 
         if (! $object->getId()) {
@@ -206,10 +202,10 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb
 
             $select->join(
                 array('cbs' => $this->getTable('cms_block_store')),
-                $this->getMainTable().'.block_id = cbs.block_id',
+                $this->getMainTable() . '.block_id = cbs.block_id',
                 array('store_id')
             )->where('is_active = ?', 1)
-            ->where('cbs.store_id in (?) ', $stores)
+            ->where('cbs.store_id in (?)', $stores)
             ->order('store_id DESC')
             ->limit(1);
         }
@@ -265,9 +261,7 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb
             ->from($this->getTable('cms_block_store'), 'store_id')
             ->where('block_id = :block_id');
 
-        $binds = array(
-            ':block_id' => (int) $id
-        );
+        $binds = array(':block_id' => (int) $id);
 
         return $adapter->fetchCol($select, $binds);
     }
diff --git a/app/code/Magento/Cms/Model/Resource/Block/Collection.php b/app/code/Magento/Cms/Model/Resource/Block/Collection.php
index 42b2143558f..871b97c55f7 100644
--- a/app/code/Magento/Cms/Model/Resource/Block/Collection.php
+++ b/app/code/Magento/Cms/Model/Resource/Block/Collection.php
@@ -23,14 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model\Resource\Block;
 
 /**
  * CMS block model
- *
- * @category    Magento
- * @package     Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection
 {
diff --git a/app/code/Magento/Cms/Model/Resource/Block/Grid/Collection.php b/app/code/Magento/Cms/Model/Resource/Block/Grid/Collection.php
index 92d02f087fe..f22e1ec4bcd 100644
--- a/app/code/Magento/Cms/Model/Resource/Block/Grid/Collection.php
+++ b/app/code/Magento/Cms/Model/Resource/Block/Grid/Collection.php
@@ -27,7 +27,6 @@ namespace Magento\Cms\Model\Resource\Block\Grid;
 
 class Collection extends \Magento\Cms\Model\Resource\Block\Collection
 {
-
     /**
      * @return \Magento\Cms\Model\Resource\Block\Grid\Collection
      */
@@ -44,7 +43,7 @@ class Collection extends \Magento\Cms\Model\Resource\Block\Collection
      */
     public function addFieldToFilter($field, $condition = null)
     {
-        if ($field == 'store_id'){
+        if ($field == 'store_id') {
             return $this->addStoreFilter($field);
         }
     }
diff --git a/app/code/Magento/Cms/Model/Resource/Page.php b/app/code/Magento/Cms/Model/Resource/Page.php
index 5935401142f..c9c863dac0d 100644
--- a/app/code/Magento/Cms/Model/Resource/Page.php
+++ b/app/code/Magento/Cms/Model/Resource/Page.php
@@ -23,14 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model\Resource;
 
 /**
  * Cms page mysql resource
- *
- * @category    Magento
- * @package     Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Page extends \Magento\Core\Model\Resource\Db\AbstractDb
 {
@@ -96,9 +93,7 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb
      */
     protected function _beforeDelete(\Magento\Core\Model\AbstractModel $object)
     {
-        $condition = array(
-            'page_id = ?'     => (int) $object->getId(),
-        );
+        $condition = array('page_id = ?' => (int) $object->getId());
 
         $this->_getWriteAdapter()->delete($this->getTable('cms_page_store'), $condition);
 
@@ -309,7 +304,6 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb
      *
      * @param \Magento\Core\Model\AbstractModel $object
      * @return bool
-     * @date Wed Mar 26 18:12:28 EET 2008
      */
     protected function isNumericPageIdentifier(\Magento\Core\Model\AbstractModel $object)
     {
diff --git a/app/code/Magento/Cms/Model/Resource/Page/Collection.php b/app/code/Magento/Cms/Model/Resource/Page/Collection.php
index 8b8d01851d4..66995410633 100644
--- a/app/code/Magento/Cms/Model/Resource/Page/Collection.php
+++ b/app/code/Magento/Cms/Model/Resource/Page/Collection.php
@@ -23,14 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model\Resource\Page;
 
 /**
  * CMS page collection
- *
- * @category    Magento
- * @package     Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection
 {
@@ -215,7 +212,6 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl
     public function getSelectCountSql()
     {
         $countSelect = parent::getSelectCountSql();
-
         $countSelect->reset(\Zend_Db_Select::GROUP);
 
         return $countSelect;
diff --git a/app/code/Magento/Cms/Model/Resource/Page/Service.php b/app/code/Magento/Cms/Model/Resource/Page/Service.php
index 4210142823d..866189525ab 100644
--- a/app/code/Magento/Cms/Model/Resource/Page/Service.php
+++ b/app/code/Magento/Cms/Model/Resource/Page/Service.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model\Resource\Page;
 
 /**
  * Cms page service resource model
- *
- * @author     Magento Core Team <core@magentocommerce.com>
  */
 class Service extends \Magento\Core\Model\Resource\Db\AbstractDb
 {
diff --git a/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php b/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php
index 7aa9e496db6..5cbc82bceea 100644
--- a/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php
+++ b/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model\Resource\Page;
 
 /**
  * Cms page url rewrite resource model
- *
- * @author Magento Core Team <core@magentocommerce.com>
  */
 class Urlrewrite extends \Magento\Core\Model\Resource\Db\AbstractDb
 {
diff --git a/app/code/Magento/Cms/Model/Resource/Setup.php b/app/code/Magento/Cms/Model/Resource/Setup.php
index 865e3b92980..d76fb4d960f 100644
--- a/app/code/Magento/Cms/Model/Resource/Setup.php
+++ b/app/code/Magento/Cms/Model/Resource/Setup.php
@@ -21,6 +21,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model\Resource;
 
 /**
diff --git a/app/code/Magento/Cms/Model/Template/Filter.php b/app/code/Magento/Cms/Model/Template/Filter.php
index 77022f308de..172e576e86f 100644
--- a/app/code/Magento/Cms/Model/Template/Filter.php
+++ b/app/code/Magento/Cms/Model/Template/Filter.php
@@ -23,14 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model\Template;
 
 /**
  * Cms Template Filter Model
- *
- * @category    Magento
- * @package     Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Filter extends \Magento\Email\Model\Template\Filter
 {
@@ -39,7 +36,7 @@ class Filter extends \Magento\Email\Model\Template\Filter
      *
      * @var bool
      */
-    protected $_useSessionInUrl = null;
+    protected $_useSessionInUrl;
 
     /**
      * Setter whether SID is allowed in store directive
diff --git a/app/code/Magento/Cms/Model/Template/FilterProvider.php b/app/code/Magento/Cms/Model/Template/FilterProvider.php
index 0478c226a4e..e002ebe9e51 100644
--- a/app/code/Magento/Cms/Model/Template/FilterProvider.php
+++ b/app/code/Magento/Cms/Model/Template/FilterProvider.php
@@ -25,6 +25,9 @@
  */
 namespace Magento\Cms\Model\Template;
 
+/**
+ * Filter provider model
+ */
 class FilterProvider
 {
     /**
diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Config.php b/app/code/Magento/Cms/Model/Wysiwyg/Config.php
index f0c66bc1492..298dd98f2f9 100644
--- a/app/code/Magento/Cms/Model/Wysiwyg/Config.php
+++ b/app/code/Magento/Cms/Model/Wysiwyg/Config.php
@@ -23,14 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model\Wysiwyg;
 
 /**
  * Wysiwyg Config for Editor HTML Element
- *
- * @category    Magento
- * @package     Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Config extends \Magento\Object
 {
@@ -40,6 +37,10 @@ class Config extends \Magento\Object
     const WYSIWYG_ENABLED = 'enabled';
     const WYSIWYG_HIDDEN = 'hidden';
     const WYSIWYG_DISABLED = 'disabled';
+
+    /**
+     * Wysiwyg image directory
+     */
     const IMAGE_DIRECTORY = 'wysiwyg';
 
     /**
@@ -67,14 +68,14 @@ class Config extends \Magento\Object
      *
      * @var \Magento\Cms\Helper\Data
      */
-    protected $_cmsData = null;
+    protected $_cmsData;
 
     /**
      * Core event manager proxy
      *
      * @var \Magento\Event\ManagerInterface
      */
-    protected $_eventManager = null;
+    protected $_eventManager;
 
     /**
      * Core store config
@@ -148,7 +149,6 @@ class Config extends \Magento\Object
     public function getConfig($data = array())
     {
         $config = new \Magento\Object();
-        $viewUrl = $this->_viewUrl;
 
         $config->setData(array(
             'enabled'                       => $this->isEnabled(),
@@ -160,10 +160,12 @@ class Config extends \Magento\Object
             'translator'                    => $this->_cmsData,
             'encode_directives'             => true,
             'directives_url'                => $this->_backendUrl->getUrl('cms/wysiwyg/directive'),
-            'popup_css'                     =>
-                $viewUrl->getViewFileUrl('mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css'),
-            'content_css'                   =>
-                $viewUrl->getViewFileUrl('mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css'),
+            'popup_css'                     => $this->_viewUrl->getViewFileUrl(
+                'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css'
+            ),
+            'content_css'                   => $this->_viewUrl->getViewFileUrl(
+                'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css'
+            ),
             'width'                         => '100%',
             'plugins'                       => array()
         ));
diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php
index d9cb5fc9172..a90a3907e83 100644
--- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php
+++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php
@@ -340,7 +340,8 @@ class Storage extends \Magento\Object
     {
         if (!preg_match(self::DIRECTORY_NAME_REGEXP, $name)) {
             throw new \Magento\Core\Exception(
-                __('Please correct the folder name. Use only letters, numbers, underscores and dashes.'));
+                __('Please correct the folder name. Use only letters, numbers, underscores and dashes.')
+            );
         }
 
         $relativePath = $this->_directory->getRelativePath($path);
@@ -352,7 +353,8 @@ class Storage extends \Magento\Object
         $relativeNewPath = $this->_directory->getRelativePath($newPath);
         if ($this->_directory->isDirectory($relativeNewPath)) {
             throw new \Magento\Core\Exception(
-                __('We found a directory with the same name. Please try another folder name.'));
+                __('We found a directory with the same name. Please try another folder name.')
+            );
         }
 
         $this->_directory->create($relativeNewPath);
@@ -369,7 +371,7 @@ class Storage extends \Magento\Object
                 'id'            => $this->_cmsWysiwygImages->convertPathToId($newPath)
             );
             return $result;
-        } Catch (\Magento\Filesystem\FilesystemException $e) {
+        } catch (\Magento\Filesystem\FilesystemException $e) {
             throw new \Magento\Core\Exception(__('We cannot create a new directory.'));
         }
     }
@@ -457,7 +459,7 @@ class Storage extends \Magento\Object
         $result = $uploader->save($targetPath);
 
         if (!$result) {
-            throw new \Magento\Core\Exception(__('We cannot upload the file.') );
+            throw new \Magento\Core\Exception(__('We cannot upload the file.'));
         }
 
         // create thumbnail
@@ -509,8 +511,9 @@ class Storage extends \Magento\Object
 
         if (strpos($filePath, $mediaRootDir) === 0) {
             $thumbSuffix = self::THUMBS_DIRECTORY_NAME . substr($filePath, strlen($mediaRootDir));
-            if (!$checkFile || $this->_directory->isExist(
-                    $this->_directory->getRelativePath($mediaRootDir . '/' . $thumbSuffix))) {
+            if (!$checkFile
+                || $this->_directory->isExist($this->_directory->getRelativePath($mediaRootDir . '/' . $thumbSuffix))
+            ) {
                 $thumbSuffix = substr($mediaRootDir, strlen($this->_directory->getAbsolutePath())) . '/' . $thumbSuffix;
                 $randomIndex = '?rand=' . time();
                 return str_replace('\\', '/', $this->_cmsWysiwygImages->getBaseUrl() . $thumbSuffix) . $randomIndex;
@@ -529,7 +532,7 @@ class Storage extends \Magento\Object
      */
     public function resizeFile($source, $keepRation = true)
     {
-       $realPath = $this->_directory->getRelativePath($source);
+        $realPath = $this->_directory->getRelativePath($source);
         if (!$this->_directory->isFile($realPath) || !$this->_directory->isExist($realPath)) {
             return false;
         }
@@ -673,7 +676,6 @@ class Storage extends \Magento\Object
      * Is path under storage root directory
      *
      * @param string $path
-     *
      * @return void
      * @throws \Magento\Core\Exception
      */
@@ -692,7 +694,6 @@ class Storage extends \Magento\Object
      * Sanitize path
      *
      * @param string $path
-     *
      * @return string
      */
     protected function _sanitizePath($path)
@@ -704,7 +705,6 @@ class Storage extends \Magento\Object
      * Get path in root storage dir
      *
      * @param string $path
-     *
      * @return string|bool
      */
     protected function _getRelativePathToRoot($path)
diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php
index 9c2c4940487..b5f2ececef1 100644
--- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php
+++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php
@@ -23,14 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Cms\Model\Wysiwyg\Images\Storage;
 
 /**
  * Wysiwyg Images storage collection
- *
- * @category    Magento
- * @package     Magento_Cms
- * @author      Magento Core Team <core@magentocommerce.com>
  */
 class Collection extends \Magento\Data\Collection\Filesystem
 {
diff --git a/app/code/Magento/Cms/etc/adminhtml/di.xml b/app/code/Magento/Cms/etc/adminhtml/di.xml
new file mode 100644
index 00000000000..d06f53dc259
--- /dev/null
+++ b/app/code/Magento/Cms/etc/adminhtml/di.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+-->
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <type name="Magento\Cms\Block\Adminhtml\Page\Grid\Renderer\Action\UrlBuilder">
+        <arguments>
+            <argument name="frontendUrlBuilder" xsi:type="object">Magento\Url</argument>
+        </arguments>
+    </type>
+</config>
diff --git a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Attribute/NewAttribute/Product/Created.php b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Attribute/NewAttribute/Product/Created.php
index 2e34422e13f..e556b5e6c82 100644
--- a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Attribute/NewAttribute/Product/Created.php
+++ b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Attribute/NewAttribute/Product/Created.php
@@ -43,7 +43,7 @@ class Created extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -67,7 +67,7 @@ class Created extends \Magento\Backend\Block\Widget
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory
      * @param \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
@@ -75,7 +75,7 @@ class Created extends \Magento\Backend\Block\Widget
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory,
         \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_jsonEncoder = $jsonEncoder;
diff --git a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config.php b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config.php
index 0c337a444fd..b97431e8661 100644
--- a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config.php
+++ b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config.php
@@ -51,7 +51,7 @@ class Config
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -70,7 +70,7 @@ class Config
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\ConfigurableProduct\Model\Product\Type\Configurable $configurableType
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -78,7 +78,7 @@ class Config
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\ConfigurableProduct\Model\Product\Type\Configurable $configurableType,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_configurableType = $configurableType;
diff --git a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Matrix.php b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Matrix.php
index ae74ec7ed7f..cae997622f2 100644
--- a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Matrix.php
+++ b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Matrix.php
@@ -37,7 +37,7 @@ class Matrix
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -61,7 +61,7 @@ class Matrix
      * @param \Magento\ConfigurableProduct\Model\Product\Type\Configurable $configurableType
      * @param \Magento\Catalog\Model\Config $config
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -69,7 +69,7 @@ class Matrix
         \Magento\ConfigurableProduct\Model\Product\Type\Configurable $configurableType,
         \Magento\Catalog\Model\Config $config,
         \Magento\Catalog\Model\ProductFactory $productFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_configurableType = $configurableType;
diff --git a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Simple.php b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Simple.php
index 41352766ce7..48434a449c9 100644
--- a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Simple.php
+++ b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Simple.php
@@ -48,7 +48,7 @@ class Simple extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attribute
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig
      * @param \Magento\Catalog\Helper\Data $catalogData
@@ -57,7 +57,7 @@ class Simple extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attribute
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig,
         \Magento\Catalog\Helper\Data $catalogData,
diff --git a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Settings.php b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Settings.php
index 03561b09eae..52639be1734 100644
--- a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Settings.php
+++ b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Settings.php
@@ -46,7 +46,7 @@ class Settings extends Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\ConfigurableProduct\Model\Product\Type\Configurable $configurableType
      * @param \Magento\Core\Helper\Data $coreHelper
@@ -54,7 +54,7 @@ class Settings extends Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\ConfigurableProduct\Model\Product\Type\Configurable $configurableType,
         \Magento\Core\Helper\Data $coreHelper,
diff --git a/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php
index 9b386555257..38055b25ec3 100644
--- a/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php
+++ b/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php
@@ -21,7 +21,6 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\ConfigurableProduct\Block\Cart\Item\Renderer;
 
 use Magento\Catalog\Model\Config\Source\Product\Thumbnail as ThumbnailSource;
diff --git a/app/code/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSet.php b/app/code/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSet.php
index 37a1e7b8c40..15c762d84d0 100644
--- a/app/code/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSet.php
+++ b/app/code/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSet.php
@@ -34,7 +34,7 @@ class ColumnSet
     /**
      * Registry instance
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registryManager;
 
@@ -51,7 +51,7 @@ class ColumnSet
      * @param \Magento\Backend\Model\Widget\Grid\SubTotals $subtotals
      * @param \Magento\Backend\Model\Widget\Grid\Totals $totals
      * @param \Magento\ConfigurableProduct\Model\Product\Type\Configurable $productType
-     * @param \Magento\Core\Model\Registry $registryManager
+     * @param \Magento\Registry $registryManager
      * @param array $data
      */
     public function __construct(
@@ -60,7 +60,7 @@ class ColumnSet
         \Magento\Backend\Model\Widget\Grid\SubTotals $subtotals,
         \Magento\Backend\Model\Widget\Grid\Totals $totals,
         \Magento\ConfigurableProduct\Model\Product\Type\Configurable $productType,
-        \Magento\Core\Model\Registry $registryManager,
+        \Magento\Registry $registryManager,
         array $data = array()
     ) {
         parent::__construct($context, $generatorFactory, $subtotals, $totals, $data);
diff --git a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php
index 31ce1c9ed55..ebaf66a7cd7 100644
--- a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php
+++ b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php
@@ -76,7 +76,7 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -98,7 +98,7 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/ConfigurableProduct/Model/Entity/Product/Attribute/Group/AttributeMapper/Plugin.php b/app/code/Magento/ConfigurableProduct/Model/Entity/Product/Attribute/Group/AttributeMapper/Plugin.php
index f4d632357aa..4974db606b0 100644
--- a/app/code/Magento/ConfigurableProduct/Model/Entity/Product/Attribute/Group/AttributeMapper/Plugin.php
+++ b/app/code/Magento/ConfigurableProduct/Model/Entity/Product/Attribute/Group/AttributeMapper/Plugin.php
@@ -26,7 +26,7 @@
 namespace Magento\ConfigurableProduct\Model\Entity\Product\Attribute\Group\AttributeMapper;
 
 use Magento\Code\Plugin\InvocationChain;
-use Magento\Core\Model\Registry;
+use Magento\Registry;
 use Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\AttributeFactory;
 
 class Plugin
@@ -37,7 +37,7 @@ class Plugin
     protected $attributeFactory;
 
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $registry;
 
@@ -76,4 +76,4 @@ class Plugin
         $result['is_configurable'] = (int)in_array($attribute->getAttributeId(), $this->configurableAttributes[$setId]);
         return $result;
     }
-} 
+}
diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php
index 4d7dd5c6967..b6c82447bbe 100644
--- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php
+++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php
@@ -168,7 +168,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType
      * @param \Magento\Core\Helper\Data $coreData
      * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb
      * @param \Magento\App\Filesystem $filesystem
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Logger $logger
      * @param \Magento\ConfigurableProduct\Model\Resource\Product\Type\ConfigurableFactory $typeConfigurableFactory
      * @param \Magento\Eav\Model\EntityFactory $entityFactory
@@ -192,7 +192,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType
         \Magento\Core\Helper\Data $coreData,
         \Magento\Core\Helper\File\Storage\Database $fileStorageDb,
         \Magento\App\Filesystem $filesystem,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Logger $logger,
         \Magento\ConfigurableProduct\Model\Resource\Product\Type\ConfigurableFactory $typeConfigurableFactory,
         \Magento\Eav\Model\EntityFactory $entityFactory,
diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Collection/AssociatedProduct.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Collection/AssociatedProduct.php
index d1e8591e286..5da0573a48b 100644
--- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Collection/AssociatedProduct.php
+++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Collection/AssociatedProduct.php
@@ -38,7 +38,7 @@ class AssociatedProduct
     /**
      * Registry instance
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registryManager;
 
@@ -68,20 +68,21 @@ class AssociatedProduct
      * @param \Magento\Validator\UniversalFactory $universalFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Catalog\Helper\Product\Flat $catalogProductFlat
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
      * @param \Magento\Catalog\Model\Resource\Url $catalogUrl
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Stdlib\DateTime $dateTime
-     * @param \Magento\Core\Model\Registry $registryManager
+     * @param \Magento\Registry $registryManager
      * @param \Magento\ConfigurableProduct\Model\Product\Type\Configurable $productType
      * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig
      * @param \Zend_Db_Adapter_Abstract $connection
      *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
+
     public function __construct(
         \Magento\Core\Model\EntityFactory $entityFactory,
         \Magento\Logger $logger,
@@ -94,14 +95,14 @@ class AssociatedProduct
         \Magento\Validator\UniversalFactory $universalFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Catalog\Helper\Product\Flat $catalogProductFlat,
+        \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
         \Magento\Catalog\Model\Resource\Url $catalogUrl,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Stdlib\DateTime $dateTime,
-        \Magento\Core\Model\Registry $registryManager,
+        \Magento\Registry $registryManager,
         \Magento\ConfigurableProduct\Model\Product\Type\Configurable $productType,
         \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig,
         $connection = null
@@ -121,7 +122,7 @@ class AssociatedProduct
             $universalFactory,
             $storeManager,
             $catalogData,
-            $catalogProductFlat,
+            $catalogProductFlatState,
             $coreStoreConfig,
             $productOptionFactory,
             $catalogUrl,
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php
index 7f8d9424e14..142a8ec74e7 100644
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php
+++ b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php
@@ -56,14 +56,14 @@ abstract class AbstractTab
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Connect\Model\Session $session
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Connect\Model\Session $session,
         array $data = array()
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Authors.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Authors.php
index ea6b0821800..9715c65d9d6 100644
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Authors.php
+++ b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Authors.php
@@ -46,14 +46,14 @@ class Authors
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Json\EncoderInterface $jsonEncoder
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Connect\Model\Session $session
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Connect\Model\Session $session,
         \Magento\Json\EncoderInterface $jsonEncoder,
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Contents.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Contents.php
index b8090b5dce4..71f73404667 100644
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Contents.php
+++ b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Contents.php
@@ -45,7 +45,7 @@ class Contents
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Connect\Model\Session $session
      * @param \Magento\Connect\Model\ExtensionFactory $extensionFactory
@@ -53,7 +53,7 @@ class Contents
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Connect\Model\Session $session,
         \Magento\Connect\Model\ExtensionFactory $extensionFactory,
diff --git a/app/code/Magento/Contacts/Controller/Index.php b/app/code/Magento/Contacts/Controller/Index.php
index 591d5e791e8..270fa5a5198 100644
--- a/app/code/Magento/Contacts/Controller/Index.php
+++ b/app/code/Magento/Contacts/Controller/Index.php
@@ -43,6 +43,24 @@ class Index extends \Magento\App\Action\Action
     const XML_PATH_EMAIL_TEMPLATE   = 'contacts/email/email_template';
     const XML_PATH_ENABLED          = 'contacts/contacts/enabled';
 
+    /**
+     * @var \Magento\Mail\Template\TransportBuilder
+     */
+    protected $_transportBuilder;
+
+    /**
+     * @param \Magento\App\Action\Context $context
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
+     */
+    public function __construct(
+        \Magento\App\Action\Context $context,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder
+    ) {
+        parent::__construct($context);
+        $this->_transportBuilder = $transportBuilder;
+    }
+
+
     /**
      * Dispatch request
      *
@@ -115,25 +133,22 @@ class Index extends \Magento\App\Action\Action
                 if ($error) {
                     throw new \Exception();
                 }
-                $mailTemplate = $this->_objectManager->create('Magento\Email\Model\Template');
-                /* @var $mailTemplate \Magento\Email\Model\Template */
-                $mailTemplate->setDesignConfig(array(
-                    'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
-                    'store' => $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')
-                        ->getStore()->getId()
-                ))
+
+                $storeConfig = $this->_objectManager->get('Magento\Core\Model\Store\Config');
+                $storeManager = $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface');
+                $transport = $this->_transportBuilder
+                    ->setTemplateIdentifier($storeConfig->getConfig(self::XML_PATH_EMAIL_TEMPLATE))
+                    ->setTemplateOptions(array(
+                        'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                        'store' => $storeManager->getStore()->getId()
+                    ))
+                    ->setTemplateVars(array('data' => $postObject))
+                    ->setFrom($storeConfig->getConfig(self::XML_PATH_EMAIL_SENDER))
+                    ->addTo($storeConfig->getConfig(self::XML_PATH_EMAIL_RECIPIENT))
                     ->setReplyTo($post['email'])
-                    ->sendTransactional(
-                        $this->_objectManager->get('Magento\Core\Model\Store\Config')->getConfig(self::XML_PATH_EMAIL_TEMPLATE),
-                        $this->_objectManager->get('Magento\Core\Model\Store\Config')->getConfig(self::XML_PATH_EMAIL_SENDER),
-                        $this->_objectManager->get('Magento\Core\Model\Store\Config')->getConfig(self::XML_PATH_EMAIL_RECIPIENT),
-                        null,
-                        array('data' => $postObject)
-                    );
-
-                if (!$mailTemplate->getSentSuccess()) {
-                    throw new \Exception();
-                }
+                    ->getTransport();
+
+                $transport->sendMessage();
 
                 $translate->setTranslateInline(true);
 
diff --git a/app/code/Magento/Contacts/etc/module.xml b/app/code/Magento/Contacts/etc/module.xml
index e4fa2ea264d..06955bdf4c7 100755
--- a/app/code/Magento/Contacts/etc/module.xml
+++ b/app/code/Magento/Contacts/etc/module.xml
@@ -33,7 +33,6 @@
             <module name="Magento_Customer"/>
             <module name="Magento_Backend"/>
             <module name="Magento_Cms"/>
-            <module name="Magento_Email"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/Core/App/Router/Base.php b/app/code/Magento/Core/App/Router/Base.php
index 3e4ff880af5..f6915fab698 100644
--- a/app/code/Magento/Core/App/Router/Base.php
+++ b/app/code/Magento/Core/App/Router/Base.php
@@ -92,6 +92,11 @@ class Base extends \Magento\App\Router\AbstractRouter
      */
     protected $_defaultPath;
 
+    /**
+     * @var \Magento\Code\NameBuilder
+     */
+    protected $nameBuilder;
+
     /**
      * @param \Magento\App\ActionFactory $actionFactory
      * @param \Magento\App\DefaultPathInterface $defaultPath
@@ -103,6 +108,7 @@ class Base extends \Magento\App\Router\AbstractRouter
      * @param \Magento\Core\Model\Store\Config $storeConfig
      * @param \Magento\Url\SecurityInfoInterface $urlSecurityInfo
      * @param string $routerId
+     * @param \Magento\Code\NameBuilder $nameBuilder
      * @throws \InvalidArgumentException
      */
     public function __construct(
@@ -115,7 +121,8 @@ class Base extends \Magento\App\Router\AbstractRouter
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Core\Model\Store\Config $storeConfig,
         \Magento\Url\SecurityInfoInterface $urlSecurityInfo,
-        $routerId
+        $routerId,
+        \Magento\Code\NameBuilder $nameBuilder
     ) {
         parent::__construct($actionFactory);
 
@@ -127,6 +134,7 @@ class Base extends \Magento\App\Router\AbstractRouter
         $this->_url             = $url;
         $this->_storeManager    = $storeManager;
         $this->_appState        = $appState;
+        $this->nameBuilder = $nameBuilder;
     }
 
     /**
@@ -311,6 +319,7 @@ class Base extends \Magento\App\Router\AbstractRouter
             if (is_null($controllerInstance)) {
                 return null;
             }
+            $action = 'noroute';
         }
 
         // set values only after all the checks are done
@@ -353,7 +362,7 @@ class Base extends \Magento\App\Router\AbstractRouter
      */
     public function getControllerClassName($module, $controller)
     {
-        return \Magento\Core\Helper\String::buildClassName(array(
+        return $this->nameBuilder->buildClassName(array(
             $module,
             'Controller',
             $controller
diff --git a/app/code/Magento/Core/Model/AbstractModel.php b/app/code/Magento/Core/Model/AbstractModel.php
index e167128940f..67098c79a76 100644
--- a/app/code/Magento/Core/Model/AbstractModel.php
+++ b/app/code/Magento/Core/Model/AbstractModel.php
@@ -123,7 +123,7 @@ abstract class AbstractModel extends \Magento\Object
     protected $_cacheManager;
 
     /**
-     * @var Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -138,15 +138,15 @@ abstract class AbstractModel extends \Magento\Object
     protected $_appState;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
@@ -208,9 +208,9 @@ abstract class AbstractModel extends \Magento\Object
         $objectManager = \Magento\App\ObjectManager::getInstance();
         $this->_eventManager = $objectManager->get('Magento\Event\ManagerInterface');
         $this->_cacheManager = $objectManager->get('Magento\App\CacheInterface');
-        $this->_coreRegistry = $objectManager->get('Magento\Core\Model\Registry');
-        $context = $objectManager->get('Magento\Core\Model\Context');
-        if ($context instanceof \Magento\Core\Model\Context) {
+        $this->_coreRegistry = $objectManager->get('Magento\Registry');
+        $context = $objectManager->get('Magento\Model\Context');
+        if ($context instanceof \Magento\Model\Context) {
             $this->_appState = $context->getAppState();
         }
     }
diff --git a/app/code/Magento/Core/Model/App.php b/app/code/Magento/Core/Model/App.php
index 4a9ab1d2800..1e055605f13 100644
--- a/app/code/Magento/Core/Model/App.php
+++ b/app/code/Magento/Core/Model/App.php
@@ -50,7 +50,7 @@ class App implements \Magento\AppInterface
     /**
      * Magento version
      */
-    const VERSION = '2.0.0.0-dev66';
+    const VERSION = '2.0.0.0-dev67';
 
     /**
      * Application run code
@@ -516,7 +516,7 @@ class App implements \Magento\AppInterface
             'revision'  => '0',
             'patch'     => '0',
             'stability' => 'dev',
-            'number'    => '66',
+            'number'    => '67',
         );
     }
 }
diff --git a/app/code/Magento/Core/Model/Config/Value.php b/app/code/Magento/Core/Model/Config/Value.php
index 306f0683e6a..9c333d5a065 100644
--- a/app/code/Magento/Core/Model/Config/Value.php
+++ b/app/code/Magento/Core/Model/Config/Value.php
@@ -71,8 +71,8 @@ class Value extends \Magento\Core\Model\AbstractModel implements \Magento\App\Co
     protected $_config;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -80,8 +80,8 @@ class Value extends \Magento\Core\Model\AbstractModel implements \Magento\App\Co
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Core/Model/Design.php b/app/code/Magento/Core/Model/Design.php
index bef938c6dac..31481e24c3b 100644
--- a/app/code/Magento/Core/Model/Design.php
+++ b/app/code/Magento/Core/Model/Design.php
@@ -75,8 +75,8 @@ class Design extends AbstractModel
     protected $_dateTime;
 
     /**
-     * @param Context $context
-     * @param Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param LocaleInterface $locale
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param AbstractResource $resource
@@ -84,9 +84,9 @@ class Design extends AbstractModel
      * @param array $data
      */
     public function __construct(
-        Context $context,
-        Registry $registry,
-        LocaleInterface $locale,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
+        \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Stdlib\DateTime $dateTime,
         AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Core/Model/Design/Backend/Exceptions.php b/app/code/Magento/Core/Model/Design/Backend/Exceptions.php
index ae880801ba1..dca3063d681 100644
--- a/app/code/Magento/Core/Model/Design/Backend/Exceptions.php
+++ b/app/code/Magento/Core/Model/Design/Backend/Exceptions.php
@@ -36,8 +36,8 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS
     protected $_design = null;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\View\DesignInterface $design
@@ -46,8 +46,8 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\View\DesignInterface $design,
diff --git a/app/code/Magento/Core/Model/Design/Backend/Theme.php b/app/code/Magento/Core/Model/Design/Backend/Theme.php
index 6ea657a59a6..714b82159c7 100644
--- a/app/code/Magento/Core/Model/Design/Backend/Theme.php
+++ b/app/code/Magento/Core/Model/Design/Backend/Theme.php
@@ -36,8 +36,8 @@ class Theme extends \Magento\Core\Model\Config\Value
     protected $_design = null;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\View\DesignInterface $design
@@ -46,8 +46,8 @@ class Theme extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\View\DesignInterface $design,
diff --git a/app/code/Magento/Core/Model/File/Storage.php b/app/code/Magento/Core/Model/File/Storage.php
index e33e561b8a6..2589a354bc5 100644
--- a/app/code/Magento/Core/Model/File/Storage.php
+++ b/app/code/Magento/Core/Model/File/Storage.php
@@ -102,8 +102,8 @@ class Storage extends AbstractModel
     protected $filesystem;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Helper\File\Storage $coreFileStorage
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\App\ConfigInterface $coreConfig
@@ -116,8 +116,8 @@ class Storage extends AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Helper\File\Storage $coreFileStorage,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\App\ConfigInterface $coreConfig,
diff --git a/app/code/Magento/Core/Model/File/Storage/Database.php b/app/code/Magento/Core/Model/File/Storage/Database.php
index 0d143fb025e..ea79cca5761 100644
--- a/app/code/Magento/Core/Model/File/Storage/Database.php
+++ b/app/code/Magento/Core/Model/File/Storage/Database.php
@@ -63,8 +63,8 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas
     protected $_mediaHelper;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb
      * @param \Magento\Core\Model\Date $dateModel
      * @param \Magento\Core\Model\App $app
@@ -76,8 +76,8 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb,
         \Magento\Core\Model\Date $dateModel,
         \Magento\Core\Model\App $app,
diff --git a/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php b/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php
index 34bb514b1c1..05a7be9709c 100644
--- a/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php
+++ b/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php
@@ -58,8 +58,8 @@ abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel
     protected $_app;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb
      * @param \Magento\Core\Model\Date $dateModel
      * @param \Magento\Core\Model\App $app
@@ -69,8 +69,8 @@ abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb,
         \Magento\Core\Model\Date $dateModel,
         \Magento\Core\Model\App $app,
diff --git a/app/code/Magento/Core/Model/File/Storage/Directory/Database.php b/app/code/Magento/Core/Model/File/Storage/Directory/Database.php
index a039265521e..2ba22adeea4 100644
--- a/app/code/Magento/Core/Model/File/Storage/Directory/Database.php
+++ b/app/code/Magento/Core/Model/File/Storage/Directory/Database.php
@@ -51,8 +51,8 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas
     protected $_directoryFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb
      * @param \Magento\Core\Model\Date $dateModel
      * @param \Magento\Core\Model\App $app
@@ -63,8 +63,8 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb,
         \Magento\Core\Model\Date $dateModel,
         \Magento\Core\Model\App $app,
diff --git a/app/code/Magento/Core/Model/Layout/Update.php b/app/code/Magento/Core/Model/Layout/Update.php
index f13caa89174..4afd72ac7da 100644
--- a/app/code/Magento/Core/Model/Layout/Update.php
+++ b/app/code/Magento/Core/Model/Layout/Update.php
@@ -48,16 +48,16 @@ class Update extends \Magento\Core\Model\AbstractModel
     protected $_dateTime;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Core/Model/Mview/View/State.php b/app/code/Magento/Core/Model/Mview/View/State.php
index 9960ca50529..a861563aee9 100644
--- a/app/code/Magento/Core/Model/Mview/View/State.php
+++ b/app/code/Magento/Core/Model/Mview/View/State.php
@@ -44,15 +44,15 @@ class State extends \Magento\Core\Model\AbstractModel implements \Magento\Mview\
     protected $_eventObject = 'mview_state';
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Resource\Mview\View\State $resource
      * @param \Magento\Core\Model\Resource\Mview\View\State\Collection $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Resource\Mview\View\State $resource,
         \Magento\Core\Model\Resource\Mview\View\State\Collection $resourceCollection,
         array $data = array()
diff --git a/app/code/Magento/Core/Model/Source/Urlrewrite/Options.php b/app/code/Magento/Core/Model/Source/Urlrewrite/Options.php
index f6e17607290..b8c8e903be2 100644
--- a/app/code/Magento/Core/Model/Source/Urlrewrite/Options.php
+++ b/app/code/Magento/Core/Model/Source/Urlrewrite/Options.php
@@ -33,9 +33,7 @@
  */
 namespace Magento\Core\Model\Source\Urlrewrite;
 
-use Magento\Core\Model\Option\ArrayInterface;
-
-class Options implements ArrayInterface
+class Options implements \Magento\Option\ArrayInterface
 {
     const TEMPORARY = 'R';
     const PERMANENT = 'RP';
diff --git a/app/code/Magento/Core/Model/Source/Urlrewrite/Types.php b/app/code/Magento/Core/Model/Source/Urlrewrite/Types.php
index 2374d857ee7..8b66687ac3d 100644
--- a/app/code/Magento/Core/Model/Source/Urlrewrite/Types.php
+++ b/app/code/Magento/Core/Model/Source/Urlrewrite/Types.php
@@ -33,7 +33,7 @@
  */
 namespace Magento\Core\Model\Source\Urlrewrite;
 
-class Types implements \Magento\Core\Model\Option\ArrayInterface
+class Types implements \Magento\Option\ArrayInterface
 {
     const SYSTEM = 1;
     const CUSTOM = 0;
diff --git a/app/code/Magento/Core/Model/Store.php b/app/code/Magento/Core/Model/Store.php
index edaf96666af..f1cc2001222 100644
--- a/app/code/Magento/Core/Model/Store.php
+++ b/app/code/Magento/Core/Model/Store.php
@@ -323,8 +323,8 @@ class Store extends AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase,
         \Magento\App\Cache\Type\Config $configCacheType,
         \Magento\UrlInterface $url,
diff --git a/app/code/Magento/Core/Model/Store/Group.php b/app/code/Magento/Core/Model/Store/Group.php
index a72706db903..c71648df131 100644
--- a/app/code/Magento/Core/Model/Store/Group.php
+++ b/app/code/Magento/Core/Model/Store/Group.php
@@ -116,8 +116,8 @@ class Group extends \Magento\Core\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Resource\Config\Data $configDataResource
      * @param \Magento\Core\Model\Store $store
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -126,8 +126,8 @@ class Group extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Resource\Config\Data $configDataResource,
         \Magento\Core\Model\Store $store,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
diff --git a/app/code/Magento/Core/Model/Template.php b/app/code/Magento/Core/Model/Template.php
index 289dc8d982d..0e90b61c61c 100644
--- a/app/code/Magento/Core/Model/Template.php
+++ b/app/code/Magento/Core/Model/Template.php
@@ -32,14 +32,8 @@ namespace Magento\Core\Model;
  * @package     Magento_Core
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-abstract class Template extends AbstractModel
+abstract class Template extends \Magento\Core\Model\AbstractModel implements \Magento\App\TemplateTypesInterface
 {
-    /**
-     * Types of template
-     */
-    const TYPE_TEXT = 1;
-    const TYPE_HTML = 2;
-
     /**
      * Default design area for emulation
      */
@@ -95,22 +89,22 @@ abstract class Template extends AbstractModel
     protected $_appEmulation;
 
     /**
-     * @var StoreManagerInterface
+     * @var \Magento\Core\Model\StoreManagerInterface
      */
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
+     * @param \Magento\Model\Context $context
      * @param \Magento\View\DesignInterface $design
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\App\Emulation $appEmulation
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
+        \Magento\Model\Context $context,
         \Magento\View\DesignInterface $design,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Core\Model\App\Emulation $appEmulation,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         array $data = array()
diff --git a/app/code/Magento/Core/Model/Theme.php b/app/code/Magento/Core/Model/Theme.php
index 92b2df84e09..941abd7a59b 100644
--- a/app/code/Magento/Core/Model/Theme.php
+++ b/app/code/Magento/Core/Model/Theme.php
@@ -112,8 +112,8 @@ class Theme extends AbstractModel implements ThemeInterface
     /**
      * Initialize dependencies
      *
-     * @param Context $context
-     * @param Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\View\Design\Theme\FlyweightFactory $themeFactory
      * @param \Magento\View\Design\Theme\Domain\Factory $domainFactory
      * @param \Magento\View\Design\Theme\ImageFactory $imageFactory
@@ -126,8 +126,8 @@ class Theme extends AbstractModel implements ThemeInterface
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
-        Context $context,
-        Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\View\Design\Theme\FlyweightFactory $themeFactory,
         \Magento\View\Design\Theme\Domain\Factory $domainFactory,
         \Magento\View\Design\Theme\ImageFactory $imageFactory,
diff --git a/app/code/Magento/Core/Model/Theme/File.php b/app/code/Magento/Core/Model/Theme/File.php
index 3e44984d9c6..0ca48d33592 100644
--- a/app/code/Magento/Core/Model/Theme/File.php
+++ b/app/code/Magento/Core/Model/Theme/File.php
@@ -69,8 +69,8 @@ class File extends AbstractModel implements FileInterface
     protected $_themeFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\View\Design\Theme\FlyweightFactory $themeFactory
      * @param \Magento\View\Design\Theme\Customization\FileServiceFactory $fileServiceFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -78,8 +78,8 @@ class File extends AbstractModel implements FileInterface
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\View\Design\Theme\FlyweightFactory $themeFactory,
         \Magento\View\Design\Theme\Customization\FileServiceFactory $fileServiceFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Core/Model/Url/Rewrite.php b/app/code/Magento/Core/Model/Url/Rewrite.php
index 13d3c638a4d..47ec70ca3fc 100644
--- a/app/code/Magento/Core/Model/Url/Rewrite.php
+++ b/app/code/Magento/Core/Model/Url/Rewrite.php
@@ -90,8 +90,8 @@ class Rewrite extends \Magento\Core\Model\AbstractModel
     protected $response;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Core\Model\App $app
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -101,8 +101,8 @@ class Rewrite extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Core\Model\App $app,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
diff --git a/app/code/Magento/Core/Model/Variable.php b/app/code/Magento/Core/Model/Variable.php
index cf4852c2666..3fba78b63a0 100644
--- a/app/code/Magento/Core/Model/Variable.php
+++ b/app/code/Magento/Core/Model/Variable.php
@@ -55,16 +55,16 @@ class Variable extends \Magento\Core\Model\AbstractModel
     protected $_escaper = null;
 
     /**
-     * @param Context $context
-     * @param Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Escaper $escaper
      * @param \Magento\Core\Model\Resource\Variable $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        Context $context,
-        Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Escaper $escaper,
         \Magento\Core\Model\Resource\Variable $resource,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Core/Model/Website.php b/app/code/Magento/Core/Model/Website.php
index 0147877fbbe..f204b346673 100644
--- a/app/code/Magento/Core/Model/Website.php
+++ b/app/code/Magento/Core/Model/Website.php
@@ -183,8 +183,8 @@ class Website extends \Magento\Core\Model\AbstractModel
     protected $_currencyFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Resource\Config\Data $configDataResource
      * @param \Magento\App\ConfigInterface $coreConfig
      * @param \Magento\Core\Model\StoreFactory $storeFactory
@@ -198,8 +198,8 @@ class Website extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Resource\Config\Data $configDataResource,
         \Magento\App\ConfigInterface $coreConfig,
         \Magento\Core\Model\StoreFactory $storeFactory,
diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml
index aa5c0d89c8f..fdff1688e9f 100644
--- a/app/code/Magento/Core/etc/di.xml
+++ b/app/code/Magento/Core/etc/di.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-    <preference for="Magento\Acl\CacheInterface" type="Magento\Core\Model\Acl\Cache" />
+    <preference for="Magento\Acl\CacheInterface" type="Magento\Acl\Cache" />
     <preference for="Magento\Module\Updater\SetupInterface" type="Magento\Core\Model\Resource\Setup" />
     <preference for="Magento\Module\ResourceResolverInterface" type="Magento\Module\ResourceResolver" />
     <preference for="Magento\AuthorizationInterface" type="Magento\Authorization" />
@@ -117,7 +117,7 @@
             <argument name="url" xsi:type="object" shared="false">Magento\UrlInterface</argument>
         </arguments>
     </type>
-    <type name="Magento\Core\Model\Acl\Cache">
+    <type name="Magento\Acl\Cache">
         <arguments>
             <argument name="cacheKey" xsi:type="string">global_acl_resources</argument>
         </arguments>
@@ -247,7 +247,7 @@
     </type>
     <type name="Magento\Core\Model\Translate\Inline\Parser">
         <arguments>
-            <argument name="inputFilter" xsi:type="object">Magento\Core\Model\Input\Filter\MaliciousCode</argument>
+            <argument name="inputFilter" xsi:type="object">Magento\Filter\Input\MaliciousCode</argument>
         </arguments>
     </type>
     <type name="Magento\App\Config\ScopePool">
@@ -317,6 +317,15 @@
     <type name="Magento\View\Publisher">
         <arguments>
             <argument name="preProcessor" xsi:type="object">Magento\View\Asset\PreProcessor\Composite</argument>
+        </arguments>
+    </type>
+    <type name="Magento\View\Publisher\CssFile">
+        <arguments>
+            <argument name="allowDuplication" xsi:type="boolean">true</argument>
+        </arguments>
+    </type>
+    <type name="Magento\View\Publisher\File">
+        <arguments>
             <argument name="allowDuplication" xsi:type="boolean">true</argument>
         </arguments>
     </type>
@@ -334,6 +343,7 @@
         <arguments>
             <argument name="preProcessors" xsi:type="array">
                 <item name="css_source_processor" xsi:type="string">Magento\Css\PreProcessor\Less</item>
+                <item name="css_url_processor" xsi:type="string">Magento\Css\PreProcessor\UrlResolver</item>
             </argument>
         </arguments>
     </type>
@@ -500,6 +510,7 @@
     </type>
     <type name="Magento\View\Asset\MergeService">
         <plugin name="cleanMergedJsCss" type="Magento\Core\Model\Asset\Plugin\CleanMergedJsCss"/>
+        <plugin name="clearLessImportCache" type="Magento\Css\PreProcessor\Cache\Plugin\ImportCleaner" sortOrder="10"/>
     </type>
     <type name="Magento\Core\Model\Url\ScopeResolver">
         <arguments>
@@ -519,18 +530,18 @@
         </arguments>
     </type>
     <type name="Magento\Css\PreProcessor\Less">
-        <plugin name="process_less" type="Magento\Css\PreProcessor\Cache\Plugin" sortOrder="10"/>
+        <plugin name="process_less" type="Magento\Css\PreProcessor\Cache\Plugin\Less" sortOrder="10"/>
     </type>
     <type name="Magento\Less\PreProcessor">
-        <plugin name="process_less_instructions" type="Magento\Css\PreProcessor\Cache\Plugin" sortOrder="10"/>
+        <plugin name="process_less" type="Magento\Css\PreProcessor\Cache\Plugin\InstructionPreProcessor" sortOrder="10"/>
         <arguments>
             <argument name="preProcessors" xsi:type="array">
-                <item name="import" xsi:type="array">
-                    <item name="class" xsi:type="string">Magento\Less\PreProcessor\Instruction\Import</item>
-                </item>
                 <item name="magento_import" xsi:type="array">
                     <item name="class" xsi:type="string">Magento\Less\PreProcessor\Instruction\MagentoImport</item>
                 </item>
+                <item name="import" xsi:type="array">
+                    <item name="class" xsi:type="string">Magento\Less\PreProcessor\Instruction\Import</item>
+                </item>
             </argument>
         </arguments>
     </type>
diff --git a/app/code/Magento/Core/i18n/de_DE.csv b/app/code/Magento/Core/i18n/de_DE.csv
index ac6e17a6ec9..a11e3f1b42a 100644
--- a/app/code/Magento/Core/i18n/de_DE.csv
+++ b/app/code/Magento/Core/i18n/de_DE.csv
@@ -46,7 +46,7 @@
 "Cache storage may contain additional data. Are you sure that you want flush it?","Der Cachespeicher könnte weitere Daten enthalten. Sind Sie sicher, dass Sie diese löschen möchten?"
 "Can not create invoice. Order was not found.","Rechnung konnte nicht erstellt werden. Es wurde keine Bestellung gefunden."
 "Can't retrieve request object","Objekt kann nicht abgefragt werden"
-"Can\'t retrieve entity config: %s","Kann Entität config: %s nicht auffinden"
+"Can't retrieve entity config: %s","Kann Entität config: %s nicht auffinden"
 "Cancel","Abbrechen"
 "Cannot complete this operation from non-admin area.","Diese Aktion kann nicht außerhalb des Admin-Bereichs fertiggestellt werden."
 "Card type does not match credit card number.","Kartentyp entspricht nicht der Kreditkartennummer."
@@ -155,7 +155,7 @@
 "Invalid messages storage ""%s"" for layout messages initialization","Ungültiger Nachrichtenspeicher ""%s"" für die Initialisierung der Layout-Nachrichten"
 "Invalid query","Ungültige Anfrage"
 "Invalid transactional email code: ","Ungültiger Transaktionsmailcode:"
-"Invalid website\'s configuration path: %s","Ungültiger Webseitenkonfigurationspfad: %s"
+"Invalid website's configuration path: %s","Ungültiger Webseitenkonfigurationspfad: %s"
 "JavaScript Settings","JavaScript Einstellungen"
 "Layout","Layout"
 "Leave empty for access from any location.","Leer lassen für den Zugriff von jedem Standort aus."
@@ -197,7 +197,7 @@
 "Parent directory does not exist: %s","Übergeordnetes Verzeichnis existiert nicht: %s"
 "Path ""%value%"" is not available and cannot be used.","Der Pfad ""%value%"" ist nicht verfügbar und kann nicht verwendet werden."
 "Path ""%value%"" is protected and cannot be used.","Der Pfad ""%value%"" ist geschützt und kann nicht verwendet werden."
-"Path ""%value%"" may not include parent directory traversal (""../"", ""..\\).""","Der Pfad ""%value%"" darf keinen Verweis auf das übergeordnete Verzeichnis enthalten (""../"", ""..\)."
+"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","Der Pfad ""%value%"" darf keinen Verweis auf das übergeordnete Verzeichnis enthalten (""../"", ""..\")."
 "Please define flag code.","Bitte definieren Sie Flag-Code."
 "Please enter 6 or more characters. Leading or trailing spaces will be ignored.","Bitte geben Sie 6 oder mehr Zeichen ein. Leerzeichen am Anfang oder Ende werden ignoriert."
 "Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.","Bitte geben Sie 7 oder mehr Zeichen ein. Ihr Passwort sollte sowohl Zahlen als auch Buchstaben enthalten."
@@ -250,7 +250,7 @@
 "Profiler","Profiler"
 "Recovery Link Expiration Interval (days)","Verbleibende Gültigkeitsdauer des Wiederherstellungslinks (Tage)"
 "Request Path for Specified Store","Aufrufpfad für angegebenen Shop"
-"Requested file may not include parent directory traversal (""../"", ""..\\ notation)""","Die angefragte Datei darf keinen Verweis auf ein übergeordnetes Verzeichnis enthalten (""../"", ""..\notation"")"
+"Requested file may not include parent directory traversal (""../"", ""..\" notation)","Die angefragte Datei darf keinen Verweis auf ein übergeordnetes Verzeichnis enthalten (""../"", ""..\" notation)"
 "Requested invalid store ""%s""","Ungültiger Speicher ""%s"" angefragt"
 "Resource is not set.","Ressource ist nicht gesetzt."
 "Retrieve store data","Gespeicherte Daten zurückholen"
diff --git a/app/code/Magento/Core/i18n/en_US.csv b/app/code/Magento/Core/i18n/en_US.csv
index 0c74a9ea88b..7178a29477e 100644
--- a/app/code/Magento/Core/i18n/en_US.csv
+++ b/app/code/Magento/Core/i18n/en_US.csv
@@ -48,7 +48,7 @@
 "Cache storage may contain additional data. Are you sure that you want flush it?","Cache storage may contain additional data. Are you sure that you want flush it?"
 "Can not create invoice. Order was not found.","Can not create invoice. Order was not found."
 "Can't retrieve request object","Can't retrieve request object"
-"Can\'t retrieve entity config: %s","Can\'t retrieve entity config: %s"
+"Can't retrieve entity config: %s","Can't retrieve entity config: %s"
 "Cancel","Cancel"
 "Cannot complete this operation from non-admin area.","Cannot complete this operation from non-admin area."
 "Card type does not match credit card number.","Card type does not match credit card number."
@@ -157,7 +157,7 @@
 "Invalid messages storage ""%s"" for layout messages initialization","Invalid messages storage ""%s"" for layout messages initialization"
 "Invalid query","Invalid query"
 "Invalid transactional email code: ","Invalid transactional email code: "
-"Invalid website\'s configuration path: %s","Invalid website\'s configuration path: %s"
+"Invalid website's configuration path: %s","Invalid website's configuration path: %s"
 "JavaScript Settings","JavaScript Settings"
 "Layout","Layout"
 "Leave empty for access from any location.","Leave empty for access from any location."
@@ -198,7 +198,7 @@
 "Parent directory does not exist: %s","Parent directory does not exist: %s"
 "Path ""%value%"" is not available and cannot be used.","Path ""%value%"" is not available and cannot be used."
 "Path ""%value%"" is protected and cannot be used.","Path ""%value%"" is protected and cannot be used."
-"Path ""%value%"" may not include parent directory traversal (""../"", ""..\\).""","Path ""%value%"" may not include parent directory traversal (""../"", ""..\\)."""
+"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","Path ""%value%"" may not include parent directory traversal (""../"", ""..\")."
 "Please define flag code.","Please define flag code."
 "Please enter 6 or more characters. Leading or trailing spaces will be ignored.","Please enter 6 or more characters. Leading or trailing spaces will be ignored."
 "Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.","Please enter 7 or more characters. Password should contain both numeric and alphabetic characters."
@@ -251,7 +251,7 @@
 "Profiler","Profiler"
 "Recovery Link Expiration Interval (days)","Recovery Link Expiration Interval (days)"
 "Request Path for Specified Store","Request Path for Specified Store"
-"Requested file may not include parent directory traversal (""../"", ""..\\ notation)""","Requested file may not include parent directory traversal (""../"", ""..\\ notation)"""
+"Requested file may not include parent directory traversal (""../"", ""..\" notation)","Requested file may not include parent directory traversal (""../"", ""..\" notation)"
 "Requested invalid store ""%s""","Requested invalid store ""%s"""
 "Resource is not set.","Resource is not set."
 "Retrieve store data","Retrieve store data"
diff --git a/app/code/Magento/Core/i18n/es_ES.csv b/app/code/Magento/Core/i18n/es_ES.csv
index 2afaec1031b..7a4da9e30d0 100644
--- a/app/code/Magento/Core/i18n/es_ES.csv
+++ b/app/code/Magento/Core/i18n/es_ES.csv
@@ -46,7 +46,7 @@
 "Cache storage may contain additional data. Are you sure that you want flush it?","El almacenamiento de caché puede contener datos adicionales. ¿Estás seguro de que deseas eliminarlo?"
 "Can not create invoice. Order was not found.","No se puede crear la factura. No se encontró el pedido."
 "Can't retrieve request object","No se puede recuperar el objeto solicitado"
-"Can\'t retrieve entity config: %s","No se puede recuperar configuración de entidad: %s"
+"Can't retrieve entity config: %s","No se puede recuperar configuración de entidad: %s"
 "Cancel","Cancelar"
 "Cannot complete this operation from non-admin area.","No se puede completar esta operación desde una área que no sea de administración."
 "Card type does not match credit card number.","El tipo de tarjeta no se ajusta al número de tarjeta de crédito."
@@ -155,7 +155,7 @@
 "Invalid messages storage ""%s"" for layout messages initialization","Almacenamiento de mensajes no válido ""%s"" para el diseño de inicialización de mensajes"
 "Invalid query","Consulta no válida"
 "Invalid transactional email code: ","Código del mensaje transaccional no válido:"
-"Invalid website\'s configuration path: %s","Ruta de configuración de la página web no válida: %s"
+"Invalid website's configuration path: %s","Ruta de configuración de la página web no válida: %s"
 "JavaScript Settings","Configuración JavaScript"
 "Layout","Diseño"
 "Leave empty for access from any location.","Déjese en blanco para acceder desde cualquier sitio."
@@ -197,7 +197,7 @@
 "Parent directory does not exist: %s","El directorio padre no existe: %s"
 "Path ""%value%"" is not available and cannot be used.","La ruta ""%value%"" no está disponible y no puede usarse."
 "Path ""%value%"" is protected and cannot be used.","La ruta ""%value%"" está protegida y no se puede utilizar."
-"Path ""%value%"" may not include parent directory traversal (""../"", ""..\\).""","La ruta ""%value%"" no puede incluir accesos de ejecución transversal (""../"", ""..\)."""
+"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","La ruta ""%value%"" no puede incluir accesos de ejecución transversal (""../"", ""..\")."
 "Please define flag code.","Defina el código de marcado."
 "Please enter 6 or more characters. Leading or trailing spaces will be ignored.","Introduzca 6 o más caracteres. Se ignorarán los espacios antes o después."
 "Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.","Por favor, introduzca 7 o más caracteres. La contraseña tiene que contener tanto caracteres numéricos como alfabéticos."
@@ -250,7 +250,7 @@
 "Profiler","Motor de perfiles"
 "Recovery Link Expiration Interval (days)","Periodo de caducidad del enlace de recuperación (días)"
 "Request Path for Specified Store","Solicitar ruta para la tienda especificada"
-"Requested file may not include parent directory traversal (""../"", ""..\\ notation)""","El fichero solicitado no puede incluir accesos de ejecución tranversal (""../"", ""..\ notación)"""
+"Requested file may not include parent directory traversal (""../"", ""..\" notation)","El fichero solicitado no puede incluir accesos de ejecución tranversal (""../"", ""..\" notación)"
 "Requested invalid store ""%s""","Solicitada tienda ""%s"" no válida"
 "Resource is not set.","No se estableció el recurso."
 "Retrieve store data","Obtener datos de la tienda"
diff --git a/app/code/Magento/Core/i18n/fr_FR.csv b/app/code/Magento/Core/i18n/fr_FR.csv
index c838b5da378..a3f06ffb322 100644
--- a/app/code/Magento/Core/i18n/fr_FR.csv
+++ b/app/code/Magento/Core/i18n/fr_FR.csv
@@ -46,7 +46,7 @@
 "Cache storage may contain additional data. Are you sure that you want flush it?","La mémoire cache peut contenir d'autres données. Êtes-vous sûr de vouloir la supprimer ?"
 "Can not create invoice. Order was not found.","Impossible de créer la facture. La commande est introuvable."
 "Can't retrieve request object","Ne peut extraire objet de requête"
-"Can\'t retrieve entity config: %s","Ne peut pas récupérer la configuration de l'entité : %s"
+"Can't retrieve entity config: %s","Ne peut pas récupérer la configuration de l'entité : %s"
 "Cancel","Annuler"
 "Cannot complete this operation from non-admin area.","Ne peut compléter cette opération depuis une zone non-admin."
 "Card type does not match credit card number.","Le type de la carte ne correspond pas au numéro de la carte de crédit."
@@ -155,7 +155,7 @@
 "Invalid messages storage ""%s"" for layout messages initialization","Messages invalides mémoire ""%s"" pour l'initialisation des messages de mise en page"
 "Invalid query","Requête invalide"
 "Invalid transactional email code: ","Code email de transaction invalide:"
-"Invalid website\'s configuration path: %s","Chemin de configuration du site invalide: %s"
+"Invalid website's configuration path: %s","Chemin de configuration du site invalide: %s"
 "JavaScript Settings","Réglages javascript"
 "Layout","Disposition"
 "Leave empty for access from any location.","Laisser vide pour accéder depuis n'importe où"
@@ -197,7 +197,7 @@
 "Parent directory does not exist: %s","Le répertoire parental n'existe pas : %s"
 "Path ""%value%"" is not available and cannot be used.","Le chemin ""%value%"" est indisponible et ne peut être utilisé."
 "Path ""%value%"" is protected and cannot be used.","Le chemin ""%value%"" est protégé et ne peut pas être utilisé."
-"Path ""%value%"" may not include parent directory traversal (""../"", ""..\\).""","Il se peut que le chemin ""%value%"" ne contienne pas de traversée de répertoire parent (""../"", ""..\"")."
+"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","Il se peut que le chemin ""%value%"" ne contienne pas de traversée de répertoire parent (""../"", ""..\")."
 "Please define flag code.","Veuillez définir le code drapeau."
 "Please enter 6 or more characters. Leading or trailing spaces will be ignored.","Veuillez entrer 6 caractères ou plus. Des espaces en début ou en fin seront ignorés."
 "Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.","Veuillez entrer 7 caractères ou plus. Le mot de passe doit contenir des lettres et des chiffres."
@@ -250,7 +250,7 @@
 "Profiler","Profiler"
 "Recovery Link Expiration Interval (days)","Délai d'expiration du lien de récupération (jours)"
 "Request Path for Specified Store","Demander le chemin pour un magasin spécifique"
-"Requested file may not include parent directory traversal (""../"", ""..\\ notation)""","Il se peut que le fichier demandé ne contienne pas de traversée de répertoire parent (notation ""../"", ""..\"")"
+"Requested file may not include parent directory traversal (""../"", ""..\" notation)","Il se peut que le fichier demandé ne contienne pas de traversée de répertoire parent (notation ""../"", ""..\")"
 "Requested invalid store ""%s""","Magasin demandé non valide ""%s"""
 "Resource is not set.","La ressource n'est pas réglée."
 "Retrieve store data","Récupérer les données du magasin"
diff --git a/app/code/Magento/Core/i18n/nl_NL.csv b/app/code/Magento/Core/i18n/nl_NL.csv
index 4c333825516..22cb4d194c9 100644
--- a/app/code/Magento/Core/i18n/nl_NL.csv
+++ b/app/code/Magento/Core/i18n/nl_NL.csv
@@ -46,7 +46,7 @@
 "Cache storage may contain additional data. Are you sure that you want flush it?","Cache opslag kan toevoegende data bevatten. Weet u zeker dat u het wilt verwijderen?"
 "Can not create invoice. Order was not found.","Kan geen rekening maken. Bestelling is niet gevonden."
 "Can't retrieve request object","Kan gevraagde object niet vinden."
-"Can\'t retrieve entity config: %s","Kan geen entiteit configuratie %s verkrijgen."
+"Can't retrieve entity config: %s","Kan geen entiteit configuratie %s verkrijgen."
 "Cancel","annuleer"
 "Cannot complete this operation from non-admin area.","Kan deze operatie vanuit geen-admin gedeelte niet voltooien."
 "Card type does not match credit card number.","Kaarttype komt niet overeen met het nummer van de credit card."
@@ -155,7 +155,7 @@
 "Invalid messages storage ""%s"" for layout messages initialization","Ongeldige berichten opgeslagen ""%s"" voor layout bericht initialisatie"
 "Invalid query","Ongeldige zoekopdracht"
 "Invalid transactional email code: ","Ongeldige transactie email code:"
-"Invalid website\'s configuration path: %s","Ongeldig website configuratie pad: %s"
+"Invalid website's configuration path: %s","Ongeldig website configuratie pad: %s"
 "JavaScript Settings","JavaScript Instellingen"
 "Layout","layout"
 "Leave empty for access from any location.","Laat leeg voor toegang vanaf iedere locatie."
@@ -197,7 +197,7 @@
 "Parent directory does not exist: %s","Hoofd pad bestaat niet: %s"
 "Path ""%value%"" is not available and cannot be used.","Pad ""%value%"" is niet beschikbaar en kan niet gebruikt worden."
 "Path ""%value%"" is protected and cannot be used.","Pad ""%value%"" is beschermd en kan niet worden gebruikt."
-"Path ""%value%"" may not include parent directory traversal (""../"", ""..\\).""","Pad ""%value%"" mag geen parent directory traversal bevatten (""../"", ""..\\)."""
+"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","Pad ""%value%"" mag geen parent directory traversal bevatten (""../"", ""..\")."
 "Please define flag code.","Definieer a.u.b. de vlagcode"
 "Please enter 6 or more characters. Leading or trailing spaces will be ignored.","Voer 6 of meer karakters in a.u.b. Spaties worden genegeerd."
 "Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.","Geef 7 of meer karakters in. Wachtwoord moet zowel cijfers als letters bevatten."
@@ -250,7 +250,7 @@
 "Profiler","Profiler"
 "Recovery Link Expiration Interval (days)","Herstel Link Verloop Periode (dagen)"
 "Request Path for Specified Store","Gevraagd Pad voor Gespecificeerde Winkel"
-"Requested file may not include parent directory traversal (""../"", ""..\\ notation)""","Opgevraagd bestand mag geen ouder-directory traverse (""../"", ""..\\ notatie)"" bevatten"
+"Requested file may not include parent directory traversal (""../"", ""..\" notation)","Opgevraagd bestand mag geen ouder-directory traverse (""../"", ""..\" notatie) bevatten"
 "Requested invalid store ""%s""","Gevraagde ongeldige winkel ""%s"""
 "Resource is not set.","Bron is niet ingesteld"
 "Retrieve store data","Winkeldata ophalen"
diff --git a/app/code/Magento/Core/i18n/pt_BR.csv b/app/code/Magento/Core/i18n/pt_BR.csv
index 76060da0892..0d3821d22f2 100644
--- a/app/code/Magento/Core/i18n/pt_BR.csv
+++ b/app/code/Magento/Core/i18n/pt_BR.csv
@@ -48,7 +48,7 @@ local até que o processo de sincronização esteja completo."
 "Cache storage may contain additional data. Are you sure that you want flush it?","Armazenamento na cache pode conter dados adicionais. Tem certeza de que deseja eliminá-lo?"
 "Can not create invoice. Order was not found.","Não é possível criar fatura. Ordem não foi encontrada."
 "Can't retrieve request object","Não é possível recuperar objeto do pedido"
-"Can\'t retrieve entity config: %s","Não é possível recuperar configuração da entidade: %s"
+"Can't retrieve entity config: %s","Não é possível recuperar configuração da entidade: %s"
 "Cancel","Cancelar"
 "Cannot complete this operation from non-admin area.","Não é possível concluir esta operação de área não administrativa."
 "Card type does not match credit card number.","Tipo de cartão não corresponde ao número de cartão de crédito."
@@ -157,7 +157,7 @@ local até que o processo de sincronização esteja completo."
 "Invalid messages storage ""%s"" for layout messages initialization","Mensagens de armazenamento ""%s"" inválidas para inicialização de mensagens do plano"
 "Invalid query","Consulta inválida"
 "Invalid transactional email code: ","Código de email transacional inválido:"
-"Invalid website\'s configuration path: %s","Caminho de configuração do site inválido: %s"
+"Invalid website's configuration path: %s","Caminho de configuração do site inválido: %s"
 "JavaScript Settings","Configurações JavaScript"
 "Layout","Layout"
 "Leave empty for access from any location.","Deixe em branco para o acesso de qualquer local."
@@ -199,7 +199,7 @@ local até que o processo de sincronização esteja completo."
 "Parent directory does not exist: %s","Diretório principal não existe: %s"
 "Path ""%value%"" is not available and cannot be used.","Caminho ""%valor%"" não está disponível e não pode ser usado."
 "Path ""%value%"" is protected and cannot be used.","Caminho ""%valor%"" é protegido e não pode ser usado."
-"Path ""%value%"" may not include parent directory traversal (""../"", ""..\\).""","Caminho ""%valor%"" não pode incluir passagem pelo diretório principal (""../"", ""..\\)."""
+"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","Caminho ""%valor%"" não pode incluir passagem pelo diretório principal (""../"", ""..\")."
 "Please define flag code.","Por favor defina o código bandeira."
 "Please enter 6 or more characters. Leading or trailing spaces will be ignored.","Por favor insira 6 ou mais caracteres. Espaços à esquerda ou à direita serão ignorados."
 "Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.","Por favor insira 7 ou mais caracteres. Senha deve conter caracteres numéricos e alfabéticos."
@@ -252,7 +252,7 @@ local até que o processo de sincronização esteja completo."
 "Profiler","Gerador de Perfil"
 "Recovery Link Expiration Interval (days)","Perído de validade do link de recuperação (dias)"
 "Request Path for Specified Store","Solicitar Caminho para o Armazenamento Especificado"
-"Requested file may not include parent directory traversal (""../"", ""..\\ notation)""","Arquivo solicitado pode não incluir diretório parental de passagem (""../"", ""..\\ notação)"""
+"Requested file may not include parent directory traversal (""../"", ""..\" notation)","Arquivo solicitado pode não incluir diretório parental de passagem (""../"", ""..\" notação)"
 "Requested invalid store ""%s""","Armazenamento solicitado Inválido ""%s"""
 "Resource is not set.","Recurso não definido."
 "Retrieve store data","Recuperar dados da loja"
diff --git a/app/code/Magento/Core/i18n/zh_CN.csv b/app/code/Magento/Core/i18n/zh_CN.csv
index 64a3e96fbac..b6a4ba9e18b 100644
--- a/app/code/Magento/Core/i18n/zh_CN.csv
+++ b/app/code/Magento/Core/i18n/zh_CN.csv
@@ -46,7 +46,7 @@
 "Cache storage may contain additional data. Are you sure that you want flush it?","缓存存储可能包含额外数据。您确认要清空它吗?"
 "Can not create invoice. Order was not found.","无法创建发票。未找到订单。"
 "Can't retrieve request object","无法获取请求对象"
-"Can\'t retrieve entity config: %s","无法获取实体配置:%s"
+"Can't retrieve entity config: %s","无法获取实体配置:%s"
 "Cancel","取消"
 "Cannot complete this operation from non-admin area.","无法从非管理员区域完成该操作。"
 "Card type does not match credit card number.","信用卡类型与信用卡号不匹配。"
@@ -155,7 +155,7 @@
 "Invalid messages storage ""%s"" for layout messages initialization","对布局消息初始化中无效的消息存储“%s”"
 "Invalid query","无效的查询"
 "Invalid transactional email code: ","无效的交易电子邮件代码:"
-"Invalid website\'s configuration path: %s","无效的网站配置路径:%s"
+"Invalid website's configuration path: %s","无效的网站配置路径:%s"
 "JavaScript Settings","JavaScript 设置"
 "Layout","布局"
 "Leave empty for access from any location.","从任何位置访问留空。"
@@ -197,7 +197,7 @@
 "Parent directory does not exist: %s","父目录不存在:%s"
 "Path ""%value%"" is not available and cannot be used.","路径 ""%value%"" 不可用,因此无法使用。"
 "Path ""%value%"" is protected and cannot be used.","路径 ""%value%"" 受保护,无法使用。"
-"Path ""%value%"" may not include parent directory traversal (""../"", ""..\\).""","路径 ""%value%"" 可能不包含父目录遍历 (""../"", ""..\\)."""
+"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","路径 ""%value%"" 可能不包含父目录遍历 (""../"", ""..\")."
 "Please define flag code.","请定义旗帜代码。"
 "Please enter 6 or more characters. Leading or trailing spaces will be ignored.","请输入六个或更多字符。开头或结尾处的空格会被忽略。"
 "Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.","请输入至少7个字符。密码应包含数字与字母。"
@@ -250,7 +250,7 @@
 "Profiler","配置文件"
 "Recovery Link Expiration Interval (days)","恢复链接过期周期(天)"
 "Request Path for Specified Store","特殊店铺的请求路径"
-"Requested file may not include parent directory traversal (""../"", ""..\\ notation)""","所请求的文件可能没有包含在父目录遍历中 (""../"", ""..\\ notation)"""
+"Requested file may not include parent directory traversal (""../"", ""..\" notation)","所请求的文件可能没有包含在父目录遍历中 (""../"", ""..\" notation)"
 "Requested invalid store ""%s""","请求了无效店铺 ""%s"""
 "Resource is not set.","资源未设置。"
 "Retrieve store data","检索商店数据"
diff --git a/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php b/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php
index 54b07105712..326aad789c9 100644
--- a/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php
+++ b/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php
@@ -56,8 +56,8 @@ class Alert extends \Magento\Core\Model\Config\Value
     protected $_runModelPath = '';
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory
@@ -67,8 +67,8 @@ class Alert extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Config\ValueFactory $configValueFactory,
diff --git a/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php b/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php
index c01551eaa23..53b6c5a703b 100644
--- a/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php
+++ b/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php
@@ -56,8 +56,8 @@ class Sitemap extends \Magento\Core\Model\Config\Value
     protected $_runModelPath = '';
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory
@@ -67,8 +67,8 @@ class Sitemap extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Config\ValueFactory $configValueFactory,
diff --git a/app/code/Magento/Cron/Model/Config/Source/Frequency.php b/app/code/Magento/Cron/Model/Config/Source/Frequency.php
index 33e90942e8e..c6450a34f0c 100644
--- a/app/code/Magento/Cron/Model/Config/Source/Frequency.php
+++ b/app/code/Magento/Cron/Model/Config/Source/Frequency.php
@@ -27,7 +27,7 @@
 
 namespace Magento\Cron\Model\Config\Source;
 
-class Frequency implements \Magento\Core\Model\Option\ArrayInterface
+class Frequency implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Cron/Model/Schedule.php b/app/code/Magento/Cron/Model/Schedule.php
index 4d798b6de6f..951501b05fe 100644
--- a/app/code/Magento/Cron/Model/Schedule.php
+++ b/app/code/Magento/Cron/Model/Schedule.php
@@ -66,16 +66,16 @@ class Schedule extends \Magento\Core\Model\AbstractModel
     protected $_date;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Date $date
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Date $date,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php
index 2c642e25910..d7189e52cba 100644
--- a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php
+++ b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php
@@ -38,17 +38,17 @@ class Currency extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit.php b/app/code/Magento/Customer/Block/Adminhtml/Edit.php
index 558a52328ee..7522db41be9 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit.php
@@ -38,18 +38,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Attribute/Group.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Attribute/Group.php
index 915e30d6b70..714c41f4abe 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Attribute/Group.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Attribute/Group.php
@@ -48,20 +48,20 @@ class Group
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Customer\Helper\Address $customerAddress
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Customer\Helper\Address $customerAddress,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php
index 64e950c1381..a7462de733d 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php
@@ -67,7 +67,7 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Customer\Model\FormFactory $customerFactory
@@ -77,7 +77,7 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Customer\Model\FormFactory $customerFactory,
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php
index 6cb63bba68b..57f2c09a581 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php
@@ -66,7 +66,7 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Helper\Data $coreData
      * @param \Magento\Json\EncoderInterface $jsonEncoder
@@ -83,7 +83,7 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Helper\Data $coreData,
         \Magento\Json\EncoderInterface $jsonEncoder,
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php
index 41f0bead10d..2cbc5568866 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php
@@ -41,7 +41,7 @@ class Cart extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -60,7 +60,7 @@ class Cart extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Sales\Model\QuoteFactory $quoteFactory
      * @param \Magento\Data\CollectionFactory $dataCollectionFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -68,7 +68,7 @@ class Cart extends \Magento\Backend\Block\Widget\Grid\Extended
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Sales\Model\QuoteFactory $quoteFactory,
         \Magento\Data\CollectionFactory $dataCollectionFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_dataCollectionFactory = $dataCollectionFactory;
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Carts.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Carts.php
index 628f6c34926..10b23f93f8a 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Carts.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Carts.php
@@ -35,18 +35,18 @@ class Carts extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php
index ea485ac551a..039cc3eb186 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php
@@ -44,14 +44,14 @@ class Newsletter extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory,
         array $data = array()
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php
index e48a50a07a3..85d51997c1b 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php
@@ -38,7 +38,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -51,14 +51,14 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Newsletter\Model\Resource\Queue\CollectionFactory $collectionFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Newsletter\Model\Resource\Queue\CollectionFactory $collectionFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php
index ea50e48dffd..8ed79b883cc 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php
@@ -38,18 +38,18 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php
index 366135c44f4..48b8c2b8199 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php
@@ -41,11 +41,11 @@ class Orders extends \Magento\Backend\Block\Widget\Grid\Extended
      * @var \Magento\Sales\Helper\Reorder
      */
     protected $_salesReorder = null;
-    
+
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -59,7 +59,7 @@ class Orders extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory $collectionFactory
      * @param \Magento\Sales\Helper\Reorder $salesReorder
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -67,7 +67,7 @@ class Orders extends \Magento\Backend\Block\Widget\Grid\Extended
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory $collectionFactory,
         \Magento\Sales\Helper\Reorder $salesReorder,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php
index 83198e812a2..101e60094dc 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php
@@ -46,7 +46,7 @@ class View
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -74,7 +74,7 @@ class View
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService
      * @param \Magento\Log\Model\CustomerFactory $logFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Log\Model\Visitor $modelVisitor
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param array $data
@@ -83,7 +83,7 @@ class View
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService,
         \Magento\Log\Model\CustomerFactory $logFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Log\Model\Visitor $modelVisitor,
         \Magento\Stdlib\DateTime $dateTime,
         array $data = array()
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Accordion.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Accordion.php
index 4079a591875..8758a1a9f82 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Accordion.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Accordion.php
@@ -38,7 +38,7 @@ class Accordion extends \Magento\Backend\Block\Widget\Accordion
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -56,14 +56,14 @@ class Accordion extends \Magento\Backend\Block\Widget\Accordion
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Sales\Model\QuoteFactory $quoteFactory
      * @param \Magento\Wishlist\Model\Resource\Item\CollectionFactory $itemsFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Sales\Model\QuoteFactory $quoteFactory,
         \Magento\Wishlist\Model\Resource\Item\CollectionFactory $itemsFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php
index 13592e72bac..7aabf99eb30 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php
@@ -41,7 +41,7 @@ class Cart extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -60,7 +60,7 @@ class Cart extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Sales\Model\QuoteFactory $quoteFactory
      * @param \Magento\Data\CollectionFactory $dataCollectionFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -68,7 +68,7 @@ class Cart extends \Magento\Backend\Block\Widget\Grid\Extended
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Sales\Model\QuoteFactory $quoteFactory,
         \Magento\Data\CollectionFactory $dataCollectionFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_dataCollectionFactory = $dataCollectionFactory;
@@ -95,7 +95,12 @@ class Cart extends \Magento\Backend\Block\Widget\Grid\Extended
         if ($this->getWebsiteId()) {
             $quote->setWebsite($this->_storeManager->getWebsite($this->getWebsiteId()));
         }
-        $quote->loadByCustomer($this->_coreRegistry->registry('current_customer'));
+
+        /** @var \Magento\Customer\Model\Customer $currentCustomer */
+        $currentCustomer = $this->_coreRegistry->registry('current_customer');
+        if (!is_null($currentCustomer)) {
+            $quote->loadByCustomer($currentCustomer->getId());
+        }
 
         if ($quote) {
             $collection = $quote->getItemsCollection(false);
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Orders.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Orders.php
index 842c5082453..f53ebc888fb 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Orders.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Orders.php
@@ -38,7 +38,7 @@ class Orders extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -51,14 +51,14 @@ class Orders extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory $collectionFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory $collectionFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php
index 58b5f7e846f..e21b631e2b7 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php
@@ -56,7 +56,7 @@ class Sales extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -74,14 +74,14 @@ class Sales extends \Magento\Backend\Block\Template
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
      * @param \Magento\Sales\Model\Resource\Sale\CollectionFactory $collectionFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Directory\Model\CurrencyFactory $currencyFactory,
         \Magento\Sales\Model\Resource\Sale\CollectionFactory $collectionFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
@@ -101,8 +101,11 @@ class Sales extends \Magento\Backend\Block\Template
         $this->_currency = $this->_currencyFactory->create()
             ->load($this->_storeConfig->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE));
 
+        $customerId = $this->_coreRegistry->registry('current_customer')
+            ? $this->_coreRegistry->registry('current_customer')->getId()
+            : 0;
         $this->_collection = $this->_collectionFactory->create()
-            ->setCustomerFilter($this->_coreRegistry->registry('current_customer'))
+            ->setCustomerFilter($customerId)
             ->setOrderStateFilter(\Magento\Sales\Model\Order::STATE_CANCELED, true)
             ->load();
 
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Wishlist.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Wishlist.php
index c0e0567366c..c5694f36c3a 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Wishlist.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Wishlist.php
@@ -38,7 +38,7 @@ class Wishlist extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -51,14 +51,14 @@ class Wishlist extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Wishlist\Model\Resource\Item\CollectionFactory $collectionFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Wishlist\Model\Resource\Item\CollectionFactory $collectionFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tabs.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tabs.php
index 81acf1f7655..ff408a82e72 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tabs.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tabs.php
@@ -34,7 +34,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -42,14 +42,14 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Backend\Model\Auth\Session $authSession
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Backend\Model\Auth\Session $authSession,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Group/Edit.php b/app/code/Magento/Customer/Block/Adminhtml/Group/Edit.php
index 275b93ad43a..349dd3e0db4 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Group/Edit.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Group/Edit.php
@@ -34,7 +34,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -45,13 +45,13 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Group/Edit/Form.php b/app/code/Magento/Customer/Block/Adminhtml/Group/Edit/Form.php
index b61f3869d9a..3217b72a543 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Group/Edit/Form.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Group/Edit/Form.php
@@ -42,14 +42,14 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Tax\Model\TaxClass\Source\Customer $taxCustomer
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Tax\Model\TaxClass\Source\Customer $taxCustomer,
         array $data = array()
diff --git a/app/code/Magento/Customer/Controller/Account.php b/app/code/Magento/Customer/Controller/Account.php
index e8c2f15923b..4bfe575994c 100644
--- a/app/code/Magento/Customer/Controller/Account.php
+++ b/app/code/Magento/Customer/Controller/Account.php
@@ -63,7 +63,7 @@ class Account extends \Magento\App\Action\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -132,7 +132,7 @@ class Account extends \Magento\App\Action\Action
 
     /**
      * @param \Magento\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\UrlFactory $urlFactory
      * @param \Magento\Customer\Model\CustomerFactory $customerFactory
@@ -150,7 +150,7 @@ class Account extends \Magento\App\Action\Action
      */
     public function __construct(
         \Magento\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\UrlFactory $urlFactory,
         \Magento\Customer\Model\CustomerFactory $customerFactory,
diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Group.php b/app/code/Magento/Customer/Controller/Adminhtml/Group.php
index 26cf4bd51cc..a863a573415 100644
--- a/app/code/Magento/Customer/Controller/Adminhtml/Group.php
+++ b/app/code/Magento/Customer/Controller/Adminhtml/Group.php
@@ -36,7 +36,7 @@ class Group extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -44,7 +44,7 @@ class Group extends \Magento\Backend\App\Action
      * @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface
      */
     protected $_groupService;
-    
+
     /**
      * @var \Magento\Customer\Service\V1\Dto\CustomerGroupBuilder
      */
@@ -52,13 +52,13 @@ class Group extends \Magento\Backend\App\Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService
      * @param \Magento\Customer\Service\V1\Dto\CustomerGroupBuilder $customerGroupBuilder
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService,
         \Magento\Customer\Service\V1\Dto\CustomerGroupBuilder $customerGroupBuilder
     ) {
diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index.php b/app/code/Magento/Customer/Controller/Adminhtml/Index.php
index 163b217c047..8a937768c28 100644
--- a/app/code/Magento/Customer/Controller/Adminhtml/Index.php
+++ b/app/code/Magento/Customer/Controller/Adminhtml/Index.php
@@ -37,7 +37,7 @@ class Index extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -74,7 +74,7 @@ class Index extends \Magento\Backend\App\Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\App\Response\Http\FileFactory $fileFactory
      * @param \Magento\Customer\Model\CustomerFactory $customerFactory
      * @param \Magento\Customer\Model\AddressFactory $addressFactory
@@ -82,7 +82,7 @@ class Index extends \Magento\Backend\App\Action
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\App\Response\Http\FileFactory $fileFactory,
         \Magento\Customer\Model\CustomerFactory $customerFactory,
         \Magento\Customer\Model\AddressFactory $addressFactory,
@@ -313,7 +313,7 @@ class Index extends \Magento\Backend\App\Action
                 }
 
                 // Done Saving customer, finish save action
-                $this->_objectManager->get('Magento\Core\Model\Registry')
+                $this->_objectManager->get('Magento\Registry')
                     ->register(self::REGISTRY_CURRENT_CUSTOMER, $customer);
                 $this->messageManager->addSuccess(__('You saved the customer.'));
 
diff --git a/app/code/Magento/Customer/Helper/Data.php b/app/code/Magento/Customer/Helper/Data.php
index 7d305ab1194..c0aeaa3a159 100644
--- a/app/code/Magento/Customer/Helper/Data.php
+++ b/app/code/Magento/Customer/Helper/Data.php
@@ -113,8 +113,16 @@ class Data extends \Magento\App\Helper\AbstractHelper
     protected $_customerAddress = null;
 
     /**
-     * Core store config
-     *
+     * @var \Magento\Core\Model\StoreManagerInterface
+     */
+    protected $_storeManager;
+
+    /**
+     * @var \Magento\Customer\Model\Config\Share
+     */
+    protected $_configShare;
+
+    /**
      * @var \Magento\Core\Model\Store\Config
      */
     protected $_coreStoreConfig;
@@ -148,16 +156,13 @@ class Data extends \Magento\App\Helper\AbstractHelper
      * @var \Magento\Math\Random
      */
     protected $mathRandom;
-    
-    /**
-     * @var \Magento\Customer\Model\Converter
-     */
-    protected $_converter;
 
     /**
      * @param \Magento\App\Helper\Context $context
      * @param \Magento\Customer\Helper\Address $customerAddress
      * @param \Magento\Core\Helper\Data $coreData
+     * @param \Magento\Core\Model\StoreManagerInterface $storeManager
+     * @param \Magento\Customer\Model\Config\Share $configShare
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\App\ConfigInterface $coreConfig
      * @param \Magento\Customer\Model\Session $customerSession
@@ -165,23 +170,25 @@ class Data extends \Magento\App\Helper\AbstractHelper
      * @param \Magento\Customer\Model\FormFactory $formFactory
      * @param \Magento\Escaper $escaper
      * @param \Magento\Math\Random $mathRandom
-     * @param \Magento\Customer\Model\Converter
      */
     public function __construct(
         \Magento\App\Helper\Context $context,
         \Magento\Customer\Helper\Address $customerAddress,
         \Magento\Core\Helper\Data $coreData,
+        \Magento\Core\Model\StoreManagerInterface $storeManager,
+        \Magento\Customer\Model\Config\Share $configShare,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\App\ConfigInterface $coreConfig,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService,
         \Magento\Customer\Model\FormFactory $formFactory,
         \Magento\Escaper $escaper,
-        \Magento\Math\Random $mathRandom,
-        \Magento\Customer\Model\Converter $converter
+        \Magento\Math\Random $mathRandom
     ) {
         $this->_customerAddress = $customerAddress;
         $this->_coreData = $coreData;
+        $this->_storeManager = $storeManager;
+        $this->_configShare = $configShare;
         $this->_coreStoreConfig = $coreStoreConfig;
         $this->_coreConfig = $coreConfig;
         $this->_customerSession = $customerSession;
@@ -189,7 +196,6 @@ class Data extends \Magento\App\Helper\AbstractHelper
         $this->_formFactory = $formFactory;
         $this->_escaper = $escaper;
         $this->mathRandom = $mathRandom;
-        $this->_converter = $converter;
         parent::__construct($context);
     }
 
@@ -786,17 +792,36 @@ class Data extends \Magento\App\Helper\AbstractHelper
         return $this->_formFactory->create();
     }
 
+
     /**
-     * Loads the values from a customer model.
-     * This is a wrapper for the converter object.
+     * Check store availability for customer given the customerId
      *
-     * TODO to be removed after service refactoring is done
+     * @param int $customerWebsiteId
+     * @param int $storeId
+     * @return bool
+     */
+    public function isCustomerInStore($customerWebsiteId, $storeId)
+    {
+        $ids = $this->getSharedStoreIds($customerWebsiteId);
+        return in_array($storeId, $ids);
+    }
+
+    /**
+     * Retrieve shared store ids
      *
-     * @param \Magento\Customer\Model\Customer $customerModel
-     * @return \Magento\Customer\Service\V1\Dto\Customer
+     * @param int $customerWebsiteId
+     * @return array
      */
-    public function createCustomerFromModel($customerModel)
+    public function getSharedStoreIds($customerWebsiteId)
     {
-        return $this->_converter->createCustomerFromModel($customerModel);
+        $ids = array();
+        if ((bool)$this->_configShare->isWebsiteScope()) {
+            $ids = $this->_storeManager->getWebsite($customerWebsiteId)->getStoreIds();
+        } else {
+            foreach ($this->_storeManager->getStores() as $store) {
+                $ids[] = $store->getId();
+            }
+        }
+        return $ids;
     }
 }
diff --git a/app/code/Magento/Customer/Model/Address.php b/app/code/Magento/Customer/Model/Address.php
index 4165b79e566..0564df6394d 100644
--- a/app/code/Magento/Customer/Model/Address.php
+++ b/app/code/Magento/Customer/Model/Address.php
@@ -47,8 +47,8 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
     protected $_customerFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Directory\Helper\Data $directoryData
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Customer\Model\Address\Config $addressConfig
@@ -60,8 +60,8 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Directory\Helper\Data $directoryData,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Customer\Model\Address\Config $addressConfig,
diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php
index c6e61d2d1c3..1c03bf1e941 100644
--- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php
+++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php
@@ -24,6 +24,8 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\Customer\Model\Address;
+
 /**
  * Address abstract model
  *
@@ -33,9 +35,11 @@
  * @method string getMiddlename()
  * @method string getLastname()
  * @method int getCountryId()
+ * @method string getCity()
+ * @method string getTelephone()
+ * @method string getPostcode()
+ * @method bool getShouldIgnoreValidation()
  */
-namespace Magento\Customer\Model\Address;
-
 class AbstractAddress extends \Magento\Core\Model\AbstractModel
 {
     /**
@@ -100,8 +104,8 @@ class AbstractAddress extends \Magento\Core\Model\AbstractModel
     protected $_countryFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Directory\Helper\Data $directoryData
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Customer\Model\Address\Config $addressConfig
@@ -112,8 +116,8 @@ class AbstractAddress extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Directory\Helper\Data $directoryData,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Customer\Model\Address\Config $addressConfig,
@@ -439,7 +443,7 @@ class AbstractAddress extends \Magento\Core\Model\AbstractModel
     /**
      * Validate address attribute values
      *
-     * @return bool
+     * @return bool|array
      */
     public function validate()
     {
diff --git a/app/code/Magento/Customer/Model/Address/Converter.php b/app/code/Magento/Customer/Model/Address/Converter.php
new file mode 100644
index 00000000000..e0933690ba9
--- /dev/null
+++ b/app/code/Magento/Customer/Model/Address/Converter.php
@@ -0,0 +1,163 @@
+<?php
+/**
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Customer\Model\Address;
+
+use Magento\Customer\Model\AddressFactory;
+use Magento\Customer\Service\V1\Dto\Address;
+use Magento\Customer\Service\V1\Dto\AddressBuilder;
+use Magento\Customer\Model\Address as AddressModel;
+use Magento\Customer\Service\V1\Dto\Region;
+use Magento\Customer\Service\V1\Dto\RegionBuilder;
+use \Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
+
+/**
+ * Customer Address Model converter.
+ *
+ * Converts a Customer Address Model to a DTO.
+ *
+ * TODO: Remove this class after service refactoring is done and the model is no longer needed outside of service.
+ *       Then this function could be moved to the service.
+ */
+class Converter
+{
+    /**
+     * @var AddressBuilder
+     */
+    protected $_addressBuilder;
+
+    /**
+     * @var AddressFactory
+     */
+    protected $_addressFactory;
+
+    /**
+     * @var RegionBuilder
+     */
+    private $_regionBuilder;
+
+    /**
+     * @param AddressBuilder $addressBuilder
+     * @param AddressFactory $addressFactory
+     * @param RegionBuilder $regionBuilder
+     */
+    public function __construct(
+        AddressBuilder $addressBuilder,
+        AddressFactory $addressFactory,
+        RegionBuilder $regionBuilder
+    )
+    {
+        $this->_addressBuilder = $addressBuilder;
+        $this->_addressFactory = $addressFactory;
+        $this->_regionBuilder = $regionBuilder;
+    }
+
+    /**
+     * Creates an address model out of an address DTO.
+     *
+     * @param Address $addressDto
+     * @return AddressModel
+     */
+    public function createAddressModel(Address $addressDto)
+    {
+        $addressModel = $this->_addressFactory->create();
+        $this->updateAddressModel($addressModel, $addressDto);
+
+        return $addressModel;
+    }
+
+    /**
+     * Updates an Address Model based on information from an Address DTO.
+     *
+     * @param AddressModel $addressModel
+     * @param Address $address
+     * return null
+     */
+    public function updateAddressModel(AddressModel $addressModel, Address $address)
+    {
+        // Set all attributes
+        foreach ($address->getAttributes() as $attributeCode => $attributeData) {
+            if (Address::KEY_REGION == $attributeCode && $address->getRegion() instanceof Region) {
+                $addressModel->setDataUsingMethod(Address::KEY_REGION, $address->getRegion()->getRegion());
+                $addressModel->setDataUsingMethod('region_code', $address->getRegion()->getRegionCode());
+                $addressModel->setDataUsingMethod(Address::KEY_REGION_ID, $address->getRegion()->getRegionId());
+            } else {
+                $addressModel->setDataUsingMethod($attributeCode, $attributeData);
+            }
+        }
+        // Set customer related data
+        $isBilling = $address->isDefaultBilling();
+        $addressModel->setIsDefaultBilling($isBilling);
+        $addressModel->setIsDefaultShipping($address->isDefaultShipping());
+        // Need to use attribute set or future updates can cause data loss
+        if (!$addressModel->getAttributeSetId()) {
+            $addressModel->setAttributeSetId(CustomerMetadataServiceInterface::ATTRIBUTE_SET_ID_ADDRESS);
+        }
+    }
+
+    /**
+     * Make address DTO out of an address model
+     *
+     * @param AddressModel $addressModel
+     * @param int $defaultBillingId
+     * @param int $defaultShippingId
+     * @return Address
+     */
+    public function createAddressFromModel(AddressModel $addressModel, $defaultBillingId, $defaultShippingId)
+    {
+        $addressId = $addressModel->getId();
+        $validAttributes = array_merge(
+            $addressModel->getDefaultAttributeCodes(),
+            [
+                Address::KEY_ID, 'region_id', Address::KEY_REGION, Address::KEY_STREET, 'vat_is_valid',
+                Address::KEY_DEFAULT_BILLING, Address::KEY_DEFAULT_SHIPPING, 'vat_request_id', 'vat_request_date',
+                'vat_request_success'
+            ]
+        );
+        $addressData = [];
+        foreach ($addressModel->getAttributes() as $attribute) {
+            $code = $attribute->getAttributeCode();
+            if (!in_array($code, $validAttributes) && $addressModel->getData($code) !== null) {
+                $addressData[$code] = $addressModel->getData($code);
+            }
+        }
+
+        $this->_addressBuilder->populateWithArray(array_merge($addressData, [
+            Address::KEY_STREET => $addressModel->getStreet(),
+            Address::KEY_ID => $addressId,
+            Address::KEY_DEFAULT_BILLING => $addressId === $defaultBillingId,
+            Address::KEY_DEFAULT_SHIPPING => $addressId === $defaultShippingId,
+            Address::KEY_CUSTOMER_ID => $addressModel->getCustomerId(),
+            Address::KEY_REGION => [
+                Region::KEY_REGION => $addressModel->getRegion(),
+                Region::KEY_REGION_ID => $addressModel->getRegionId(),
+                Region::KEY_REGION_CODE => $addressModel->getRegionCode()
+            ]
+        ]));
+
+        $addressDto = $this->_addressBuilder->create();
+        return $addressDto;
+    }
+}
diff --git a/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php b/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php
index cf9ec68684b..9329c765dee 100644
--- a/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php
+++ b/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php
@@ -39,8 +39,8 @@ class Street extends \Magento\Core\Model\Config\Value
     protected $_eavConfig;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Eav\Model\Config $eavConfig
@@ -49,8 +49,8 @@ class Street extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Eav\Model\Config $eavConfig,
diff --git a/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php b/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php
index e4d05453b94..fae6b81a16a 100644
--- a/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php
+++ b/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php
@@ -41,8 +41,8 @@ class Customer extends \Magento\Core\Model\Config\Value
     protected $_eavConfig;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Eav\Model\Config $eavConfig
@@ -51,8 +51,8 @@ class Customer extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Eav\Model\Config $eavConfig,
diff --git a/app/code/Magento/Customer/Model/Config/Share.php b/app/code/Magento/Customer/Model/Config/Share.php
index c4f768c5e4f..8afa2d37314 100644
--- a/app/code/Magento/Customer/Model/Config/Share.php
+++ b/app/code/Magento/Customer/Model/Config/Share.php
@@ -34,14 +34,14 @@
 namespace Magento\Customer\Model\Config;
 
 class Share extends \Magento\Core\Model\Config\Value
-    implements \Magento\Core\Model\Option\ArrayInterface
+    implements \Magento\Option\ArrayInterface
 {
     /**
      * Xml config path to customers sharing scope value
      *
      */
     const XML_PATH_CUSTOMER_ACCOUNT_SHARE = 'customer/account_share/scope';
-    
+
     /**
      * Possible customer sharing scopes
      *
@@ -64,8 +64,8 @@ class Share extends \Magento\Core\Model\Config\Value
     /**
      * Constructor
      *
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
@@ -75,8 +75,8 @@ class Share extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
diff --git a/app/code/Magento/Customer/Model/Config/Source/Address/Type.php b/app/code/Magento/Customer/Model/Config/Source/Address/Type.php
index 5b4b1d02a9f..18a12bae306 100644
--- a/app/code/Magento/Customer/Model/Config/Source/Address/Type.php
+++ b/app/code/Magento/Customer/Model/Config/Source/Address/Type.php
@@ -33,7 +33,7 @@
  */
 namespace Magento\Customer\Model\Config\Source\Address;
 
-class Type implements \Magento\Core\Model\Option\ArrayInterface
+class Type implements \Magento\Option\ArrayInterface
 {
     /**
      * Retrieve possible customer address types
diff --git a/app/code/Magento/Customer/Model/Config/Source/Group.php b/app/code/Magento/Customer/Model/Config/Source/Group.php
index f8eaeeb2bc1..4e95a0604bc 100644
--- a/app/code/Magento/Customer/Model/Config/Source/Group.php
+++ b/app/code/Magento/Customer/Model/Config/Source/Group.php
@@ -27,7 +27,7 @@
 
 namespace Magento\Customer\Model\Config\Source;
 
-class Group implements \Magento\Core\Model\Option\ArrayInterface
+class Group implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Customer/Model/Config/Source/Group/Multiselect.php b/app/code/Magento/Customer/Model/Config/Source/Group/Multiselect.php
index a5fd1261d3a..082661da17e 100644
--- a/app/code/Magento/Customer/Model/Config/Source/Group/Multiselect.php
+++ b/app/code/Magento/Customer/Model/Config/Source/Group/Multiselect.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Customer\Model\Config\Source\Group;
 
-class Multiselect implements \Magento\Core\Model\Option\ArrayInterface
+class Multiselect implements \Magento\Option\ArrayInterface
 {
     /**
      * Customer groups options array
diff --git a/app/code/Magento/Customer/Model/Converter.php b/app/code/Magento/Customer/Model/Converter.php
index 88c8efd7504..e9fe9bbf705 100644
--- a/app/code/Magento/Customer/Model/Converter.php
+++ b/app/code/Magento/Customer/Model/Converter.php
@@ -74,6 +74,8 @@ class Converter
 
 
     /**
+     * Retrieve customer model by his ID.
+     *
      * @param int $customerId
      * @throws NoSuchEntityException If customer with customerId is not found.
      * @return Customer
@@ -90,6 +92,27 @@ class Converter
         }
     }
 
+    /**
+     * Retrieve customer model by his email.
+     *
+     * @param string $customerEmail
+     * @param int $websiteId
+     * @throws NoSuchEntityException If customer with the specified customer email not found.
+     * @return Customer
+     */
+    public function getCustomerModelByEmail($customerEmail, $websiteId = null)
+    {
+        $customer = $this->_customerFactory->create();
+        if (isset($websiteId)) {
+            $customer->setWebsiteId($websiteId);
+        }
+        $customer->loadByEmail($customerEmail);
+        if (!$customer->getId()) {
+            throw new NoSuchEntityException('email', $customerEmail);
+        } else {
+            return $customer;
+        }
+    }
 
     /**
      * Creates a customer model from a customer entity.
@@ -118,13 +141,37 @@ class Converter
 
         // Need to use attribute set or future updates can cause data loss
         if (!$customerModel->getAttributeSetId()) {
-            $customerModel->setAttributeSetId(CustomerMetadataServiceInterface::CUSTOMER_ATTRIBUTE_SET_ID);
-            return $customerModel;
+            $customerModel->setAttributeSetId(CustomerMetadataServiceInterface::ATTRIBUTE_SET_ID_CUSTOMER);
         }
 
         return $customerModel;
     }
 
+    /**
+     * Update customer model with the data from the data object
+     *
+     * @param Customer $customerModel
+     * @param \Magento\Customer\Service\V1\Dto\Customer $customerData
+     * @return void
+     */
+    public function updateCustomerModel(
+        \Magento\Customer\Model\Customer $customerModel,
+        \Magento\Customer\Service\V1\Dto\Customer $customerData
+    ) {
+        $attributes = $customerData->__toArray();
+        foreach ($attributes as $attributeCode => $attributeValue) {
+            $customerModel->setDataUsingMethod($attributeCode, $attributeValue);
+        }
+        $customerId = $customerData->getCustomerId();
+        if ($customerId) {
+            $customerModel->setId($customerId);
+        }
+        // Need to use attribute set or future calls to customerModel::save can cause data loss
+        if (!$customerModel->getAttributeSetId()) {
+            $customerModel->setAttributeSetId(CustomerMetadataServiceInterface::ATTRIBUTE_SET_ID_CUSTOMER);
+        }
+    }
+
     /**
      * Loads the values from a customer model
      *
@@ -134,13 +181,18 @@ class Converter
     protected function _populateBuilderWithAttributes(Customer $customerModel)
     {
         $attributes = [];
+        $systemAttributes = ['entity_type_id', 'attribute_set_id'];
         foreach ($customerModel->getAttributes() as $attribute) {
             $attrCode = $attribute->getAttributeCode();
-            $value = $customerModel->getData($attrCode);
-            if (null == $value) {
+            $value = $customerModel->getDataUsingMethod($attrCode);
+            if (null === $value || in_array($attrCode, $systemAttributes)) {
                 continue;
             }
-            $attributes[$attrCode] = $value;
+            if ($attrCode == 'entity_id') {
+                $attributes[\Magento\Customer\Service\V1\Dto\Customer::ID] = $value;
+            } else {
+                $attributes[$attrCode] = $value;
+            }
         }
 
         return $this->_customerBuilder->populateWithArray($attributes);
diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php
index 24c9746daa6..734c868614d 100644
--- a/app/code/Magento/Customer/Model/Customer.php
+++ b/app/code/Magento/Customer/Model/Customer.php
@@ -26,6 +26,8 @@
 
 namespace Magento\Customer\Model;
 
+use Magento\Customer\Service\V1\Dto\CustomerBuilder as CustomerDtoBuilder;
+
 /**
  * Customer model
  *
@@ -37,6 +39,8 @@ namespace Magento\Customer\Model;
  * @method mixed getDisableAutoGroupChange()
  * @method \Magento\Customer\Model\Customer setDisableAutoGroupChange($value)
  * @method \Magento\Customer\Model\Customer setGroupId($value)
+ * @method \Magento\Customer\Model\Customer setDefaultBilling($value)
+ * @method \Magento\Customer\Model\Customer setDefaultShipping($value)
  */
 class Customer extends \Magento\Core\Model\AbstractModel
 {
@@ -51,7 +55,6 @@ class Customer extends \Magento\Core\Model\AbstractModel
 
     const XML_PATH_RESET_PASSWORD_TEMPLATE = 'customer/password/reset_password_template';
 
-    const XML_PATH_DEFAULT_EMAIL_DOMAIN         = 'customer/create_account/email_domain';
     const XML_PATH_IS_CONFIRM                   = 'customer/create_account/confirm';
     const XML_PATH_CONFIRM_EMAIL_TEMPLATE       = 'customer/create_account/email_confirmation_template';
     const XML_PATH_CONFIRMED_EMAIL_TEMPLATE     = 'customer/create_account/email_confirmed_template';
@@ -119,9 +122,6 @@ class Customer extends \Magento\Core\Model\AbstractModel
      */
     protected $_isReadonly = false;
 
-    /** @var \Magento\Email\Model\Sender */
-    protected $_sender;
-
     /** @var \Magento\Core\Model\StoreManagerInterface */
     protected $_storeManager;
 
@@ -156,14 +156,9 @@ class Customer extends \Magento\Core\Model\AbstractModel
     protected $_addressesFactory;
 
     /**
-     * @var \Magento\Email\Model\Template\MailerFactory
-     */
-    protected $_mailerFactory;
-
-    /**
-     * @var \Magento\Email\Model\InfoFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_emailInfoFactory;
+    protected $_transportBuilder;
 
     /**
      * @var \Magento\Customer\Model\AttributeFactory
@@ -191,10 +186,14 @@ class Customer extends \Magento\Core\Model\AbstractModel
     protected $dateTime;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @var CustomerDtoBuilder
+     */
+    protected $_customerDtoBuilder;
+
+    /**
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Customer\Helper\Data $customerData
-     * @param \Magento\Email\Model\Sender $sender
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Eav\Model\Config $config
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
@@ -202,21 +201,20 @@ class Customer extends \Magento\Core\Model\AbstractModel
      * @param Config\Share $configShare
      * @param AddressFactory $addressFactory
      * @param Resource\Address\CollectionFactory $addressesFactory
-     * @param \Magento\Email\Model\Template\MailerFactory $mailerFactory
-     * @param \Magento\Email\Model\InfoFactory $emailInfoFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService
      * @param AttributeFactory $attributeFactory
      * @param \Magento\Encryption\EncryptorInterface $encryptor
      * @param \Magento\Math\Random $mathRandom
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Data\Collection\Db $resourceCollection
+     * @param CustomerDtoBuilder $customerDtoBuilder
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Customer\Helper\Data $customerData,
-        \Magento\Email\Model\Sender $sender,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Eav\Model\Config $config,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
@@ -224,31 +222,30 @@ class Customer extends \Magento\Core\Model\AbstractModel
         \Magento\Customer\Model\Config\Share $configShare,
         \Magento\Customer\Model\AddressFactory $addressFactory,
         \Magento\Customer\Model\Resource\Address\CollectionFactory $addressesFactory,
-        \Magento\Email\Model\Template\MailerFactory $mailerFactory,
-        \Magento\Email\Model\InfoFactory $emailInfoFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService,
         \Magento\Customer\Model\AttributeFactory $attributeFactory,
         \Magento\Encryption\EncryptorInterface $encryptor,
         \Magento\Math\Random $mathRandom,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Data\Collection\Db $resourceCollection = null,
+        CustomerDtoBuilder $customerDtoBuilder,
         array $data = array()
     ) {
         $this->_customerData = $customerData;
         $this->_coreStoreConfig = $coreStoreConfig;
-        $this->_sender = $sender;
         $this->_storeManager = $storeManager;
         $this->_config = $config;
         $this->_configShare = $configShare;
         $this->_addressFactory = $addressFactory;
         $this->_addressesFactory = $addressesFactory;
-        $this->_mailerFactory = $mailerFactory;
-        $this->_emailInfoFactory = $emailInfoFactory;
+        $this->_transportBuilder = $transportBuilder;
         $this->_groupService = $groupService;
         $this->_attributeFactory = $attributeFactory;
         $this->_encryptor = $encryptor;
         $this->mathRandom = $mathRandom;
         $this->dateTime = $dateTime;
+        $this->_customerDtoBuilder = $customerDtoBuilder;
         parent::__construct($context, $registry, $resource, $resourceCollection, $data);
     }
 
@@ -330,6 +327,24 @@ class Customer extends \Magento\Core\Model\AbstractModel
         return $this;
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    protected function _afterSave()
+    {
+        $customerData = (array)$this->getData();
+        $customerData[\Magento\Customer\Service\V1\Dto\Customer::ID] = $this->getId();
+        $dataDto = $this->_customerDtoBuilder->populateWithArray($customerData)->create();
+        $customerOrigData = (array)$this->getOrigData();
+        $customerOrigData[\Magento\Customer\Service\V1\Dto\Customer::ID] = $this->getId();
+        $origDataDto = $this->_customerDtoBuilder->populateWithArray($customerOrigData)->create();
+        $this->_eventManager->dispatch(
+            'customer_save_after_dto',
+            array('customer_dto' => $dataDto, 'orig_customer_dto' => $origDataDto)
+        );
+        return parent::_afterSave();
+    }
+
     /**
      * Change customer password
      *
@@ -694,7 +709,7 @@ class Customer extends \Magento\Core\Model\AbstractModel
         }
 
         $this->_sendEmailTemplate($types[$type], self::XML_PATH_REGISTER_EMAIL_IDENTITY,
-            array('customer' => $this, 'back_url' => $backUrl), $storeId);
+            array('customer' => $this, 'back_url' => $backUrl, 'store' => $this->getStore()), $storeId);
 
         return $this;
     }
@@ -732,7 +747,7 @@ class Customer extends \Magento\Core\Model\AbstractModel
     public function sendPasswordReminderEmail()
     {
         $this->_sendEmailTemplate(self::XML_PATH_REMIND_EMAIL_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY,
-            array('customer' => $this), $this->getStoreId());
+            array('customer' => $this, 'store' => $this->getStore()), $this->getStoreId());
 
         return $this;
     }
@@ -748,18 +763,19 @@ class Customer extends \Magento\Core\Model\AbstractModel
      */
     protected function _sendEmailTemplate($template, $sender, $templateParams = array(), $storeId = null)
     {
-        /** @var $mailer \Magento\Email\Model\Template\Mailer */
-        $mailer = $this->_createMailer();
-        $emailInfo = $this->_createEmailInfo();
-        $emailInfo->addTo($this->getEmail(), $this->getName());
-        $mailer->addEmailInfo($emailInfo);
-
-        // Set all required params and send emails
-        $mailer->setSender($this->_coreStoreConfig->getConfig($sender, $storeId));
-        $mailer->setStoreId($storeId);
-        $mailer->setTemplateId($this->_coreStoreConfig->getConfig($template, $storeId));
-        $mailer->setTemplateParams($templateParams);
-        $mailer->send();
+        /** @var \Magento\Mail\TransportInterface $transport */
+        $transport =  $this->_transportBuilder
+            ->setTemplateIdentifier($this->_coreStoreConfig->getConfig($template, $storeId))
+            ->setTemplateOptions(array(
+                'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                'store' => $storeId
+            ))
+            ->setTemplateVars($templateParams)
+            ->setFrom($this->_coreStoreConfig->getConfig($sender, $storeId))
+            ->addTo($this->getEmail(), $this->getName())
+            ->getTransport();
+        $transport->sendMessage();
+
         return $this;
     }
 
@@ -776,7 +792,7 @@ class Customer extends \Magento\Core\Model\AbstractModel
         }
 
         $this->_sendEmailTemplate(self::XML_PATH_FORGOT_EMAIL_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY,
-            array('customer' => $this), $storeId
+            array('customer' => $this, 'store' => $this->getStore()), $storeId
         );
 
         return $this;
@@ -794,14 +810,21 @@ class Customer extends \Magento\Core\Model\AbstractModel
             $storeId = $this->_getWebsiteStoreId();
         }
 
-        $this->_sender->send(
-            $this->getEmail(),
-            $this->getName(),
-            self::XML_PATH_RESET_PASSWORD_TEMPLATE,
-            self::XML_PATH_FORGOT_EMAIL_IDENTITY,
-            array('customer' => $this),
-            $storeId
-        );
+        /** @var \Magento\Mail\TransportInterface $transport */
+        $transport =  $this->_transportBuilder
+            ->setTemplateIdentifier(
+                $this->_coreStoreConfig->getConfig(self::XML_PATH_RESET_PASSWORD_TEMPLATE, $storeId)
+            )
+            ->setTemplateOptions(array(
+                'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                'store' => $storeId
+            ))
+            ->setTemplateVars(array('customer' => $this, 'store' => $this->getStore()))
+            ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_FORGOT_EMAIL_IDENTITY, $storeId))
+            ->addTo($this->getEmail(), $this->getName())
+            ->getTransport();
+        $transport->sendMessage();
+
         return $this;
     }
 
@@ -834,24 +857,6 @@ class Customer extends \Magento\Core\Model\AbstractModel
         return $this->getData('tax_class_id');
     }
 
-    /**
-     * Check store availability for customer
-     *
-     * @param   \Magento\Core\Model\Store | int $store
-     * @return  bool
-     */
-    public function isInStore($store)
-    {
-        if ($store instanceof \Magento\Core\Model\Store) {
-            $storeId = $store->getId();
-        } else {
-            $storeId = $store;
-        }
-
-        $availableStores = $this->getSharedStoreIds();
-        return in_array($storeId, $availableStores);
-    }
-
     /**
      * Retrieve store where customer was created
      *
@@ -865,6 +870,7 @@ class Customer extends \Magento\Core\Model\AbstractModel
     /**
      * Retrieve shared store ids
      *
+     * @deprecated Use \Magento\Customer\Helper\Data::getSharedStoreIds
      * @return array
      */
     public function getSharedStoreIds()
@@ -1024,7 +1030,8 @@ class Customer extends \Magento\Core\Model\AbstractModel
      */
     protected function _beforeDelete()
     {
-        $this->_protectFromNonAdmin();
+        //TODO : Revisit and figure handling permissions in MAGETWO-11084 Implementation: Service Context Provider
+        //$this->_protectFromNonAdmin();
         return parent::_beforeDelete();
     }
 
@@ -1234,22 +1241,6 @@ class Customer extends \Magento\Core\Model\AbstractModel
         return $this->_addressesFactory->create();
     }
 
-    /**
-     * @return \Magento\Email\Model\Template\Mailer
-     */
-    protected function _createMailer()
-    {
-        return $this->_mailerFactory->create();
-    }
-
-    /**
-     * @return \Magento\Email\Model\Info
-     */
-    protected function _createEmailInfo()
-    {
-        return $this->_emailInfoFactory->create();
-    }
-
     /**
      * @return \Magento\Customer\Model\Attribute
      */
diff --git a/app/code/Magento/Customer/Model/Group.php b/app/code/Magento/Customer/Model/Group.php
index 07096fd3258..e7b33e5386d 100644
--- a/app/code/Magento/Customer/Model/Group.php
+++ b/app/code/Magento/Customer/Model/Group.php
@@ -84,8 +84,8 @@ class Group extends \Magento\Core\Model\AbstractModel
     /**
      * Constructor
      *
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Store\Config $storeConfig
      * @param \Magento\Index\Model\Indexer $indexer
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -93,8 +93,8 @@ class Group extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Store\Config $storeConfig,
         \Magento\Index\Model\Indexer $indexer,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Customer/Model/Metadata/Form.php b/app/code/Magento/Customer/Model/Metadata/Form.php
index 2c43148081f..a90aac16238 100644
--- a/app/code/Magento/Customer/Model/Metadata/Form.php
+++ b/app/code/Magento/Customer/Model/Metadata/Form.php
@@ -28,6 +28,13 @@ namespace Magento\Customer\Model\Metadata;
 
 class Form
 {
+    /**#@+
+     * Values for ignoreInvisible parameter in constructor
+     */
+    const IGNORE_INVISIBLE = true;
+    const DONT_IGNORE_INVISIBLE = false;
+    /**#@-*/
+
     /**
      * @var \Magento\Customer\Service\V1\CustomerMetadataServiceInterface
      */
@@ -117,7 +124,7 @@ class Form
         $entityType,
         $formCode,
         array $attributeValues = [],
-        $ignoreInvisible = true,
+        $ignoreInvisible = self::IGNORE_INVISIBLE,
         $filterAttributes = [],
         $isAjax = false
     )  {
@@ -252,7 +259,7 @@ class Form
             if (!isset($data[$attribute->getAttributeCode()])) {
                 $data[$attribute->getAttributeCode()] = false;
             }
-            $dataModel->restoreValue($data[$attribute->getAttributeCode()]);
+            $data[$attribute->getAttributeCode()] = $dataModel->restoreValue($data[$attribute->getAttributeCode()]);
         }
         return $data;
     }
@@ -334,7 +341,7 @@ class Form
     public function validateData(array $data)
     {
         $validator = $this->_getValidator($data);
-        if (!$validator->isValid(false)) {
+        if (!$validator->isValid($this->_attributeValues)) {
             $messages = array();
             foreach ($validator->getMessages() as $errorMessages) {
                 $messages = array_merge($messages, (array)$errorMessages);
diff --git a/app/code/Magento/Customer/Model/Metadata/Form/Text.php b/app/code/Magento/Customer/Model/Metadata/Form/Text.php
index 4322fbfb29d..e12387dbda6 100644
--- a/app/code/Magento/Customer/Model/Metadata/Form/Text.php
+++ b/app/code/Magento/Customer/Model/Metadata/Form/Text.php
@@ -28,7 +28,7 @@ namespace Magento\Customer\Model\Metadata\Form;
 class Text extends AbstractData
 {
     /**
-     * @var \Magento\Core\Helper\String
+     * @var \Magento\Stdlib\String
      */
     protected $_string;
 
diff --git a/app/code/Magento/Customer/Model/Metadata/FormFactory.php b/app/code/Magento/Customer/Model/Metadata/FormFactory.php
index c720627859b..7550fd21d96 100644
--- a/app/code/Magento/Customer/Model/Metadata/FormFactory.php
+++ b/app/code/Magento/Customer/Model/Metadata/FormFactory.php
@@ -47,19 +47,25 @@ class FormFactory
      * @param string $entityType
      * @param string $formCode
      * @param array $attributeValues
+     * @param bool $ignoreInvisible
+     * @param array $filterAttributes
      * @param bool $isAjax
      * @return \Magento\Customer\Model\Metadata\Form
      */
     public function create(
         $entityType,
         $formCode,
-        $attributeValues = [],
+        array $attributeValues = [],
+        $ignoreInvisible = Form::IGNORE_INVISIBLE,
+        $filterAttributes = [],
         $isAjax = false
     ) {
         $params = [
             'entityType' => $entityType,
             'formCode' => $formCode,
             'attributeValues' => $attributeValues,
+            'ignoreInvisible' => $ignoreInvisible,
+            'filterAttributes' => $filterAttributes,
             'isAjax' => $isAjax,
         ];
         return $this->_objectManager->create('Magento\Customer\Model\Metadata\Form', $params);
diff --git a/app/code/Magento/Customer/Model/Metadata/Validator.php b/app/code/Magento/Customer/Model/Metadata/Validator.php
index 0fab0b4422e..bcc4ca8446e 100644
--- a/app/code/Magento/Customer/Model/Metadata/Validator.php
+++ b/app/code/Magento/Customer/Model/Metadata/Validator.php
@@ -34,6 +34,11 @@ class Validator extends \Magento\Eav\Model\Validator\Attribute\Data
      */
     protected $_entityType;
 
+    /**
+     * @var array
+     */
+    protected $_entityData;
+
     /**
      * @param ElementFactory $attrDataFactory
      */
@@ -45,18 +50,17 @@ class Validator extends \Magento\Eav\Model\Validator\Attribute\Data
     /**
      * Validate EAV model attributes with data models
      *
-     * @param \Magento\Core\Model\AbstractModel $entity
+     * @param \Magento\Object|array $entityData Data set from the Model attributes
      * @return bool
      */
-    public function isValid($entity)
+    public function isValid($entityData)
     {
-        $data = array();
-        if ($this->_data) {
-            $data = $this->_data;
-        } elseif ($entity instanceof \Magento\Object) {
-            $data = $entity->getData();
+        if ($entityData instanceof \Magento\Object) {
+            $this->_entityData = $entityData->getData();
+        } else {
+            $this->_entityData = $entityData;
         }
-        return $this->validateData($data, $this->_attributes, $this->_entityType);
+        return $this->validateData($this->_data, $this->_attributes, $this->_entityType);
     }
 
     /**
@@ -76,10 +80,13 @@ class Validator extends \Magento\Eav\Model\Validator\Attribute\Data
                 $data[$attributeCode] = null;
             }
             $dataModel = $this->_attrDataFactory->create(
-                $attribute, $entityType, $data[$attributeCode]
+                $attribute, $data[$attributeCode], $entityType
             );
             $dataModel->setExtractedData($data);
-            $result = $dataModel->validateValue($data[$attributeCode]);
+            $value = empty($data[$attributeCode]) && isset($this->_entityData[$attributeCode])
+                ? $this->_entityData[$attributeCode]
+                : $data[$attributeCode];
+            $result = $dataModel->validateValue($value);
             if (true !== $result) {
                 $this->_addErrorMessages($attributeCode, (array)$result);
             }
diff --git a/app/code/Magento/Customer/Model/Observer.php b/app/code/Magento/Customer/Model/Observer.php
index da20618c405..10f638f2b82 100644
--- a/app/code/Magento/Customer/Model/Observer.php
+++ b/app/code/Magento/Customer/Model/Observer.php
@@ -51,7 +51,7 @@ class Observer
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -65,12 +65,12 @@ class Observer
     /**
      * @param \Magento\Customer\Helper\Data $customerData
      * @param \Magento\Customer\Helper\Address $customerAddress
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Customer\Helper\Data $customerData,
         \Magento\Customer\Helper\Address $customerAddress,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_customerData = $customerData;
         $this->_customerAddress = $customerAddress;
diff --git a/app/code/Magento/Customer/Model/Resource/Customer/CustomersTypeOptions.php b/app/code/Magento/Customer/Model/Resource/Customer/CustomersTypeOptions.php
index d057937fc38..586a12dda0b 100644
--- a/app/code/Magento/Customer/Model/Resource/Customer/CustomersTypeOptions.php
+++ b/app/code/Magento/Customer/Model/Resource/Customer/CustomersTypeOptions.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Customer\Model\Resource\Customer;
 
-class CustomersTypeOptions implements \Magento\Core\Model\Option\ArrayInterface
+class CustomersTypeOptions implements \Magento\Option\ArrayInterface
 {
     /**
      * Return statuses option array
diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php
index c3ff8c4eca0..69368520205 100644
--- a/app/code/Magento/Customer/Model/Session.php
+++ b/app/code/Magento/Customer/Model/Session.php
@@ -110,6 +110,17 @@ class Session extends \Magento\Session\SessionManager
      * @var \Magento\App\ResponseInterface
      */
     protected $response;
+
+    /**
+     * @var \Magento\Customer\Service\V1\Dto\Customer
+     */
+    protected $_customerDataObject;
+
+    /**
+     * @var \Magento\Customer\Model\Converter
+     */
+    protected $_converter;
+
     /**
      * @param \Magento\App\RequestInterface $request
      * @param \Magento\Session\SidResolverInterface $sidResolver
@@ -126,6 +137,8 @@ class Session extends \Magento\Session\SessionManager
      * @param \Magento\Core\Model\Session $session
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
+     * @param \Magento\Customer\Model\Converter $converter
+     * @param \Magento\App\ResponseInterface $response
      * @param \Magento\Customer\Service\V1\CustomerServiceInterface $customerService
      * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService
      * @param null $sessionName
@@ -147,6 +160,7 @@ class Session extends \Magento\Session\SessionManager
         \Magento\Core\Model\Session $session,
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
+        \Magento\Customer\Model\Converter $converter,
         \Magento\App\ResponseInterface $response,
         \Magento\Customer\Service\V1\CustomerServiceInterface $customerService,
         \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService,
@@ -167,6 +181,7 @@ class Session extends \Magento\Session\SessionManager
         $this->response = $response;
         parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage);
         $this->start($sessionName);
+        $this->_converter = $converter;
         $this->_eventManager->dispatch('customer_session_init', array('customer_session' => $this));
     }
 
@@ -189,12 +204,8 @@ class Session extends \Magento\Session\SessionManager
     public function setCustomerDto(CustomerDto $customer)
     {
         $this->_customer = $customer;
-        if ($customer === null) {
-            $this->setCustomerId(null);
-        } else {
-            $this->response->setVary('customer_group', $customer->getGroupId());
-            $this->setCustomerId($customer->getCustomerId());
-        }
+        $this->response->setVary('customer_group', $customer->getGroupId());
+        $this->setCustomerId($customer->getCustomerId());
         return $this;
     }
 
@@ -218,6 +229,30 @@ class Session extends \Magento\Session\SessionManager
         return $this->_customer;
     }
 
+    /**
+     * Returns Customer data object with the customer information
+     *
+     * @return \Magento\Customer\Service\V1\Dto\Customer
+     */
+    public function getCustomerData()
+    {
+        /* TODO refactor this after all usages of the setCustomer is refactored */
+        return $this->_converter->createCustomerFromModel($this->getCustomer());
+    }
+
+    /**
+     * Set Customer data object with the customer information
+     *
+     * @param \Magento\Customer\Service\V1\Dto\Customer $customerData
+     * @return $this
+     */
+    public function setCustomerData(\Magento\Customer\Service\V1\Dto\Customer $customerData)
+    {
+        $this->setId($customerData->getCustomerId());
+        $this->_converter->updateCustomerModel($this->getCustomer(), $customerData);
+        return $this;
+    }
+
 
     /**
      * Set customer model and the customer id in session
@@ -228,16 +263,12 @@ class Session extends \Magento\Session\SessionManager
     public function setCustomer(Customer $customerModel)
     {
         $this->_customerModel = $customerModel;
-        if ($customerModel === null) {
-            $this->setCustomerId(null);
-        } else {
-            $this->response->setVary('customer_group', $customerModel->getGroupId());
-            $this->setCustomerId($customerModel->getId());
-            if ((!$customerModel->isConfirmationRequired()) && $customerModel->getConfirmation()) {
-                $customerModel->setConfirmation(null)->save();
-            }
+        $this->response->setVary('customer_group', $customerModel->getGroupId());
+        $this->setCustomerId($customerModel->getId());
+        if ((!$customerModel->isConfirmationRequired()) && $customerModel->getConfirmation()) {
+            $customerModel->setConfirmation(null)->save();
         }
-        
+
         return $this;
     }
 
diff --git a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php
index c813684461a..6bc313c8449 100644
--- a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php
+++ b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php
@@ -86,6 +86,9 @@ class CustomerAccountService implements CustomerAccountServiceInterface
      */
     private $_customerAddressService;
 
+    /** @var \Magento\ObjectManager */
+    protected $_objectManager;
+
     /**
      * Constructor
      *
@@ -98,6 +101,9 @@ class CustomerAccountService implements CustomerAccountServiceInterface
      * @param Dto\Response\CreateCustomerAccountResponseBuilder $createCustomerAccountResponseBuilder
      * @param CustomerServiceInterface $customerService
      * @param CustomerAddressServiceInterface $customerAddressService
+     * @param \Magento\ObjectManager $objectManager
+     *
+     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         CustomerFactory $customerFactory,
@@ -108,7 +114,8 @@ class CustomerAccountService implements CustomerAccountServiceInterface
         Validator $validator,
         Dto\Response\CreateCustomerAccountResponseBuilder $createCustomerAccountResponseBuilder,
         CustomerServiceInterface $customerService,
-        CustomerAddressServiceInterface $customerAddressService
+        CustomerAddressServiceInterface $customerAddressService,
+        \Magento\ObjectManager $objectManager
     ) {
         $this->_customerFactory = $customerFactory;
         $this->_eventManager = $eventManager;
@@ -119,6 +126,7 @@ class CustomerAccountService implements CustomerAccountServiceInterface
         $this->_createCustomerAccountResponseBuilder = $createCustomerAccountResponseBuilder;
         $this->_customerService = $customerService;
         $this->_customerAddressService = $customerAddressService;
+        $this->_objectManager = $objectManager;
     }
 
 
@@ -243,7 +251,10 @@ class CustomerAccountService implements CustomerAccountServiceInterface
         $customerId = $customer->getCustomerId();
         if ($customerId) {
             $customerModel = $this->_converter->getCustomerModel($customerId);
-            if ($customerModel->isInStore($storeId)) {
+            // We can't pass it through DI because going to get circular dependency
+            /** @var \Magento\Customer\Helper\Data $customerHelper */
+            $customerHelper = $this->_objectManager->get('Magento\Customer\Helper\Data');
+            if ($customerHelper->isCustomerInStore($customerModel->getWebsiteId(), $storeId)) {
                 return $this->_createCustomerAccountResponseBuilder->setCustomerId($customerId)
                     ->setStatus('')
                     ->create();
diff --git a/app/code/Magento/Customer/Service/V1/CustomerAddressService.php b/app/code/Magento/Customer/Service/V1/CustomerAddressService.php
index cc82f53fde3..1fe7991632c 100644
--- a/app/code/Magento/Customer/Service/V1/CustomerAddressService.php
+++ b/app/code/Magento/Customer/Service/V1/CustomerAddressService.php
@@ -27,6 +27,7 @@ namespace Magento\Customer\Service\V1;
 use Magento\Customer\Model\Address as CustomerAddressModel;
 use Magento\Exception\NoSuchEntityException;
 use Magento\Exception\InputException;
+use Magento\Customer\Model\Address\Converter as AddressConverter;
 
 /**
  * Service related to Customer Address related functions
@@ -44,14 +45,9 @@ class CustomerAddressService implements CustomerAddressServiceInterface
     private $_converter;
 
     /**
-     * @var Dto\RegionBuilder
+     * @var AddressConverter
      */
-    private $_regionBuilder;
-
-    /**
-     * @var Dto\AddressBuilder
-     */
-    private $_addressBuilder;
+    private $_addressConverter;
 
     /**
      * Directory data
@@ -65,21 +61,18 @@ class CustomerAddressService implements CustomerAddressServiceInterface
      *
      * @param \Magento\Customer\Model\AddressFactory $addressFactory
      * @param \Magento\Customer\Model\Converter $converter
-     * @param Dto\RegionBuilder $regionBuilder
-     * @param Dto\AddressBuilder $addressBuilder
+     * @param AddressConverter $addressConverter
      * @param \Magento\Directory\Helper\Data $directoryData
      */
     public function __construct(
         \Magento\Customer\Model\AddressFactory $addressFactory,
         \Magento\Customer\Model\Converter $converter,
-        Dto\RegionBuilder $regionBuilder,
-        Dto\AddressBuilder $addressBuilder,
+        AddressConverter $addressConverter,
         \Magento\Directory\Helper\Data $directoryData
     ) {
         $this->_addressFactory = $addressFactory;
         $this->_converter = $converter;
-        $this->_regionBuilder = $regionBuilder;
-        $this->_addressBuilder = $addressBuilder;
+        $this->_addressConverter = $addressConverter;
         $this->_directoryData = $directoryData;
     }
 
@@ -97,7 +90,7 @@ class CustomerAddressService implements CustomerAddressServiceInterface
         $result = array();
         /** @var $address CustomerAddressModel */
         foreach ($addresses as $address) {
-            $result[] = $this->_createAddress(
+            $result[] = $this->_addressConverter->createAddressFromModel(
                 $address,
                 $defaultBillingId,
                 $defaultShippingId
@@ -117,7 +110,7 @@ class CustomerAddressService implements CustomerAddressServiceInterface
         if ($address === false) {
             return null;
         }
-        return $this->_createAddress(
+        return $this->_addressConverter->createAddressFromModel(
             $address,
             $customer->getDefaultBilling(),
             $customer->getDefaultShipping()
@@ -135,7 +128,7 @@ class CustomerAddressService implements CustomerAddressServiceInterface
         if ($address === false) {
             return null;
         }
-        return $this->_createAddress($address,
+        return $this->_addressConverter->createAddressFromModel($address,
             $customer->getDefaultBilling(),
             $customer->getDefaultShipping()
         );
@@ -152,9 +145,10 @@ class CustomerAddressService implements CustomerAddressServiceInterface
         if (!$address->getId()) {
             throw new NoSuchEntityException('addressId', $addressId);
         }
+
         $customer = $this->_converter->getCustomerModel($address->getCustomerId());
 
-        return $this->_createAddress(
+        return $this->_addressConverter->createAddressFromModel(
             $address,
             $customer->getDefaultBilling(),
             $customer->getDefaultShipping()
@@ -195,7 +189,7 @@ class CustomerAddressService implements CustomerAddressServiceInterface
                 $addressModel = $this->_addressFactory->create();
                 $addressModel->setCustomer($customerModel);
             }
-            $this->_updateAddressModel($addressModel, $address);
+            $this->_addressConverter->updateAddressModel($addressModel, $address);
 
             $inputException = $this->_validate($addressModel, $inputException, $i);
             $addressModels[] = $addressModel;
@@ -215,97 +209,7 @@ class CustomerAddressService implements CustomerAddressServiceInterface
     }
 
     /**
-     * Updates an Address Model based on information from an Address DTO.
-     *
-     * @param CustomerAddressModel $addressModel
-     * @param Dto\Address $address
-     */
-    private function _updateAddressModel(CustomerAddressModel $addressModel, Dto\Address $address)
-    {
-        // Set all attributes
-        foreach ($address->getAttributes() as $attributeCode => $attributeData) {
-            if ('region' == $attributeCode
-                && $address->getRegion() instanceof Dto\Region
-            ) {
-                $addressModel->setData('region', $address->getRegion()->getRegion());
-                $addressModel->setData('region_code', $address->getRegion()->getRegionCode());
-                $addressModel->setData('region_id', $address->getRegion()->getRegionId());
-            } else {
-                $addressModel->setData($attributeCode, $attributeData);
-            }
-        }
-        // Set customer related data
-        $isBilling = $address->isDefaultBilling();
-        $addressModel->setIsDefaultBilling($isBilling);
-        $addressModel->setIsDefaultShipping($address->isDefaultShipping());
-        // Need to use attribute set or future updates can cause data loss
-        if (!$addressModel->getAttributeSetId()) {
-            $addressModel->setAttributeSetId(CustomerMetadataServiceInterface::ADDRESS_ATTRIBUTE_SET_ID);
-        }
-    }
-
-    /**
-     * Create address based on model
-     *
-     * @param CustomerAddressModel $addressModel
-     * @param int                  $defaultBillingId
-     * @param int                  $defaultShippingId
-     * @return Dto\Address
-     */
-    private function _createAddress(
-        CustomerAddressModel $addressModel,
-        $defaultBillingId,
-        $defaultShippingId
-    ) {
-        $addressId = $addressModel->getId();
-        $validAttributes = array_merge(
-            $addressModel->getDefaultAttributeCodes(),
-            [
-                'id',
-                'region_id',
-                'region',
-                'street',
-                'vat_is_valid',
-                'default_billing',
-                'default_shipping',
-                //TODO: create VAT object at MAGETWO-16860
-                'vat_request_id',
-                'vat_request_date',
-                'vat_request_success'
-            ]
-        );
-        $addressData = [];
-        foreach ($addressModel->getAttributes() as $attribute) {
-            $code = $attribute->getAttributeCode();
-            if (!in_array($code, $validAttributes) && $addressModel->getData($code) !== null) {
-                $addressData[$code] = $addressModel->getData($code);
-            }
-        }
-
-        $this->_addressBuilder->populateWithArray(
-            array_merge(
-                $addressData,
-                [
-                    'street'           => $addressModel->getStreet(),
-                    'id'               => $addressId,
-                    'default_billing'  => $addressId === $defaultBillingId,
-                    'default_shipping' => $addressId === $defaultShippingId,
-                    'customer_id'      => $addressModel->getCustomerId(),
-                    'region'           => [
-                        'region_code' => $addressModel->getRegionCode(),
-                        'region' => $addressModel->getRegion(),
-                        'region_id' => $addressModel->getRegionId(),
-                    ],
-                ]
-            )
-        );
-
-        $retValue = $this->_addressBuilder->create();
-        return $retValue;
-    }
-
-    /**
-     * Validate Customer Addrresss attribute values.
+     * Validate Customer Addresses attribute values.
      *
      * @param CustomerAddressModel $customerAddressModel the model to validate
      * @param InputException       $exception            the exception to add errors to
diff --git a/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php b/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php
index 4740fa2e76f..761313ba763 100644
--- a/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php
+++ b/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php
@@ -143,40 +143,6 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface
         return $attributes;
     }
 
-    /**
-     * @inheritdoc
-     */
-    public function getCustomerAttributeMetadata($attributeCode)
-    {
-        return $this->getAttributeMetadata('customer', $attributeCode);
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function getAllCustomerAttributeMetadata()
-    {
-        return $this->getAllAttributeSetMetadata('customer', self::CUSTOMER_ATTRIBUTE_SET_ID);
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function getAddressAttributeMetadata($attributeCode)
-    {
-        return $this->getAttributeMetadata('customer_address', $attributeCode);
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function getAllAddressAttributeMetadata()
-    {
-        return $this->getAllAttributeSetMetadata('customer_address', self::ADDRESS_ATTRIBUTE_SET_ID);
-    }
-
-
-
     /**
      * Load collection with filters applied
      *
@@ -229,6 +195,39 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface
         return $this->_attributeMetadataBuilder->create();
     }
 
+    /**
+     * @inheritdoc
+     */
+    public function getCustomerAttributeMetadata($attributeCode)
+    {
+        return $this->getAttributeMetadata('customer', $attributeCode);
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function getAllCustomerAttributeMetadata()
+    {
+        return $this->getAllAttributeSetMetadata('customer', self::ATTRIBUTE_SET_ID_CUSTOMER);
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function getAddressAttributeMetadata($attributeCode)
+    {
+        return $this->getAttributeMetadata('customer_address', $attributeCode);
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function getAllAddressAttributeMetadata()
+    {
+        return $this->getAllAttributeSetMetadata('customer_address', self::ATTRIBUTE_SET_ID_ADDRESS);
+    }
+
+
     /**
      * Helper for getting access to an entity types DTO cache.
      *
diff --git a/app/code/Magento/Customer/Service/V1/CustomerMetadataServiceInterface.php b/app/code/Magento/Customer/Service/V1/CustomerMetadataServiceInterface.php
index fcbc2f37c58..32189cf3df6 100644
--- a/app/code/Magento/Customer/Service/V1/CustomerMetadataServiceInterface.php
+++ b/app/code/Magento/Customer/Service/V1/CustomerMetadataServiceInterface.php
@@ -31,8 +31,10 @@ use Magento\Exception\NoSuchEntityException;
  */
 interface CustomerMetadataServiceInterface
 {
-    const CUSTOMER_ATTRIBUTE_SET_ID = 1;
-    const ADDRESS_ATTRIBUTE_SET_ID = 2;
+    const ATTRIBUTE_SET_ID_CUSTOMER = 1;
+    const ATTRIBUTE_SET_ID_ADDRESS = 2;
+    const ENTITY_TYPE_CUSTOMER = 'customer';
+    const ENTITY_TYPE_ADDRESS = 'customer_address';
 
     /**
      * Retrieve Attribute Metadata
diff --git a/app/code/Magento/Customer/Service/V1/CustomerService.php b/app/code/Magento/Customer/Service/V1/CustomerService.php
index bd96debbe00..347fc7727df 100644
--- a/app/code/Magento/Customer/Service/V1/CustomerService.php
+++ b/app/code/Magento/Customer/Service/V1/CustomerService.php
@@ -64,7 +64,6 @@ class CustomerService implements CustomerServiceInterface
         $this->_customerMetadataService = $customerMetadataService;
     }
 
-
     /**
      * {@inheritdoc}
      */
@@ -80,6 +79,15 @@ class CustomerService implements CustomerServiceInterface
     }
 
 
+    /**
+     * {@inheritdoc}
+     */
+    public function getCustomerByEmail($customerEmail, $websiteId = null)
+    {
+        $customerModel = $this->_converter->getCustomerModelByEmail($customerEmail, $websiteId);
+        return $this->_converter->createCustomerFromModel($customerModel);
+    }
+
     /**
      * {@inheritdoc}
      */
@@ -89,6 +97,8 @@ class CustomerService implements CustomerServiceInterface
 
         if ($password) {
             $customerModel->setPassword($password);
+        } elseif (!$customerModel->getId()) {
+            $customerModel->setPassword($customerModel->generatePassword());
         }
 
         $this->_validate($customerModel);
@@ -156,4 +166,14 @@ class CustomerService implements CustomerServiceInterface
             return null;
         }
     }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function deleteCustomer($customerId)
+    {
+        $customerModel = $this->_converter->getCustomerModel($customerId);
+        $customerModel->delete();
+        unset($this->_cache[$customerModel->getId()]);
+    }
 }
diff --git a/app/code/Magento/Customer/Service/V1/CustomerServiceInterface.php b/app/code/Magento/Customer/Service/V1/CustomerServiceInterface.php
index a8683e7688f..94f80b803f2 100644
--- a/app/code/Magento/Customer/Service/V1/CustomerServiceInterface.php
+++ b/app/code/Magento/Customer/Service/V1/CustomerServiceInterface.php
@@ -52,4 +52,23 @@ interface CustomerServiceInterface
      */
     public function getCustomer($customerId);
 
+    /**
+     * Retrieve customer by his email.
+     *
+     * @param string $customerEmail
+     * @param int|null $websiteId
+     * @throws NoSuchEntityException If customer with the specified email is not found.
+     * @return Dto\Customer
+     */
+    public function getCustomerByEmail($customerEmail, $websiteId = null);
+
+    /**
+     * Delete Customer
+     *
+     * @param int $customerId
+     * @throws \Magento\Customer\Exception If something goes wrong during delete
+     * @throws NoSuchEntityException If customer with customerId is not found.
+     * @return void
+     */
+    public function deleteCustomer($customerId);
 }
diff --git a/app/code/Magento/Customer/Service/V1/Dto/Address.php b/app/code/Magento/Customer/Service/V1/Dto/Address.php
index ef93eb3c521..704447449b7 100644
--- a/app/code/Magento/Customer/Service/V1/Dto/Address.php
+++ b/app/code/Magento/Customer/Service/V1/Dto/Address.php
@@ -27,20 +27,56 @@ namespace Magento\Customer\Service\V1\Dto;
 
 class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityInterface
 {
-
+    const ADDRESS_TYPE_BILLING = 'billing';
+    const ADDRESS_TYPE_SHIPPING = 'shipping';
     const KEY_COUNTRY_ID = 'country_id';
-
-    /**
-     * @var array
-     */
-    private static $_nonAttributes = ['id', 'customer_id', 'region', 'default_billing', 'default_shipping'];
+    const KEY_DEFAULT_BILLING = 'default_billing';
+    const KEY_DEFAULT_SHIPPING = 'default_shipping';
+    const KEY_ID = 'id';
+    const KEY_CUSTOMER_ID = 'customer_id';
+    const KEY_REGION = Region::KEY_REGION;
+    const KEY_REGION_ID = Region::KEY_REGION_ID;
+    const KEY_STREET = 'street';
+    const KEY_COMPANY = 'company';
+    const KEY_TELEPHONE = 'telephone';
+    const KEY_FAX = 'fax';
+    const KEY_POSTCODE = 'postcode';
+    const KEY_CITY = 'city';
+    const KEY_FIRSTNAME = 'firstname';
+    const KEY_LASTNAME = 'lastname';
+    const KEY_MIDDLENAME = 'middlename';
+    const KEY_PREFIX = 'prefix';
+    const KEY_SUFFIX = 'suffix';
+    const KEY_VAT_ID = 'vat_id';
+
+    protected $_validAttributes = [
+        self::KEY_COUNTRY_ID,
+        self::KEY_DEFAULT_BILLING,
+        self::KEY_DEFAULT_SHIPPING,
+        self::KEY_ID,
+        self::KEY_CUSTOMER_ID,
+        self::KEY_REGION,
+        self::KEY_REGION_ID,
+        self::KEY_STREET,
+        self::KEY_COMPANY,
+        self::KEY_TELEPHONE,
+        self::KEY_FAX,
+        self::KEY_POSTCODE,
+        self::KEY_CITY,
+        self::KEY_FIRSTNAME,
+        self::KEY_LASTNAME,
+        self::KEY_MIDDLENAME,
+        self::KEY_PREFIX,
+        self::KEY_SUFFIX,
+        self::KEY_VAT_ID
+    ];
 
     /**
      * @return int|null
      */
     public function getId()
     {
-        return $this->_get('id');
+        return $this->_get(self::KEY_ID);
     }
 
     /**
@@ -48,7 +84,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function isDefaultShipping()
     {
-        return $this->_get('default_shipping');
+        return $this->_get(self::KEY_DEFAULT_SHIPPING);
     }
 
     /**
@@ -56,26 +92,24 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function isDefaultBilling()
     {
-        return $this->_get('default_billing');
+        return $this->_get(self::KEY_DEFAULT_BILLING);
     }
 
     /**
-     * @return string[]
+     * Retrieve array of all attributes, in the form of 'attribute code' => <attribute value'
+     *
+     * @return array
      */
     public function getAttributes()
     {
-        $attributes = $this->_data;
-        foreach (self::$_nonAttributes as $keyName) {
-            unset ($attributes[$keyName]);
+        $unvalidatedData = $this->__toArray();
+        $validData = [];
+        foreach ($this->_validAttributes as $attributeCode) {
+            if (isset($unvalidatedData[$attributeCode])) {
+                $validData[$attributeCode] = $unvalidatedData[$attributeCode];
+            }
         }
-
-        /** This triggers some code in _updateAddressModel in CustomerV1 Service */
-        if (!is_null($this->getRegion())) {
-            $attributes['region']['region_id'] = $this->getRegion()->getRegionId();
-            $attributes['region']['region'] = $this->getRegion()->getRegion();
-        }
-
-        return $attributes;
+        return $validData;
     }
 
     /**
@@ -85,8 +119,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
     public function getAttribute($attributeCode)
     {
         $attributes = $this->getAttributes();
-        if (isset($attributes[$attributeCode])
-            && !in_array($attributeCode, self::$_nonAttributes)) {
+        if (isset($attributes[$attributeCode])) {
             return $attributes[$attributeCode];
         }
         return null;
@@ -97,7 +130,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getRegion()
     {
-        return $this->_get('region');
+        return $this->_get(self::KEY_REGION);
     }
 
     /**
@@ -113,7 +146,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getStreet()
     {
-        return $this->_get('street');
+        return $this->_get(self::KEY_STREET);
     }
 
     /**
@@ -121,7 +154,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getCompany()
     {
-        return $this->_get('company');
+        return $this->_get(self::KEY_COMPANY);
     }
 
     /**
@@ -129,7 +162,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getTelephone()
     {
-        return $this->_get('telephone');
+        return $this->_get(self::KEY_TELEPHONE);
     }
 
     /**
@@ -137,7 +170,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getFax()
     {
-        return $this->_get('fax');
+        return $this->_get(self::KEY_FAX);
     }
 
     /**
@@ -145,7 +178,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getPostcode()
     {
-        return $this->_get('postcode');
+        return $this->_get(self::KEY_POSTCODE);
     }
 
     /**
@@ -153,7 +186,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getCity()
     {
-        return $this->_get('city');
+        return $this->_get(self::KEY_CITY);
     }
 
     /**
@@ -161,7 +194,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getFirstname()
     {
-        return $this->_get('firstname');
+        return $this->_get(self::KEY_FIRSTNAME);
     }
 
     /**
@@ -169,7 +202,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getLastname()
     {
-        return $this->_get('lastname');
+        return $this->_get(self::KEY_LASTNAME);
     }
 
     /**
@@ -177,7 +210,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getMiddlename()
     {
-        return $this->_get('middlename');
+        return $this->_get(self::KEY_MIDDLENAME);
     }
 
     /**
@@ -185,7 +218,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getPrefix()
     {
-        return $this->_get('prefix');
+        return $this->_get(self::KEY_PREFIX);
     }
 
     /**
@@ -193,7 +226,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getSuffix()
     {
-        return $this->_get('suffix');
+        return $this->_get(self::KEY_SUFFIX);
     }
 
     /**
@@ -201,7 +234,7 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getVatId()
     {
-        return $this->_get('vat_id');
+        return $this->_get(self::KEY_VAT_ID);
     }
 
     /**
@@ -209,6 +242,6 @@ class Address extends \Magento\Service\Entity\AbstractDto implements Eav\EntityI
      */
     public function getCustomerId()
     {
-        return $this->_get('customer_id');
+        return $this->_get(self::KEY_CUSTOMER_ID);
     }
 }
diff --git a/app/code/Magento/Customer/Service/V1/Dto/AddressBuilder.php b/app/code/Magento/Customer/Service/V1/Dto/AddressBuilder.php
index def7cd4dd96..5e7461cd37f 100644
--- a/app/code/Magento/Customer/Service/V1/Dto/AddressBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Dto/AddressBuilder.php
@@ -25,18 +25,26 @@
  */
 namespace Magento\Customer\Service\V1\Dto;
 
-class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
+use Magento\Service\Entity\AbstractDto;
+use Magento\Service\Entity\AbstractDtoBuilder;
+
+/**
+ * @method Address create()
+ * @method Address mergeDtoWithArray(AbstractDto $dto, array $data)
+ */
+class AddressBuilder extends AbstractDtoBuilder
 {
+    /** @var RegionBuilder */
     protected $_regionBuilder;
 
     /**
-     * @param \Magento\Customer\Service\V1\Dto\RegionBuilder $regionBuilder
+     * @param RegionBuilder $regionBuilder
      */
     public function __construct(RegionBuilder $regionBuilder)
     {
         parent::__construct();
         $this->_regionBuilder = $regionBuilder;
-        $this->_data['region'] = $regionBuilder->create();
+        $this->_data[Address::KEY_REGION] = $regionBuilder->create();
     }
 
     /**
@@ -45,7 +53,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setId($id)
     {
-        return $this->_set('id', (string)$id);
+        return $this->_set(Address::KEY_ID, $id);
     }
 
     /**
@@ -54,7 +62,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setDefaultShipping($defaultShipping)
     {
-        return $this->_set('default_shipping', (bool)$defaultShipping);
+        return $this->_set(Address::KEY_DEFAULT_SHIPPING, (bool)$defaultShipping);
     }
 
     /**
@@ -63,7 +71,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setDefaultBilling($defaultBilling)
     {
-        return $this->_set('default_billing', (bool)$defaultBilling);
+        return $this->_set(Address::KEY_DEFAULT_BILLING, (bool)$defaultBilling);
     }
 
     /**
@@ -71,8 +79,20 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function populateWithArray(array $data)
     {
-        if (isset($data['region'])) {
-            $data['region'] = new Region($data['region']);
+        if (array_key_exists(Address::KEY_REGION, $data)) {
+            if (!is_array($data[Address::KEY_REGION])) {
+                // Region data has been submitted as individual keys of Address object. Let's extract it.
+                $regionData = [];
+                foreach ([Region::KEY_REGION, Region::KEY_REGION_CODE, Region::KEY_REGION_ID] as $attrCode) {
+                    if (isset($data[$attrCode])) {
+                        $regionData[$attrCode] = $data[$attrCode];
+                    }
+                }
+            } else {
+                $regionData = $data[Address::KEY_REGION];
+            }
+
+            $data[Address::KEY_REGION] = $this->_regionBuilder->populateWithArray($regionData)->create();
         }
 
         return parent::populateWithArray($data);
@@ -84,7 +104,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setRegion(Region $region)
     {
-        return $this->_set('region', $region);
+        return $this->_set(Address::KEY_REGION, $region);
     }
 
     /**
@@ -93,7 +113,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setCountryId($countryId)
     {
-        return $this->_set('country_id', $countryId);
+        return $this->_set(Address::KEY_COUNTRY_ID, $countryId);
     }
 
     /**
@@ -102,7 +122,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setStreet($street)
     {
-        return $this->_set('street', $street);
+        return $this->_set(Address::KEY_STREET, $street);
     }
 
     /**
@@ -111,7 +131,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setCompany($company)
     {
-        return $this->_set('company', $company);
+        return $this->_set(Address::KEY_COMPANY, $company);
     }
 
     /**
@@ -120,7 +140,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setTelephone($telephone)
     {
-        return $this->_set('telephone', $telephone);
+        return $this->_set(Address::KEY_TELEPHONE, $telephone);
     }
 
     /**
@@ -129,7 +149,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setFax($fax)
     {
-        return $this->_set('fax', $fax);
+        return $this->_set(Address::KEY_FAX, $fax);
     }
 
     /**
@@ -138,7 +158,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setPostcode($postcode)
     {
-        return $this->_set('postcode', $postcode);
+        return $this->_set(Address::KEY_POSTCODE, $postcode);
     }
 
     /**
@@ -147,7 +167,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setCity($city)
     {
-        return $this->_set('city', $city);
+        return $this->_set(Address::KEY_CITY, $city);
     }
 
     /**
@@ -156,7 +176,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setFirstname($firstname)
     {
-        return $this->_set('firstname', $firstname);
+        return $this->_set(Address::KEY_FIRSTNAME, $firstname);
     }
 
     /**
@@ -165,7 +185,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setLastname($lastname)
     {
-        return $this->_set('lastname', $lastname);
+        return $this->_set(Address::KEY_LASTNAME, $lastname);
     }
 
     /**
@@ -174,7 +194,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setMiddlename($middlename)
     {
-        return $this->_set('middlename', $middlename);
+        return $this->_set(Address::KEY_MIDDLENAME, $middlename);
     }
 
     /**
@@ -183,7 +203,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setPrefix($prefix)
     {
-        return $this->_set('prefix', $prefix);
+        return $this->_set(Address::KEY_PREFIX, $prefix);
     }
 
     /**
@@ -192,7 +212,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setSuffix($suffix)
     {
-        return $this->_set('suffix', $suffix);
+        return $this->_set(Address::KEY_SUFFIX, $suffix);
     }
 
     /**
@@ -201,7 +221,7 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setVatId($vatId)
     {
-        return $this->_set('vat_id', $vatId);
+        return $this->_set(Address::KEY_VAT_ID, $vatId);
     }
 
     /**
@@ -210,7 +230,6 @@ class AddressBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setCustomerId($customerId)
     {
-        /** XXX: (string) Needed for tests to pass */
-        return $this->_set('customer_id', (string)$customerId);
+        return $this->_set(Address::KEY_CUSTOMER_ID, $customerId);
     }
 }
diff --git a/app/code/Magento/Customer/Service/V1/Dto/Customer.php b/app/code/Magento/Customer/Service/V1/Dto/Customer.php
index 71030611147..d2ae734fd06 100644
--- a/app/code/Magento/Customer/Service/V1/Dto/Customer.php
+++ b/app/code/Magento/Customer/Service/V1/Dto/Customer.php
@@ -31,21 +31,10 @@ namespace Magento\Customer\Service\V1\Dto;
  */
 class Customer extends \Magento\Service\Entity\AbstractDto implements Eav\EntityInterface
 {
-
-    /**
-     * @var array  Special attribute codes which cannot be set or gotten
-     * they are used by the model but should not be exposed in the DTO
-     */
-    private static $_nonAttributes = [self::ID];
-
-    /**
-     * name of field containing entity id, used to exclude this field from list of attributes.
-     */
-    const ID = 'id';
-
-    /**
+    /**#@+
      * constants defined for keys of array, makes typos less likely
      */
+    const ID = 'id';
     const CONFIRMATION = 'confirmation';
     const CREATED_AT = 'created_at';
     const CREATED_IN = 'created_in';
@@ -63,30 +52,64 @@ class Customer extends \Magento\Service\Entity\AbstractDto implements Eav\Entity
     const WEBSITE_ID = 'website_id';
     const DEFAULT_BILLING = 'default_billing';
     const DEFAULT_SHIPPING = 'default_shipping';
+    const RP_TOKEN = 'rp_token';
+    const RP_TOKEN_CREATED_AT = 'rp_token_created_at';
+    /**#@-*/
+
+    /**
+     * A list of valid customer DTO attributes.
+     *
+     * @var string[]
+     */
+    protected $_validAttributes = [
+        self::ID,
+        self::CONFIRMATION,
+        self::CREATED_AT,
+        self::CREATED_IN,
+        self::DOB,
+        self::EMAIL,
+        self::FIRSTNAME,
+        self::GENDER,
+        self::GROUP_ID,
+        self::LASTNAME,
+        self::MIDDLENAME,
+        self::PREFIX,
+        self::STORE_ID,
+        self::SUFFIX,
+        self::TAXVAT,
+        self::WEBSITE_ID,
+        self::DEFAULT_BILLING,
+        self::DEFAULT_SHIPPING,
+        self::RP_TOKEN,
+        self::RP_TOKEN_CREATED_AT,
+    ];
 
     /**
      * Retrieve array of all attributes, in the form of 'attribute code' => 'attribute value'
      *
-     * @return array|\ArrayAccess|\string[]
+     * @return array
      */
     public function getAttributes()
     {
-        $attributes = $this->__toArray();
-        foreach (self::$_nonAttributes as $keyName) {
-            unset ($attributes[$keyName]);
+        $unvalidatedData = $this->__toArray();
+        $validData = [];
+        foreach ($this->_validAttributes as $attributeCode) {
+            if (array_key_exists($attributeCode, $unvalidatedData)) {
+                $validData[$attributeCode] = $unvalidatedData[$attributeCode];
+            }
         }
-        return $attributes;
+        return $validData;
     }
 
     /**
-     * Gets an attribute value.
+     * Get an attribute value.
      *
      * @param string $attributeCode
      * @return mixed The attribute value or null if the attribute has not been set
      */
     public function getAttribute($attributeCode)
     {
-        if (isset($this->_data[$attributeCode])) {
+        if (in_array($attributeCode, $this->_validAttributes) && isset($this->_data[$attributeCode])) {
             return $this->_data[$attributeCode];
         } else {
             return null;
@@ -234,6 +257,22 @@ class Customer extends \Magento\Service\Entity\AbstractDto implements Eav\Entity
      */
     public function getWebsiteId()
     {
-        return $this->_get(self::WEBSITE_ID, 0);
+        return (int)$this->_get(self::WEBSITE_ID);
+    }
+
+    /**
+     * @return string
+     */
+    public function getRpToken()
+    {
+        return $this->_get(self::RP_TOKEN);
+    }
+
+    /**
+     * @return string
+     */
+    public function getRpTokenCreatedAt()
+    {
+        return $this->_get(self::RP_TOKEN_CREATED_AT);
     }
 }
diff --git a/app/code/Magento/Customer/Service/V1/Dto/CustomerBuilder.php b/app/code/Magento/Customer/Service/V1/Dto/CustomerBuilder.php
index c4c1a538321..ed959d6cd80 100644
--- a/app/code/Magento/Customer/Service/V1/Dto/CustomerBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Dto/CustomerBuilder.php
@@ -21,17 +21,16 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Customer\Service\V1\Dto;
 
 /**
- * Class Customer
- * Uses array to hold data, setters return $this so they can be chained.
+ * Class Customer. Uses array to hold data, setters return $this so they can be chained.
  *
- * @package Magento\Customer\Service\V1\Dto
+ * @method Customer create() create()
  */
 class CustomerBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
 {
-
     /**
      * @param string $confirmation
      * @return CustomerBuilder
@@ -175,4 +174,22 @@ class CustomerBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
     {
         return $this->_set(Customer::WEBSITE_ID, $websiteId);
     }
+
+    /**
+     * @param string
+     * @return CustomerBuilder
+     */
+    public function getRpToken($rpToken)
+    {
+        return $this->_set(self::RP_TOKEN, $rpToken);
+    }
+
+    /**
+     * @param string
+     * @return CustomerBuilder
+     */
+    public function getRpTokenCreatedAt($rpTokenCreatedAt)
+    {
+        return $this->_set(self::RP_TOKEN_CREATED_AT, $rpTokenCreatedAt);
+    }
 }
diff --git a/app/code/Magento/Customer/Service/V1/Dto/Region.php b/app/code/Magento/Customer/Service/V1/Dto/Region.php
index 475602a5e77..e12e1ff2a7a 100644
--- a/app/code/Magento/Customer/Service/V1/Dto/Region.php
+++ b/app/code/Magento/Customer/Service/V1/Dto/Region.php
@@ -27,12 +27,20 @@ namespace Magento\Customer\Service\V1\Dto;
 
 class Region extends \Magento\Service\Entity\AbstractDto
 {
+    /**#@+
+     * Array keys
+     */
+    const KEY_REGION_CODE = 'region_code';
+    const KEY_REGION = 'region';
+    const KEY_REGION_ID = 'region_id';
+    /**#@-*/
+
     /**
      * @return string
      */
     public function getRegionCode()
     {
-        return $this->_get('region_code');
+        return $this->_get(self::KEY_REGION_CODE);
     }
 
     /**
@@ -40,7 +48,7 @@ class Region extends \Magento\Service\Entity\AbstractDto
      */
     public function getRegion()
     {
-        return $this->_get('region');
+        return $this->_get(self::KEY_REGION);
     }
 
     /**
@@ -48,6 +56,6 @@ class Region extends \Magento\Service\Entity\AbstractDto
      */
     public function getRegionId()
     {
-        return $this->_get('region_id');
+        return $this->_get(self::KEY_REGION_ID);
     }
 }
diff --git a/app/code/Magento/Customer/Service/V1/Dto/RegionBuilder.php b/app/code/Magento/Customer/Service/V1/Dto/RegionBuilder.php
index 1f1d0bbdde0..219f22606d4 100644
--- a/app/code/Magento/Customer/Service/V1/Dto/RegionBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Dto/RegionBuilder.php
@@ -33,7 +33,7 @@ class RegionBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setRegionCode($regionCode)
     {
-        $this->_data['region_code'] = $regionCode;
+        $this->_data[Region::KEY_REGION_CODE] = $regionCode;
         return $this;
     }
 
@@ -43,7 +43,7 @@ class RegionBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setRegion($regionName)
     {
-        $this->_data['region'] = $regionName;
+        $this->_data[Region::KEY_REGION] = $regionName;
         return $this;
     }
 
@@ -53,7 +53,7 @@ class RegionBuilder extends \Magento\Service\Entity\AbstractDtoBuilder
      */
     public function setRegionId($regionId)
     {
-        $this->_data['region_id'] = $regionId;
+        $this->_data[Region::KEY_REGION_ID] = $regionId;
         return $this;
     }
 }
diff --git a/app/code/Magento/Customer/etc/module.xml b/app/code/Magento/Customer/etc/module.xml
index 46d7f44c09a..01dff43e732 100755
--- a/app/code/Magento/Customer/etc/module.xml
+++ b/app/code/Magento/Customer/etc/module.xml
@@ -44,7 +44,6 @@
             <module name="Magento_Backend"/>
             <module name="Magento_Review"/>
             <module name="Magento_Tax"/>
-            <module name="Magento_Email"/>
             <module name="Magento_Service"/>
         </depends>
     </module>
diff --git a/app/code/Magento/Customer/i18n/de_DE.csv b/app/code/Magento/Customer/i18n/de_DE.csv
index 10f2e87e88a..344eac5c4de 100644
--- a/app/code/Magento/Customer/i18n/de_DE.csv
+++ b/app/code/Magento/Customer/i18n/de_DE.csv
@@ -283,7 +283,7 @@
 "Please enter the telephone number.","Bitte geben Sie die Telefonnummer ein."
 "Please enter the zip/postal code.","Bitte geben Sie die Postleitzahl an."
 "Please enter your email address below. You will receive a link to reset your password.","Bitte geben Sie Ihre Email-Adresse ein. Sie erhalten dann einen Link mit dem Sie Ihr Passwort zurücksetzen können."
-"Please enter your email below and we\'ll send you confirmation link for it.","Bitte geben Sie unten Ihre E-Mail-Adresse ein, und wir senden Ihnen einen Bestätigungslink."
+"Please enter your email below and we'll send you confirmation link for it.","Bitte geben Sie unten Ihre E-Mail-Adresse ein, und wir senden Ihnen einen Bestätigungslink."
 "Please enter your email.","Bitte geben Sie Ihre E-Mail-Adresse ein."
 "Please make sure your passwords match.","Bitte stellen Sie sicher, dass die Passwörter übereinstimmen."
 "Please select","Bitte auswählen"
@@ -400,7 +400,7 @@
 "The suffix that goes after name (Jr., Sr., etc.)","Das Suffix nach dem Namen (Jr., Sr., usw.)"
 "The title that goes before name (Mr., Mrs., etc.)","Die Anrede vor dem Namen (Hr., Fr., usw.)"
 "There are no items in customer's wishlist at the moment","Momentan gibt es keine Artikel auf dem Wunschzettel des Kunden"
-"There are no items in customer\'s shopping cart at the moment","Es gibt momentan keine Artikel im Kundenwarenkorb"
+"There are no items in customer's shopping cart at the moment","Es gibt momentan keine Artikel im Kundenwarenkorb"
 "There is already an account with this email address. If you are sure that it is your email address, <a href=""%s"">click here</a> to get your password and access your account.","Es existiert schon ein Account mit dieser E-Mail-Adresse. Falls Sie sicher sein sollten, dass es Ihre E-Mail-Adresse ist, <a href=""%s"">klicken Sie hier</a>, um Ihr Passwort und Zugang zum Account zu erhalten."
 "There was an error validating the VAT ID.","Bei der Überprüfung der Umsatzsteuer-Identifikationsnummer ist ein Fehler aufgetreten."
 "There was an error validating the VAT ID. The customer would belong to Customer Group %s.","Bei der Überprüfung der Umsatzsteuer-Identifikationsnummer trat ein Fehler auf. Der Kunde würde zu Kundengruppe %s gehören."
diff --git a/app/code/Magento/Customer/i18n/en_US.csv b/app/code/Magento/Customer/i18n/en_US.csv
index 3e4d50199d3..01e4f152891 100644
--- a/app/code/Magento/Customer/i18n/en_US.csv
+++ b/app/code/Magento/Customer/i18n/en_US.csv
@@ -283,7 +283,7 @@
 "Please enter the telephone number.","Please enter the telephone number."
 "Please enter the zip/postal code.","Please enter the zip/postal code."
 "Please enter your email address below. You will receive a link to reset your password.","Please enter your email address below. You will receive a link to reset your password."
-"Please enter your email below and we\'ll send you confirmation link for it.","Please enter your email below and we\'ll send you confirmation link for it."
+"Please enter your email below and we'll send you confirmation link for it.","Please enter your email below and we'll send you confirmation link for it."
 "Please enter your email.","Please enter your email."
 "Please make sure your passwords match.","Please make sure your passwords match."
 "Please select","Please select"
@@ -399,7 +399,7 @@
 "The suffix that goes after name (Jr., Sr., etc.)","The suffix that goes after name (Jr., Sr., etc.)"
 "The title that goes before name (Mr., Mrs., etc.)","The title that goes before name (Mr., Mrs., etc.)"
 "There are no items in customer's wishlist at the moment","There are no items in customer's wishlist at the moment"
-"There are no items in customer\'s shopping cart at the moment","There are no items in customer\'s shopping cart at the moment"
+"There are no items in customer's shopping cart at the moment","There are no items in customer's shopping cart at the moment"
 "There is already an account with this email address. If you are sure that it is your email address, <a href=""%s"">click here</a> to get your password and access your account.","There is already an account with this email address. If you are sure that it is your email address, <a href=""%s"">click here</a> to get your password and access your account."
 "There was an error validating the VAT ID.","There was an error validating the VAT ID."
 "There was an error validating the VAT ID. The customer would belong to Customer Group %s.","There was an error validating the VAT ID. The customer would belong to Customer Group %s."
diff --git a/app/code/Magento/Customer/i18n/es_ES.csv b/app/code/Magento/Customer/i18n/es_ES.csv
index 4d763fe7444..3cb0ed4b195 100644
--- a/app/code/Magento/Customer/i18n/es_ES.csv
+++ b/app/code/Magento/Customer/i18n/es_ES.csv
@@ -283,7 +283,7 @@
 "Please enter the telephone number.","Por favor, introduce el número de teléfono."
 "Please enter the zip/postal code.","Por favor, introduce el código postal."
 "Please enter your email address below. You will receive a link to reset your password.","Escriba su correo electrónico más abajo. Recibirá un enlace para restablecer su contraseña."
-"Please enter your email below and we\'ll send you confirmation link for it.","Introduzca su dirección de correo electrónico a continuación y le enviaremos un enlace de confirmación."
+"Please enter your email below and we'll send you confirmation link for it.","Introduzca su dirección de correo electrónico a continuación y le enviaremos un enlace de confirmación."
 "Please enter your email.","Introduzca su dirección de correo electrónico."
 "Please make sure your passwords match.","Por favor, asegúrate de que las contraseñas coinciden."
 "Please select","Seleccione"
@@ -399,7 +399,7 @@
 "The suffix that goes after name (Jr., Sr., etc.)","El sufijo que va después de nombre (padre, hijo, etc.)"
 "The title that goes before name (Mr., Mrs., etc.)","El título que va antes del nombre (señor, señorita, etc.)"
 "There are no items in customer's wishlist at the moment","En este momento no hay artículos en la lista de deseos del cliente."
-"There are no items in customer\'s shopping cart at the moment","En este momento no hay artículos en el carrito de compras del cliente."
+"There are no items in customer's shopping cart at the moment","En este momento no hay artículos en el carrito de compras del cliente."
 "There is already an account with this email address. If you are sure that it is your email address, <a href=""%s"">click here</a> to get your password and access your account.","Ya existe una cuenta con esta dirección de correo electrónico. Si está seguro de que esa es su dirección de correo electrónico, <a href=""%s"">pulse aquí</a> para conseguir su contraseña y acceder a su cuenta."
 "There was an error validating the VAT ID.","Ha habido un error validando el ID de IVA."
 "There was an error validating the VAT ID. The customer would belong to Customer Group %s.","Ha habido un error validando el ID de IVA. El cliente podría pertenecer al grupo de cliente %s."
diff --git a/app/code/Magento/Customer/i18n/fr_FR.csv b/app/code/Magento/Customer/i18n/fr_FR.csv
index b470eb2b18d..1e0b8ec9982 100644
--- a/app/code/Magento/Customer/i18n/fr_FR.csv
+++ b/app/code/Magento/Customer/i18n/fr_FR.csv
@@ -283,7 +283,7 @@
 "Please enter the telephone number.","Veuillez saisir le numéro de téléphone."
 "Please enter the zip/postal code.","Veuillez saisir le code postal."
 "Please enter your email address below. You will receive a link to reset your password.","Veuillez entrer votre adresse e-mail ci dessous. Vous allez recevoir un lien pour réinitialiser votre mot de passe."
-"Please enter your email below and we\'ll send you confirmation link for it.","Veuillez entrer votre adresse email ci-dessous et nous vous enverrons un lien de confirmation."
+"Please enter your email below and we'll send you confirmation link for it.","Veuillez entrer votre adresse email ci-dessous et nous vous enverrons un lien de confirmation."
 "Please enter your email.","Veuillez entrer votre adresse email."
 "Please make sure your passwords match.","Veillez à ce que vos mots de passe correspondent."
 "Please select","Veuillez sélectionner"
@@ -399,7 +399,7 @@
 "The suffix that goes after name (Jr., Sr., etc.)","Le suffixe suivant le nom (Jr, Sr, etc)"
 "The title that goes before name (Mr., Mrs., etc.)","Le titre qui va avant le nom (M, Mme, Mlle, etc)"
 "There are no items in customer's wishlist at the moment","Il n'y a pas d'objets dans la liste de voeux de l'utilisateur"
-"There are no items in customer\'s shopping cart at the moment","Il n'y a pas d'objets dans le panier d'utilisateur"
+"There are no items in customer's shopping cart at the moment","Il n'y a pas d'objets dans le panier d'utilisateur"
 "There is already an account with this email address. If you are sure that it is your email address, <a href=""%s"">click here</a> to get your password and access your account.","Il y a déjà un compte avec cette adresse email. Si vous êtes sûr qu'il s'agit de votre adresse email, <a href=""%s"">cliquez ici</a> pour obtenir votre mot de passe et accéder à votre compte."
 "There was an error validating the VAT ID.","Une erreur est apparue lors de la validation du numéro de TVA."
 "There was an error validating the VAT ID. The customer would belong to Customer Group %s.","Une erreur est apparue lors de la validation du numéro de TVA. Le client appartiendrait au Groupe de clients %s."
diff --git a/app/code/Magento/Customer/i18n/nl_NL.csv b/app/code/Magento/Customer/i18n/nl_NL.csv
index 0be78c5df5d..1ada79004ea 100644
--- a/app/code/Magento/Customer/i18n/nl_NL.csv
+++ b/app/code/Magento/Customer/i18n/nl_NL.csv
@@ -283,7 +283,7 @@
 "Please enter the telephone number.","Vul alstublieft het telefoonnummer in."
 "Please enter the zip/postal code.","Vul alstublieft de postcode in."
 "Please enter your email address below. You will receive a link to reset your password.","Voer hieronder uw e-mailadres in. U ontvangt een link waarmee u uw wachtwoord opnieuw kunt instellen."
-"Please enter your email below and we\'ll send you confirmation link for it.","Gelieve uw e-mailadres hieronder in te vullen en wij zullen uw een confirmatie link sturen."
+"Please enter your email below and we'll send you confirmation link for it.","Gelieve uw e-mailadres hieronder in te vullen en wij zullen uw een confirmatie link sturen."
 "Please enter your email.","Geef u e-mail in a.u.b."
 "Please make sure your passwords match.","Let er alstublieft op dat de wachtwoorden overeenkomen."
 "Please select","Selecteer"
@@ -399,7 +399,7 @@
 "The suffix that goes after name (Jr., Sr., etc.)","Het achtervoegsel dat achter naam komt (Jr., Sr., etc.)"
 "The title that goes before name (Mr., Mrs., etc.)","De titel staat voor de naam (Mr., Mrs., e.d.)"
 "There are no items in customer's wishlist at the moment","Er staan momenteel geen items op het verlanglijstje van de klant"
-"There are no items in customer\'s shopping cart at the moment","Er zitten momenteel geen items in het winkelwagentje van de klant"
+"There are no items in customer's shopping cart at the moment","Er zitten momenteel geen items in het winkelwagentje van de klant"
 "There is already an account with this email address. If you are sure that it is your email address, <a href=""%s"">click here</a> to get your password and access your account.","Er is al een account met dit e-mail adres. Indien u zeker weet dat dit uw e-mail adres is,  <a href=""%s"">klik hier</a> om uw wachtwoord te ontvangen en toegang te krijgen tot uw account."
 "There was an error validating the VAT ID.","Er is een fout opgetreden bij het valideren van uw BTW nr."
 "There was an error validating the VAT ID. The customer would belong to Customer Group %s.","Er is een fout opgetreden bij het valideren van uw BTW nr. De klant zou behoren tot Klant Groep %s."
diff --git a/app/code/Magento/Customer/i18n/pt_BR.csv b/app/code/Magento/Customer/i18n/pt_BR.csv
index 8fd09f5336c..1a5d01fb5c9 100644
--- a/app/code/Magento/Customer/i18n/pt_BR.csv
+++ b/app/code/Magento/Customer/i18n/pt_BR.csv
@@ -283,7 +283,7 @@
 "Please enter the telephone number.","Insira o número de telefone."
 "Please enter the zip/postal code.","Insira o CEP."
 "Please enter your email address below. You will receive a link to reset your password.","Por favor informe o seu endereço de e-mail abaixo. Você receberá um link para redefinir sua senha."
-"Please enter your email below and we\'ll send you confirmation link for it.","Digite seu e-mail abaixo e enviaremos o link de confirmação."
+"Please enter your email below and we'll send you confirmation link for it.","Digite seu e-mail abaixo e enviaremos o link de confirmação."
 "Please enter your email.","Por favor insira seu email."
 "Please make sure your passwords match.","Por favor certifique-se que suas senhas coincidem."
 "Please select","Favor selecionar"
@@ -399,7 +399,7 @@
 "The suffix that goes after name (Jr., Sr., etc.)","O sufixo que vai atrás do nome (Jr., Sr., etc.)"
 "The title that goes before name (Mr., Mrs., etc.)","O título que vai antes do nome (Sr., Sra., etc.)"
 "There are no items in customer's wishlist at the moment","No momento não há itens na lista de desejos do cliente"
-"There are no items in customer\'s shopping cart at the moment","Não há itens no carrinho de compras do cliente no momento"
+"There are no items in customer's shopping cart at the moment","Não há itens no carrinho de compras do cliente no momento"
 "There is already an account with this email address. If you are sure that it is your email address, <a href=""%s"">click here</a> to get your password and access your account.","Já existe uma conta com este endereço de email. Se você tem certeza que é o seu endereço de email, <a href=""%s"">clique aqui</a> para obter a sua senha e acessar sua conta."
 "There was an error validating the VAT ID.","Ocorreu um erro ao validar a ID do VAT."
 "There was an error validating the VAT ID. The customer would belong to Customer Group %s.","Ocorreu um erro ao validar a ID do VAT. O cliente pertenceria ao grupo de clientes %s."
diff --git a/app/code/Magento/Customer/i18n/zh_CN.csv b/app/code/Magento/Customer/i18n/zh_CN.csv
index 814d6c96987..4f523757b4f 100644
--- a/app/code/Magento/Customer/i18n/zh_CN.csv
+++ b/app/code/Magento/Customer/i18n/zh_CN.csv
@@ -283,7 +283,7 @@
 "Please enter the telephone number.","请输入电话号码。"
 "Please enter the zip/postal code.","请输入邮编。"
 "Please enter your email address below. You will receive a link to reset your password.","请在下面输入你的电子邮件地址。你将收到一个重置密码的链接。"
-"Please enter your email below and we\'ll send you confirmation link for it.","请在下面输入您的邮件地址,我们将发送确认链接。"
+"Please enter your email below and we'll send you confirmation link for it.","请在下面输入您的邮件地址,我们将发送确认链接。"
 "Please enter your email.","请输入您的电子邮件。"
 "Please make sure your passwords match.","请确保密码匹配。"
 "Please select","请选择"
@@ -399,7 +399,7 @@
 "The suffix that goes after name (Jr., Sr., etc.)","名字后面的后缀(Jr.、Sr.等)"
 "The title that goes before name (Mr., Mrs., etc.)","姓名前称谓(先生、女士等)"
 "There are no items in customer's wishlist at the moment","客户的愿望清单中目前没内容"
-"There are no items in customer\'s shopping cart at the moment","客户的购物车中目前没内容"
+"There are no items in customer's shopping cart at the moment","客户的购物车中目前没内容"
 "There is already an account with this email address. If you are sure that it is your email address, <a href=""%s"">click here</a> to get your password and access your account.","已有帐户使用该电子邮件地址。如果您确认这是您自己的电子邮件地址,请 <a href=""%s"">点击这里</a> 获取您的密码并访问帐户。"
 "There was an error validating the VAT ID.","验证 VAT ID 时出错。"
 "There was an error validating the VAT ID. The customer would belong to Customer Group %s.","验证 VAT ID 时出错。该顾客可属于顾客群体 %s。"
diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Custom.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Custom.php
index fb1fcf90687..aed92b1ff83 100644
--- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Custom.php
+++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Custom.php
@@ -45,14 +45,14 @@ class Custom extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\DesignEditor\Model\Theme\Context $themeContext
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\DesignEditor\Model\Theme\Context $themeContext,
         array $data = array()
diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php
index d1f48b00bdf..af98c210a43 100644
--- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php
+++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php
@@ -52,7 +52,7 @@ class ImageSizing extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\DesignEditor\Model\Editor\Tools\Controls\Factory $controlFactory
@@ -61,7 +61,7 @@ class ImageSizing extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\DesignEditor\Model\Editor\Tools\Controls\Factory $controlFactory,
diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php
index adbbcc750cb..ed4b0324f78 100644
--- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php
+++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php
@@ -50,7 +50,7 @@ class Js extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Theme\Model\Config\Customization $customizationConfig
      * @param \Magento\DesignEditor\Model\Theme\Context $themeContext
@@ -59,7 +59,7 @@ class Js extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Theme\Model\Config\Customization $customizationConfig,
         \Magento\DesignEditor\Model\Theme\Context $themeContext,
diff --git a/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php b/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php
index 2cc3f70dc80..2eab8fb4b71 100644
--- a/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php
+++ b/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php
@@ -64,10 +64,11 @@ class Standard extends \Magento\Core\App\Router\Base
      * @param \Magento\Core\Model\Store\Config $storeConfig
      * @param \Magento\Url\SecurityInfoInterface $urlSecurityInfo
      * @param string $routerId
+     * @param \Magento\Code\NameBuilder $nameBuilder
      * @param \Magento\App\RouterListInterface $routerList
      * @param \Magento\ObjectManager $objectManager
      * @param \Magento\Core\App\Request\RewriteService $urlRewriteService
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
@@ -81,6 +82,7 @@ class Standard extends \Magento\Core\App\Router\Base
         \Magento\Core\Model\Store\Config $storeConfig,
         \Magento\Url\SecurityInfoInterface $urlSecurityInfo,
         $routerId,
+        \Magento\Code\NameBuilder $nameBuilder,
         \Magento\App\RouterListInterface $routerList,
         \Magento\ObjectManager $objectManager,
         \Magento\Core\App\Request\RewriteService $urlRewriteService
@@ -95,7 +97,8 @@ class Standard extends \Magento\Core\App\Router\Base
             $storeManager,
             $storeConfig,
             $urlSecurityInfo,
-            $routerId
+            $routerId,
+            $nameBuilder
         );
         $this->_urlRewriteService = $urlRewriteService;
         $this->_objectManager = $objectManager;
diff --git a/app/code/Magento/Directory/Model/Config/Source/Allregion.php b/app/code/Magento/Directory/Model/Config/Source/Allregion.php
index 11ab8d386d1..c6735123e63 100644
--- a/app/code/Magento/Directory/Model/Config/Source/Allregion.php
+++ b/app/code/Magento/Directory/Model/Config/Source/Allregion.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Directory\Model\Config\Source;
 
-class Allregion implements \Magento\Core\Model\Option\ArrayInterface
+class Allregion implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Directory/Model/Config/Source/Country.php b/app/code/Magento/Directory/Model/Config/Source/Country.php
index 25545a9d57e..ba649afa9f3 100644
--- a/app/code/Magento/Directory/Model/Config/Source/Country.php
+++ b/app/code/Magento/Directory/Model/Config/Source/Country.php
@@ -27,7 +27,7 @@
 
 namespace Magento\Directory\Model\Config\Source;
 
-class Country implements \Magento\Core\Model\Option\ArrayInterface
+class Country implements \Magento\Option\ArrayInterface
 {
     /**
      * Countries
diff --git a/app/code/Magento/Directory/Model/Config/Source/Country/Full.php b/app/code/Magento/Directory/Model/Config/Source/Country/Full.php
index 69f91fb4f4f..295ec53e917 100644
--- a/app/code/Magento/Directory/Model/Config/Source/Country/Full.php
+++ b/app/code/Magento/Directory/Model/Config/Source/Country/Full.php
@@ -28,7 +28,7 @@
 namespace Magento\Directory\Model\Config\Source\Country;
 
 class Full extends \Magento\Directory\Model\Config\Source\Country
-    implements \Magento\Core\Model\Option\ArrayInterface
+    implements \Magento\Option\ArrayInterface
 {
     /**
      * @param bool $isMultiselect
diff --git a/app/code/Magento/Directory/Model/Country.php b/app/code/Magento/Directory/Model/Country.php
index 515b4e2f774..90e3171078d 100644
--- a/app/code/Magento/Directory/Model/Country.php
+++ b/app/code/Magento/Directory/Model/Country.php
@@ -61,8 +61,8 @@ class Country extends \Magento\Core\Model\AbstractModel
     protected $_regionCollectionFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Directory\Model\Country\FormatFactory $formatFactory
      * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory
@@ -71,8 +71,8 @@ class Country extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Directory\Model\Country\FormatFactory $formatFactory,
         \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory,
diff --git a/app/code/Magento/Directory/Model/Currency.php b/app/code/Magento/Directory/Model/Currency.php
index aa5da371fb7..40af8029602 100644
--- a/app/code/Magento/Directory/Model/Currency.php
+++ b/app/code/Magento/Directory/Model/Currency.php
@@ -78,8 +78,8 @@ class Currency extends \Magento\Core\Model\AbstractModel
     protected $_currencyFilterFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Directory\Helper\Data $directoryHelper
@@ -89,8 +89,8 @@ class Currency extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Directory\Helper\Data $directoryHelper,
diff --git a/app/code/Magento/Directory/Model/Currency/Import/Source/Service.php b/app/code/Magento/Directory/Model/Currency/Import/Source/Service.php
index b7a08d86ec4..e8be239bac4 100644
--- a/app/code/Magento/Directory/Model/Currency/Import/Source/Service.php
+++ b/app/code/Magento/Directory/Model/Currency/Import/Source/Service.php
@@ -23,7 +23,7 @@
  */
 namespace Magento\Directory\Model\Currency\Import\Source;
 
-class Service implements \Magento\Core\Model\Option\ArrayInterface
+class Service implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Directory\Model\Currency\Import\Config
diff --git a/app/code/Magento/Directory/Model/Observer.php b/app/code/Magento/Directory/Model/Observer.php
index ba7041cc24a..0bd66c5e662 100644
--- a/app/code/Magento/Directory/Model/Observer.php
+++ b/app/code/Magento/Directory/Model/Observer.php
@@ -59,9 +59,9 @@ class Observer
     protected $_translate;
 
     /**
-     * @var \Magento\Email\Model\TemplateFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_emailTemplateFactory;
+    protected $_transportBuilder;
 
     /**
      * @var \Magento\Core\Model\StoreManagerInterface
@@ -77,7 +77,7 @@ class Observer
      * @param \Magento\Directory\Model\Currency\Import\Factory $importFactory
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\TranslateInterface $translate
-     * @param \Magento\Email\Model\TemplateFactory $emailTemplateFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
      */
@@ -85,14 +85,14 @@ class Observer
         \Magento\Directory\Model\Currency\Import\Factory $importFactory,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\TranslateInterface $translate,
-        \Magento\Email\Model\TemplateFactory $emailTemplateFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Directory\Model\CurrencyFactory $currencyFactory
     ) {
         $this->_importFactory = $importFactory;
         $this->_coreStoreConfig = $coreStoreConfig;
         $this->_translate = $translate;
-        $this->_emailTemplateFactory = $emailTemplateFactory;
+        $this->_transportBuilder = $transportBuilder;
         $this->_storeManager = $storeManager;
         $this->_currencyFactory = $currencyFactory;
     }
@@ -110,21 +110,22 @@ class Observer
             return;
         }
 
+        $errors = array();
+        $rates = array();
         $service = $this->_coreStoreConfig->getConfig(self::IMPORT_SERVICE);
-        if( !$service ) {
+        if ($service) {
+            try {
+                $importModel = $this->_importFactory->create($service);
+                $rates = $importModel->fetchRates();
+                $errors = $importModel->getMessages();
+            } catch (\Exception $e) {
+                $importWarnings[] = __('FATAL ERROR:') . ' ' . __('We can\'t initialize the import model.');
+            }
+        } else {
             $importWarnings[] = __('FATAL ERROR:') . ' ' . __('Please specify the correct Import Service.');
         }
 
-        try {
-            $importModel = $this->_importFactory->create($service);
-        } catch (\Exception $e) {
-            $importWarnings[] = __('FATAL ERROR:') . ' ' . __('We can\'t initialize the import model.');
-        }
-
-        $rates = $importModel->fetchRates();
-        $errors = $importModel->getMessages();
-
-        if( sizeof($errors) > 0 ) {
+        if (sizeof($errors) > 0) {
             foreach ($errors as $error) {
                 $importWarnings[] = __('WARNING:') . ' ' . $error;
             }
@@ -133,23 +134,23 @@ class Observer
         if (sizeof($importWarnings) == 0) {
             $this->_currencyFactory->create()->saveRates($rates);
         } else {
+            $translate = $this->_translate->getTranslateInline();
             $this->_translate->setTranslateInline(false);
 
-            /* @var $mailTemplate \Magento\Email\Model\Template */
-            $mailTemplate = $this->_emailTemplateFactory->create();
-            $mailTemplate->setDesignConfig(array(
-                'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
-                'store' => $this->_storeManager->getStore()->getId()
-            ))
-                ->sendTransactional(
-                    $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE),
-                    $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_IDENTITY),
-                    $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT),
-                    null,
-                    array('warnings'    => join("\n", $importWarnings),
+            $this->_transportBuilder->setTemplateIdentifier(
+                    $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE)
                 )
-            );
-            $this->_translate->setTranslateInline(true);
+                ->setTemplateOptions(array(
+                    'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                    'store' => $this->_storeManager->getStore()->getId(),
+                ))
+                ->setTemplateVars(array('warnings' => join("\n", $importWarnings)))
+                ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_IDENTITY))
+                ->addTo($this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT));
+            $transport = $this->_transportBuilder->getTransport();
+            $transport->sendMessage();
+
+            $this->_translate->setTranslateInline($translate);
         }
     }
 }
diff --git a/app/code/Magento/Directory/Model/Resource/Country.php b/app/code/Magento/Directory/Model/Resource/Country.php
index 0832b444973..5302b9974e9 100644
--- a/app/code/Magento/Directory/Model/Resource/Country.php
+++ b/app/code/Magento/Directory/Model/Resource/Country.php
@@ -24,11 +24,11 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\Directory\Model\Resource;
+
 /**
  * Directory Country Resource Model
  */
-namespace Magento\Directory\Model\Resource;
-
 class Country extends \Magento\Core\Model\Resource\Db\AbstractDb
 {
     /**
diff --git a/app/code/Magento/Directory/etc/module.xml b/app/code/Magento/Directory/etc/module.xml
index ff57ec40fab..4d55b7882c7 100755
--- a/app/code/Magento/Directory/etc/module.xml
+++ b/app/code/Magento/Directory/etc/module.xml
@@ -31,7 +31,6 @@
         <depends>
             <module name="Magento_Core"/>
             <module name="Magento_Backend"/>
-            <module name="Magento_Email"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/Directory/i18n/de_DE.csv b/app/code/Magento/Directory/i18n/de_DE.csv
index 4f56be7ad2b..b6c8aa2a10f 100644
--- a/app/code/Magento/Directory/i18n/de_DE.csv
+++ b/app/code/Magento/Directory/i18n/de_DE.csv
@@ -2,7 +2,7 @@
 "Allowed Currencies","Zulässige Währungen"
 "Base Currency","Basiswährung"
 "Base currency is used for all online payment transactions. Scope is defined by the catalog price scope (""Catalog"" > ""Price"" > ""Catalog Price Scope"").","Die Basiswährung wird für alle Online-Transaktionen verwendet. Der Spielraum richtet sich nach dem Spielraum des Katalogpreises (""Katalog"" > ""Preis"" > ""Spielraum Katalogpreis"")."
-"Can\'t convert rate from ""%s-%s"".","Rate kann nicht von ""%s-%s"" konvertiert werden. 
+"Can't convert rate from ""%s-%s"".","Rate kann nicht von ""%s-%s"" konvertiert werden.
 
 
 
diff --git a/app/code/Magento/Directory/i18n/en_US.csv b/app/code/Magento/Directory/i18n/en_US.csv
index 3f2500b921b..378254779cf 100644
--- a/app/code/Magento/Directory/i18n/en_US.csv
+++ b/app/code/Magento/Directory/i18n/en_US.csv
@@ -2,7 +2,7 @@
 "Allowed Currencies","Allowed Currencies"
 "Base Currency","Base Currency"
 "Base currency is used for all online payment transactions. Scope is defined by the catalog price scope (""Catalog"" > ""Price"" > ""Catalog Price Scope"").","Base currency is used for all online payment transactions. Scope is defined by the catalog price scope (""Catalog"" > ""Price"" > ""Catalog Price Scope"")."
-"Can\'t convert rate from ""%s-%s"".","Can\'t convert rate from ""%s-%s""."
+"Can't convert rate from ""%s-%s"".","Can't convert rate from ""%s-%s""."
 "Cannot retrieve rate from %s.","Cannot retrieve rate from %s."
 "Connection Timeout in Seconds","Connection Timeout in Seconds"
 "Continue &raquo;","Continue &raquo;"
diff --git a/app/code/Magento/Directory/i18n/es_ES.csv b/app/code/Magento/Directory/i18n/es_ES.csv
index 9303a1ee5b1..877e6e69984 100644
--- a/app/code/Magento/Directory/i18n/es_ES.csv
+++ b/app/code/Magento/Directory/i18n/es_ES.csv
@@ -2,7 +2,7 @@
 "Allowed Currencies","Divisas permitidas"
 "Base Currency","Divisa base"
 "Base currency is used for all online payment transactions. Scope is defined by the catalog price scope (""Catalog"" > ""Price"" > ""Catalog Price Scope"").","La divisa base se utiliza en todas las transacciones de pago en línea. El alcance queda definido por el alcance del precio del catálogo ((""Catálogo"" > ""Precio"" > ""Alcance del Precio del Catálogo"")."
-"Can\'t convert rate from ""%s-%s"".","No se puede convertir la tarifa de ""%s-%s""."
+"Can't convert rate from ""%s-%s"".","No se puede convertir la tarifa de ""%s-%s""."
 "Cannot retrieve rate from %s.","No se puede obtener el tipo de cambio de %s."
 "Connection Timeout in Seconds","Plazo de expiración de la conexión en segundos"
 "Continue &raquo;","Seguir &gt;"
diff --git a/app/code/Magento/Directory/i18n/fr_FR.csv b/app/code/Magento/Directory/i18n/fr_FR.csv
index cfae88d7e04..ce5d4b714cc 100644
--- a/app/code/Magento/Directory/i18n/fr_FR.csv
+++ b/app/code/Magento/Directory/i18n/fr_FR.csv
@@ -2,7 +2,7 @@
 "Allowed Currencies","Devises autorisées"
 "Base Currency","Devise de base"
 "Base currency is used for all online payment transactions. Scope is defined by the catalog price scope (""Catalog"" > ""Price"" > ""Catalog Price Scope"").","La monnaie de base est utilisée pour tous les paiements en ligne. Le champ est défini par l'étendue des prix du catalogue"
-"Can\'t convert rate from ""%s-%s"".","Impossible de convertir le taux depuis « %s-%s ». "
+"Can't convert rate from ""%s-%s"".","Impossible de convertir le taux depuis « %s-%s ». "
 "Cannot retrieve rate from %s.","Ne peut extraire taux du %s."
 "Connection Timeout in Seconds","Interruption connexion en secondes"
 "Continue &raquo;","Continue &raquo;"
diff --git a/app/code/Magento/Directory/i18n/nl_NL.csv b/app/code/Magento/Directory/i18n/nl_NL.csv
index b3b8b51d85a..d50f01f2ad0 100644
--- a/app/code/Magento/Directory/i18n/nl_NL.csv
+++ b/app/code/Magento/Directory/i18n/nl_NL.csv
@@ -2,7 +2,7 @@
 "Allowed Currencies","Toegestane Munteenheden"
 "Base Currency","Basis Munteenheid"
 "Base currency is used for all online payment transactions. Scope is defined by the catalog price scope (""Catalog"" > ""Price"" > ""Catalog Price Scope"").","Basis munteenheid wordt gebruikt voor alle online betalingstransacties. Reikwijdte is gedefinieerd door de catalogus prijsreikwijdte (""Catalogus"" > ""Prijs"" > ""Catalogus prijsreikwijdte"")."
-"Can\'t convert rate from ""%s-%s"".","Kan tarief niet omzetten van ""%s-%s""."
+"Can't convert rate from ""%s-%s"".","Kan tarief niet omzetten van ""%s-%s""."
 "Cannot retrieve rate from %s.","Kan koers niet terughalen van %s."
 "Connection Timeout in Seconds","Connectie Timeout in Secondes"
 "Continue &raquo;","Ga verder &raquo;"
diff --git a/app/code/Magento/Directory/i18n/pt_BR.csv b/app/code/Magento/Directory/i18n/pt_BR.csv
index 187c80c5646..4cd0b3dd4a2 100644
--- a/app/code/Magento/Directory/i18n/pt_BR.csv
+++ b/app/code/Magento/Directory/i18n/pt_BR.csv
@@ -2,7 +2,7 @@
 "Allowed Currencies","Moedas Permitidas"
 "Base Currency","Moeda Padrão"
 "Base currency is used for all online payment transactions. Scope is defined by the catalog price scope (""Catalog"" > ""Price"" > ""Catalog Price Scope"").","A Moeda Padrão é usada em todas as transações de pagamento online. O escopo é definido pelo escopo do preço de catálogo (""Catálogo"" > ""Preço"" > ""Escopo do Preço de Catálogo"")."
-"Can\'t convert rate from ""%s-%s"".","Não é possível converter taxa de ""%s-%s""."
+"Can't convert rate from ""%s-%s"".","Não é possível converter taxa de ""%s-%s""."
 "Cannot retrieve rate from %s.","Não foi possível recuperar a taxa do %s."
 "Connection Timeout in Seconds","Duração da Conexão em Segundos"
 "Continue &raquo;","Continuar &raquo;"
diff --git a/app/code/Magento/Directory/i18n/zh_CN.csv b/app/code/Magento/Directory/i18n/zh_CN.csv
index 3bb687c8cb3..3650a4d73c1 100644
--- a/app/code/Magento/Directory/i18n/zh_CN.csv
+++ b/app/code/Magento/Directory/i18n/zh_CN.csv
@@ -2,7 +2,7 @@
 "Allowed Currencies","允许的货币"
 "Base Currency","基准货币"
 "Base currency is used for all online payment transactions. Scope is defined by the catalog price scope (""Catalog"" > ""Price"" > ""Catalog Price Scope"").","基准货币将被所有在线支付交易所使用。范围则是由分类价格范围 (""分类"" > ""价格"" > ""分类价格范围"")决定的。"
-"Can\'t convert rate from ""%s-%s"".","无法执行 ""%s-%s"" 费率转换。"
+"Can't convert rate from ""%s-%s"".","无法执行 ""%s-%s"" 费率转换。"
 "Cannot retrieve rate from %s.","无法从 %s 获取费率。"
 "Connection Timeout in Seconds","连接超时的秒数"
 "Continue &raquo;","ç»§ç»­ &raquo;"
diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php
index f0613c86c56..1202235245b 100644
--- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php
+++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php
@@ -57,18 +57,18 @@ class Downloadable
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php
index c7e32e9e3a0..fd5d4ada360 100644
--- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php
+++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php
@@ -69,7 +69,7 @@ class Links
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -103,7 +103,7 @@ class Links
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase
      * @param \Magento\Downloadable\Helper\File $downloadableFile
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Backend\Model\Config\Source\Yesno $sourceModel
      * @param \Magento\Downloadable\Model\Link $link
      * @param \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory
@@ -115,7 +115,7 @@ class Links
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase,
         \Magento\Downloadable\Helper\File $downloadableFile,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Backend\Model\Config\Source\Yesno $sourceModel,
         \Magento\Downloadable\Model\Link $link,
         \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory,
diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php
index 0856881b0d2..73c83a0611a 100644
--- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php
+++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php
@@ -62,7 +62,7 @@ class Samples
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -86,7 +86,7 @@ class Samples
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase
      * @param \Magento\Downloadable\Helper\File $downloadableFile
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Downloadable\Model\Sample $sampleModel
      * @param \Magento\Backend\Model\UrlFactory $urlFactory
      * @param array $data
@@ -96,7 +96,7 @@ class Samples
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase,
         \Magento\Downloadable\Helper\File $downloadableFile,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Downloadable\Model\Sample $sampleModel,
         \Magento\Backend\Model\UrlFactory $urlFactory,
         array $data = array()
diff --git a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php
index 9bef411e39c..b2a4e55cbba 100644
--- a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php
+++ b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php
@@ -53,7 +53,7 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -67,13 +67,13 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct
      * @param \Magento\Core\Helper\Data $coreData
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Downloadable/Model/Link.php b/app/code/Magento/Downloadable/Model/Link.php
index cce76ad307e..60de68d63f4 100644
--- a/app/code/Magento/Downloadable/Model/Link.php
+++ b/app/code/Magento/Downloadable/Model/Link.php
@@ -68,15 +68,15 @@ class Link extends \Magento\Core\Model\AbstractModel
     const LINK_SHAREABLE_CONFIG = 2;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
diff --git a/app/code/Magento/Downloadable/Model/Product/Type.php b/app/code/Magento/Downloadable/Model/Product/Type.php
index 72906e14cb0..389acfc2b1b 100644
--- a/app/code/Magento/Downloadable/Model/Product/Type.php
+++ b/app/code/Magento/Downloadable/Model/Product/Type.php
@@ -86,7 +86,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual
      * @param \Magento\Core\Helper\Data $coreData
      * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb
      * @param \Magento\App\Filesystem $filesystem
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Logger $logger
      * @param \Magento\Downloadable\Model\Resource\SampleFactory $sampleResFactory
      * @param \Magento\Downloadable\Model\Resource\Link $linkResource
@@ -105,7 +105,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual
         \Magento\Core\Helper\Data $coreData,
         \Magento\Core\Helper\File\Storage\Database $fileStorageDb,
         \Magento\App\Filesystem $filesystem,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Logger $logger,
         \Magento\Downloadable\Helper\File $downloadableFile,
         \Magento\Downloadable\Model\Resource\SampleFactory $sampleResFactory,
diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php
index 45722f1720b..e15b44f5a3d 100644
--- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php
+++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php
@@ -56,8 +56,8 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra
     protected $_itemsFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\App\Filesystem $filesystem
      * @param \Magento\Filter\FilterManager $filterManager
@@ -69,8 +69,8 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\App\Filesystem $filesystem,
         \Magento\Filter\FilterManager $filterManager,
diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php
index 10e3a85e91f..42a176fd6d5 100644
--- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php
+++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php
@@ -37,8 +37,8 @@ class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstr
     protected $string;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\App\Filesystem $filesystem
      * @param \Magento\Filter\FilterManager $filterManager
@@ -51,8 +51,8 @@ class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstr
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\App\Filesystem $filesystem,
         \Magento\Filter\FilterManager $filterManager,
diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php
index 72c4f8b1172..d31f14a7f95 100644
--- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php
+++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php
@@ -37,8 +37,8 @@ class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstract
     protected $string;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\App\Filesystem $filesystem
      * @param \Magento\Filter\FilterManager $filterManager
@@ -51,8 +51,8 @@ class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstract
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\App\Filesystem $filesystem,
         \Magento\Filter\FilterManager $filterManager,
diff --git a/app/code/Magento/Downloadable/Model/Sample.php b/app/code/Magento/Downloadable/Model/Sample.php
index fb83a5c1e24..b0ce9b0afed 100644
--- a/app/code/Magento/Downloadable/Model/Sample.php
+++ b/app/code/Magento/Downloadable/Model/Sample.php
@@ -49,15 +49,15 @@ class Sample extends \Magento\Core\Model\AbstractModel
     const XML_PATH_SAMPLES_TITLE = 'catalog/downloadable/samples_title';
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
diff --git a/app/code/Magento/Downloadable/Model/System/Config/Source/Contentdisposition.php b/app/code/Magento/Downloadable/Model/System/Config/Source/Contentdisposition.php
index 36a7bdf9019..34280adbc04 100644
--- a/app/code/Magento/Downloadable/Model/System/Config/Source/Contentdisposition.php
+++ b/app/code/Magento/Downloadable/Model/System/Config/Source/Contentdisposition.php
@@ -33,7 +33,7 @@
  */
 namespace Magento\Downloadable\Model\System\Config\Source;
 
-class Contentdisposition implements \Magento\Core\Model\Option\ArrayInterface
+class Contentdisposition implements \Magento\Option\ArrayInterface
 {
     public function toOptionArray()
     {
diff --git a/app/code/Magento/Downloadable/Model/System/Config/Source/Orderitemstatus.php b/app/code/Magento/Downloadable/Model/System/Config/Source/Orderitemstatus.php
index d841d001dca..50074b23fdb 100644
--- a/app/code/Magento/Downloadable/Model/System/Config/Source/Orderitemstatus.php
+++ b/app/code/Magento/Downloadable/Model/System/Config/Source/Orderitemstatus.php
@@ -33,7 +33,7 @@
  */
 namespace Magento\Downloadable\Model\System\Config\Source;
 
-class Orderitemstatus implements \Magento\Core\Model\Option\ArrayInterface
+class Orderitemstatus implements \Magento\Option\ArrayInterface
 {
     public function toOptionArray()
     {
diff --git a/app/code/Magento/Downloadable/i18n/de_DE.csv b/app/code/Magento/Downloadable/i18n/de_DE.csv
index 83e11b986be..3bb2638c649 100644
--- a/app/code/Magento/Downloadable/i18n/de_DE.csv
+++ b/app/code/Magento/Downloadable/i18n/de_DE.csv
@@ -1,7 +1,7 @@
 "Add","Hinzufügen"
 "Add New Row","Neue Zeile hinzufügen"
 "Add links and samples to downloadable product","Links und Beispiele zum herunterladbaren Produkt hinzufügen"
-"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.","Alphanumerische Zeichen, Bindestriche und Unterstriche werden für Dateinamen empfohlen. Unangemessene Zeichen werden durch '_' ersetzt."
+"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with '_'.","Alphanumerische Zeichen, Bindestriche und Unterstriche werden für Dateinamen empfohlen. Unangemessene Zeichen werden durch '_' ersetzt."
 "An error occurred while getting requested content. Please contact the store owner.","Beim Laden des angeforderten Inhalts ist ein Fehler aufgetreten. Bitte kontaktieren Sie den Shopbesitzer."
 "An error occurred while getting the requested content.","Beim Laden des angeforderten Inhalts ist ein Fehler aufgetreten."
 "An error occurred while getting the requested content. Please contact the store owner.","Beim Laden des angeforderten Inhalts ist ein Fehler aufgetreten. Bitte kontaktieren Sie den Shopbesitzer."
diff --git a/app/code/Magento/Downloadable/i18n/en_US.csv b/app/code/Magento/Downloadable/i18n/en_US.csv
index cf7ac4064c2..fb01a8cd48a 100644
--- a/app/code/Magento/Downloadable/i18n/en_US.csv
+++ b/app/code/Magento/Downloadable/i18n/en_US.csv
@@ -1,7 +1,7 @@
 "Add","Add"
 "Add New Row","Add New Row"
 "Add links and samples to downloadable product","Add links and samples to downloadable product"
-"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.","Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'."
+"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with '_'.","Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with '_'."
 "An error occurred while getting requested content. Please contact the store owner.","An error occurred while getting requested content. Please contact the store owner."
 "An error occurred while getting the requested content.","An error occurred while getting the requested content."
 "An error occurred while getting the requested content. Please contact the store owner.","An error occurred while getting the requested content. Please contact the store owner."
diff --git a/app/code/Magento/Downloadable/i18n/es_ES.csv b/app/code/Magento/Downloadable/i18n/es_ES.csv
index db1e2d386a5..f63ec45bbdd 100644
--- a/app/code/Magento/Downloadable/i18n/es_ES.csv
+++ b/app/code/Magento/Downloadable/i18n/es_ES.csv
@@ -1,7 +1,7 @@
 "Add","Añadir"
 "Add New Row","Agregar nueva fila"
 "Add links and samples to downloadable product","Añadir enlaces y muestras al producto de descarga"
-"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.","Se recomiendan los caracteres alfanuméricos, guión y guión bajo para los nombres de fichero. Los caracteres incorrectos se reemplazarán con '_'."
+"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with '_'.","Se recomiendan los caracteres alfanuméricos, guión y guión bajo para los nombres de fichero. Los caracteres incorrectos se reemplazarán con '_'."
 "An error occurred while getting requested content. Please contact the store owner.","Ocurrió un error mientras se recibía el contenido solicitado. Por favor, póngase en contacto con el propietario de la tienda."
 "An error occurred while getting the requested content.","Ocurrió un error mientras se recibía el contenido solicitado."
 "An error occurred while getting the requested content. Please contact the store owner.","Ocurrió un error mientras se recibía el contenido solicitado. Por favor, póngase en contacto con el propietario de la tienda."
diff --git a/app/code/Magento/Downloadable/i18n/fr_FR.csv b/app/code/Magento/Downloadable/i18n/fr_FR.csv
index 288a1942a18..1aeaeb40fcc 100644
--- a/app/code/Magento/Downloadable/i18n/fr_FR.csv
+++ b/app/code/Magento/Downloadable/i18n/fr_FR.csv
@@ -1,7 +1,7 @@
 "Add","Ajouter"
 "Add New Row","Ajouter nouvelle ligne"
 "Add links and samples to downloadable product","Ajouter des liens et des échantillons au produit téléchargeable"
-"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.","Il est recommandé de n'utiliser que des lettres, des chiffres, le tiret (-) et le blanc souligné (_) pour les noms de fichiers. Les caractères invalides seront remplacés par '_'."
+"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with '_'.","Il est recommandé de n'utiliser que des lettres, des chiffres, le tiret (-) et le blanc souligné (_) pour les noms de fichiers. Les caractères invalides seront remplacés par '_'."
 "An error occurred while getting requested content. Please contact the store owner.","Une erreur s'est produite en accédant au contenu demandé. Contactez le propriétaire du site."
 "An error occurred while getting the requested content.","Une erreur s'est produite en accédant au contenu demandé."
 "An error occurred while getting the requested content. Please contact the store owner.","Un erreur s'est produite en accédant au contenu demandé. Contactez le propriétaire du site."
diff --git a/app/code/Magento/Downloadable/i18n/nl_NL.csv b/app/code/Magento/Downloadable/i18n/nl_NL.csv
index 38b5197ef69..3f50dc48ba2 100644
--- a/app/code/Magento/Downloadable/i18n/nl_NL.csv
+++ b/app/code/Magento/Downloadable/i18n/nl_NL.csv
@@ -1,7 +1,7 @@
 "Add","Toevoegen"
 "Add New Row","Voeg Nieuwe Rij Toe"
 "Add links and samples to downloadable product","Voeg links en voorbeelden toe aan te downloaden product"
-"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.","Alfanumerieke, schuine streep en onderstreepte lettertekens worden aangeraden voor bestandsnamen. Ongeschikte lettertekens worden vervangen met \'_\'."
+"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with '_'.","Alfanumerieke, schuine streep en onderstreepte lettertekens worden aangeraden voor bestandsnamen. Ongeschikte lettertekens worden vervangen met '_'."
 "An error occurred while getting requested content. Please contact the store owner.","Er is een fout opgetreden bij het ophalen van de gevraagde content. Neem alstublieft contact op met de winkeleigenaar."
 "An error occurred while getting the requested content.","Er is een fout opgetreden bij het ophalen van de gevraagde content."
 "An error occurred while getting the requested content. Please contact the store owner.","Er is een fout opgetreden bij het ophalen van de gevraagde content. Neem alstublieft contact op met de winkeleigenaar."
diff --git a/app/code/Magento/Downloadable/i18n/pt_BR.csv b/app/code/Magento/Downloadable/i18n/pt_BR.csv
index 8558da76c58..d728427b30b 100644
--- a/app/code/Magento/Downloadable/i18n/pt_BR.csv
+++ b/app/code/Magento/Downloadable/i18n/pt_BR.csv
@@ -1,7 +1,7 @@
 "Add","Adicionar"
 "Add New Row","Adicionar Nova Linha"
 "Add links and samples to downloadable product","Adicionar links e amostras de produto para download"
-"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.","Caracteres alfanuméricos, traço e sublinhado são recomendados para nomes de arquivos. Caracteres impróprios são substituídos por \'_\'."
+"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with '_'.","Caracteres alfanuméricos, traço e sublinhado são recomendados para nomes de arquivos. Caracteres impróprios são substituídos por '_'."
 "An error occurred while getting requested content. Please contact the store owner.","Ocorreu um erro ao obter o conteúdo solicitado. Por favor contate o proprietário da loja."
 "An error occurred while getting the requested content.","Ocorreu um erro ao obter o conteúdo solicitado."
 "An error occurred while getting the requested content. Please contact the store owner.","Ocorreu um erro ao obter o conteúdo solicitado. Por favor contate o proprietário da loja."
diff --git a/app/code/Magento/Downloadable/i18n/zh_CN.csv b/app/code/Magento/Downloadable/i18n/zh_CN.csv
index 4e4ed829ccc..0b7be786272 100644
--- a/app/code/Magento/Downloadable/i18n/zh_CN.csv
+++ b/app/code/Magento/Downloadable/i18n/zh_CN.csv
@@ -1,7 +1,7 @@
 "Add","添加"
 "Add New Row","添加新行"
 "Add links and samples to downloadable product","为可下载产品添加链接与范例"
-"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.","建议对文件名使用字母、横线,以及下划线字符。错误的字符将被使用 \'_\'替换。"
+"Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with '_'.","建议对文件名使用字母、横线,以及下划线字符。错误的字符将被使用 '_'替换。"
 "An error occurred while getting requested content. Please contact the store owner.","获取所请求内容时出错。请联系店铺所有者。"
 "An error occurred while getting the requested content.","获取所请求的内容时出错。"
 "An error occurred while getting the requested content. Please contact the store owner.","获取所请求的内容时出错。请联系店铺所有者。"
diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php
index bb6a45e97f6..ee86f3edde8 100644
--- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php
+++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php
@@ -70,7 +70,7 @@ abstract class AbstractMain
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Eav\Helper\Data $eavData
      * @param \Magento\Backend\Model\Config\Source\YesnoFactory $yesnoFactory
@@ -80,7 +80,7 @@ abstract class AbstractMain
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Eav\Helper\Data $eavData,
         \Magento\Backend\Model\Config\Source\YesnoFactory $yesnoFactory,
diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Labels.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Labels.php
index 22d9a3860be..aae5663aabf 100644
--- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Labels.php
+++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Labels.php
@@ -35,7 +35,7 @@ namespace Magento\Eav\Block\Adminhtml\Attribute\Edit\Options;
 class Labels extends \Magento\Backend\Block\Template
 {
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
@@ -46,12 +46,12 @@ class Labels extends \Magento\Backend\Block\Template
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         parent::__construct($context, $data);
diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php
index 02ff1458558..5c91e805910 100644
--- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php
+++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php
@@ -38,7 +38,7 @@ use Magento\Core\Model\Resource\Store\Collection;
 class Options extends \Magento\Backend\Block\Template
 {
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
@@ -59,14 +59,14 @@ class Options extends \Magento\Backend\Block\Template
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory
      * @param \Magento\Validator\UniversalFactory $universalFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory,
         \Magento\Validator\UniversalFactory $universalFactory,
         array $data = array()
diff --git a/app/code/Magento/Eav/Helper/Data.php b/app/code/Magento/Eav/Helper/Data.php
index a50aab19cca..4f80bb99807 100644
--- a/app/code/Magento/Eav/Helper/Data.php
+++ b/app/code/Magento/Eav/Helper/Data.php
@@ -59,18 +59,26 @@ class Data extends \Magento\App\Helper\AbstractHelper
      */
     protected $_attributeConfig;
 
+    /**
+     * @var \Magento\Eav\Model\Config
+     */
+    protected $_eavConfig;
+
     /**
      * @param \Magento\App\Helper\Context $context
      * @param \Magento\Eav\Model\Entity\Attribute\Config $attributeConfig
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
+     * @param \Magento\Eav\Model\Config $eavConfig
      */
     public function __construct(
         \Magento\App\Helper\Context $context,
         \Magento\Eav\Model\Entity\Attribute\Config $attributeConfig,
-        \Magento\Core\Model\Store\Config $coreStoreConfig
+        \Magento\Core\Model\Store\Config $coreStoreConfig,
+        \Magento\Eav\Model\Config $eavConfig
     ) {
         $this->_coreStoreConfig = $coreStoreConfig;
         $this->_attributeConfig = $attributeConfig;
+        $this->_eavConfig = $eavConfig;
         parent::__construct($context);
     }
 
@@ -164,4 +172,25 @@ class Data extends \Magento\App\Helper\AbstractHelper
     {
         return $this->_coreStoreConfig->getConfig(self::XML_PATH_VALIDATOR_DATA_INPUT_TYPES);
     }
+
+    /**
+     * Retrieve attribute metadata.
+     *
+     * @param string $entityTypeCode
+     * @param string $attributeCode
+     * @return array <pre>[
+     *      'entity_type_id' => $entityTypeId,
+     *      'attribute_id' => $attributeId,
+     *      'attribute_table' => $attributeTable
+     * ]</pre>
+     */
+    public function getAttributeMetadata($entityTypeCode, $attributeCode)
+    {
+        $attribute = $this->_eavConfig->getAttribute($entityTypeCode, $attributeCode);
+        return [
+            'entity_type_id' => $attribute->getEntityTypeId(),
+            'attribute_id' => $attribute->getAttributeId(),
+            'attribute_table' => $attribute->getBackend()->getTable(),
+        ];
+    }
 }
diff --git a/app/code/Magento/Eav/Model/Adminhtml/System/Config/Source/Inputtype.php b/app/code/Magento/Eav/Model/Adminhtml/System/Config/Source/Inputtype.php
index adfa4def53c..7a8316005e2 100644
--- a/app/code/Magento/Eav/Model/Adminhtml/System/Config/Source/Inputtype.php
+++ b/app/code/Magento/Eav/Model/Adminhtml/System/Config/Source/Inputtype.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Eav\Model\Adminhtml\System\Config\Source;
 
-class Inputtype implements \Magento\Core\Model\Option\ArrayInterface
+class Inputtype implements \Magento\Option\ArrayInterface
 {
     /**
      * Return array of options
diff --git a/app/code/Magento/Eav/Model/Attribute/Data/Text.php b/app/code/Magento/Eav/Model/Attribute/Data/Text.php
index 8330b631082..967bc8ab4ab 100644
--- a/app/code/Magento/Eav/Model/Attribute/Data/Text.php
+++ b/app/code/Magento/Eav/Model/Attribute/Data/Text.php
@@ -37,7 +37,7 @@ use Magento\App\RequestInterface;
 class Text extends \Magento\Eav\Model\Attribute\Data\AbstractData
 {
     /**
-     * @var \Magento\Core\Helper\String
+     * @var \Magento\Stdlib\String
      */
     protected $_string;
 
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute.php b/app/code/Magento/Eav/Model/Entity/Attribute.php
index 21e8828fe20..5f203ea9e7c 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute.php
@@ -74,8 +74,8 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute
     protected $_catalogProductFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Helper\Data $coreData
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory
@@ -89,8 +89,8 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Helper\Data $coreData,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory,
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php
index e62a57013b2..1b22e7f784e 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php
@@ -120,8 +120,8 @@ abstract class AbstractAttribute
     protected $_universalFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Helper\Data $coreData
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory
@@ -133,8 +133,8 @@ abstract class AbstractAttribute
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Helper\Data $coreData,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory,
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php
index 3b19e293b12..f5a0a85bce8 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php
@@ -80,8 +80,8 @@ class Set extends \Magento\Core\Model\AbstractModel
     protected $_resourceAttribute;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Eav\Model\Entity\Attribute\GroupFactory $attrGroupFactory
      * @param \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory
@@ -91,8 +91,8 @@ class Set extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Eav\Model\Entity\Attribute\GroupFactory $attrGroupFactory,
         \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory,
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/AbstractSource.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/AbstractSource.php
index 66d9c151a2c..63e5880217d 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/AbstractSource.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/AbstractSource.php
@@ -33,7 +33,7 @@ namespace Magento\Eav\Model\Entity\Attribute\Source;
  * @author     Magento Core Team <core@magentocommerce.com>
  */
 abstract class AbstractSource
-    implements \Magento\Eav\Model\Entity\Attribute\Source\SourceInterface, \Magento\Core\Model\Option\ArrayInterface
+    implements \Magento\Eav\Model\Entity\Attribute\Source\SourceInterface, \Magento\Option\ArrayInterface
 {
     /**
      * Reference to the attribute instance
diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php
index ca9da43215a..c3676831f03 100644
--- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php
+++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php
@@ -1097,7 +1097,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db
      */
     public function _loadEntities($printQuery = false, $logQuery = false)
     {
-        $entity = $this->getEntity();
+        $this->getEntity();
 
         if ($this->_pageSize) {
             $this->getSelect()->limitPage($this->getCurPage(), $this->_pageSize);
@@ -1546,4 +1546,38 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db
     {
         return array_keys($this->_items);
     }
+
+    /**
+     * Clear collection
+     * @return $this
+     */
+    public function clear()
+    {
+        $this->_itemsById = array();
+        return parent::clear();
+    }
+
+    /**
+     * Remove all items from collection
+     * @return $this
+     */
+    public function removeAllItems()
+    {
+        $this->_itemsById = array();
+        return parent::removeAllItems();
+    }
+
+    /**
+     * Remove item from collection by item key
+     *
+     * @param mixed $key
+     * @return $this
+     */
+    public function removeItemByKey($key)
+    {
+        if (isset($this->_items[$key])) {
+            unset($this->_itemsById[$this->_items[$key]->getId()]);
+        }
+        return parent::removeItemByKey($key);
+    }
 }
diff --git a/app/code/Magento/Eav/Model/Entity/Type.php b/app/code/Magento/Eav/Model/Entity/Type.php
index 96a28539427..1645cd88521 100644
--- a/app/code/Magento/Eav/Model/Entity/Type.php
+++ b/app/code/Magento/Eav/Model/Entity/Type.php
@@ -103,8 +103,8 @@ class Type extends \Magento\Core\Model\AbstractModel
     protected $_universalFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory
      * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $attSetFactory
      * @param \Magento\Eav\Model\Entity\StoreFactory $storeFactory
@@ -114,8 +114,8 @@ class Type extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory,
         \Magento\Eav\Model\Entity\Attribute\SetFactory $attSetFactory,
         \Magento\Eav\Model\Entity\StoreFactory $storeFactory,
diff --git a/app/code/Magento/Eav/Model/Form/Element.php b/app/code/Magento/Eav/Model/Form/Element.php
index 3dc2c829d77..ea60b5c88d6 100644
--- a/app/code/Magento/Eav/Model/Form/Element.php
+++ b/app/code/Magento/Eav/Model/Form/Element.php
@@ -59,16 +59,16 @@ class Element extends \Magento\Core\Model\AbstractModel
     protected $_eavConfig;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Eav/Model/Form/Fieldset.php b/app/code/Magento/Eav/Model/Form/Fieldset.php
index 4fb96b91f8b..c2577394a6d 100644
--- a/app/code/Magento/Eav/Model/Form/Fieldset.php
+++ b/app/code/Magento/Eav/Model/Form/Fieldset.php
@@ -55,16 +55,16 @@ class Fieldset extends \Magento\Core\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Eav/Model/Form/Type.php b/app/code/Magento/Eav/Model/Form/Type.php
index 89b8a3a3bfb..9410aa0884d 100644
--- a/app/code/Magento/Eav/Model/Form/Type.php
+++ b/app/code/Magento/Eav/Model/Form/Type.php
@@ -64,8 +64,8 @@ class Type extends \Magento\Core\Model\AbstractModel
     protected $_elementFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Eav\Model\Form\FieldsetFactory $fieldsetFactory
      * @param \Magento\Eav\Model\Form\ElementFactory $elementFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -73,8 +73,8 @@ class Type extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Eav\Model\Form\FieldsetFactory $fieldsetFactory,
         \Magento\Eav\Model\Form\ElementFactory $elementFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php
index 090b316c34f..5d1430865e8 100644
--- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php
+++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php
@@ -38,7 +38,7 @@ class Collection
     extends \Magento\Eav\Model\Resource\Entity\Attribute\Set\Collection
 {
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registryManager;
 
@@ -47,7 +47,7 @@ class Collection
      * @param \Magento\Logger $logger
      * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
      * @param \Magento\Event\ManagerInterface $eventManager
-     * @param \Magento\Core\Model\Registry $registryManager
+     * @param \Magento\Registry $registryManager
      * @param mixed $connection
      * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource
      */
@@ -56,7 +56,7 @@ class Collection
         \Magento\Logger $logger,
         \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
         \Magento\Event\ManagerInterface $eventManager,
-        \Magento\Core\Model\Registry $registryManager,
+        \Magento\Registry $registryManager,
         $connection = null,
         \Magento\Core\Model\Resource\Db\AbstractDb $resource = null
     ) {
diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php
index b1e80c09b20..8a01cbab827 100644
--- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php
+++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php
@@ -144,14 +144,14 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl
     }
 
     /**
-     * Add option id(s) frilter to collection
+     * Add option id(s) filter to collection
      *
      * @param int|array $optionId
      * @return $this
      */
     public function setIdFilter($optionId)
     {
-        return $this->addFieldToFilter('option_id', array('in' => $optionId));
+        return $this->addFieldToFilter('main_table.option_id', array('in' => $optionId));
     }
 
     /**
diff --git a/app/code/Magento/Eav/i18n/de_DE.csv b/app/code/Magento/Eav/i18n/de_DE.csv
index 22a5a022bea..d4dce2922b8 100644
--- a/app/code/Magento/Eav/i18n/de_DE.csv
+++ b/app/code/Magento/Eav/i18n/de_DE.csv
@@ -41,7 +41,7 @@
 "Attribute object is undefined","Attributobjekt ist undefiniert"
 "Attribute set with the ""%s"" name already exists.","Attributset mit dem Namen ""%s"" besteht bereits."
 "Attribute with the same code","Attribut mit dem gleichen Code"
-"Can\'t create table: %s","Kann keine Tabelle erstellen: %s"
+"Can't create table: %s","Kann keine Tabelle erstellen: %s"
 "Catalog Input Type for Store Owner","Katalog Eingabetyp für Shopbesitzer"
 "Current module EAV entity is undefined","Aktuelles Modul EAV-Einheit ist nicht definiert"
 "Current module pathname is undefined","Der derzeitige Modulpfad ist undefiniert"
@@ -107,7 +107,7 @@
 "System","System"
 "Text Area","Textbereich"
 "Text Field","Textfeld"
-"The attribute code \'%s\' is reserved by system. Please try another attribute code","Der Attributcode \'%s\' wurde vom System reserviert. Bitte probieren Sie einen anderen Attributcode aus."
+"The attribute code '%s' is reserved by system. Please try another attribute code","Der Attributcode '%s' wurde vom System reserviert. Bitte probieren Sie einen anderen Attributcode aus."
 "The value of attribute ""%s"" must be unique","Der Wert des Attributs ""%s"" muss einzigartig sein."
 "The value of attribute ""%s"" must be unique.","Der Wert des Attributs ""%s"" muss einzigartig sein."
 "URL","URL"
diff --git a/app/code/Magento/Eav/i18n/en_US.csv b/app/code/Magento/Eav/i18n/en_US.csv
index cc86ab14969..87734b83156 100644
--- a/app/code/Magento/Eav/i18n/en_US.csv
+++ b/app/code/Magento/Eav/i18n/en_US.csv
@@ -41,7 +41,7 @@
 "Attribute object is undefined","Attribute object is undefined"
 "Attribute set with the ""%s"" name already exists.","Attribute set with the ""%s"" name already exists."
 "Attribute with the same code","Attribute with the same code"
-"Can\'t create table: %s","Can\'t create table: %s"
+"Can't create table: %s","Can't create table: %s"
 "Catalog Input Type for Store Owner","Catalog Input Type for Store Owner"
 "Current module EAV entity is undefined","Current module EAV entity is undefined"
 "Current module pathname is undefined","Current module pathname is undefined"
@@ -107,7 +107,7 @@
 "System","System"
 "Text Area","Text Area"
 "Text Field","Text Field"
-"The attribute code \'%s\' is reserved by system. Please try another attribute code","The attribute code \'%s\' is reserved by system. Please try another attribute code"
+"The attribute code '%s' is reserved by system. Please try another attribute code","The attribute code '%s' is reserved by system. Please try another attribute code"
 "The value of attribute ""%s"" must be unique","The value of attribute ""%s"" must be unique"
 "The value of attribute ""%s"" must be unique.","The value of attribute ""%s"" must be unique."
 "URL","URL"
diff --git a/app/code/Magento/Eav/i18n/es_ES.csv b/app/code/Magento/Eav/i18n/es_ES.csv
index 0bd271735d9..250578defc4 100644
--- a/app/code/Magento/Eav/i18n/es_ES.csv
+++ b/app/code/Magento/Eav/i18n/es_ES.csv
@@ -41,7 +41,7 @@
 "Attribute object is undefined","Objeto de campo indefinido"
 "Attribute set with the ""%s"" name already exists.","El atributo fijado con el nombre ""%s"" ya existe."
 "Attribute with the same code","Atributo con el mismo código"
-"Can\'t create table: %s","No se puede crear la tabla: %s"
+"Can't create table: %s","No se puede crear la tabla: %s"
 "Catalog Input Type for Store Owner","Tipo de entrada de catálogo para el dueño de la tienda"
 "Current module EAV entity is undefined","Entidad de módulo EAV actual indefinida"
 "Current module pathname is undefined","Módulo URL actual indefinido"
@@ -107,7 +107,7 @@
 "System","Sistema"
 "Text Area","Área de Texto"
 "Text Field","Campo de Texto"
-"The attribute code \'%s\' is reserved by system. Please try another attribute code","El código de atributo \'%s\' está reservado por el sistema. Por favor, prueba con otro código de atributo"
+"The attribute code '%s' is reserved by system. Please try another attribute code","El código de atributo '%s' está reservado por el sistema. Por favor, prueba con otro código de atributo"
 "The value of attribute ""%s"" must be unique","El valor del atributo ""%s"" tiene que ser único"
 "The value of attribute ""%s"" must be unique.","El valor del atributo ""%s"" tiene que ser único."
 "URL","URL"
diff --git a/app/code/Magento/Eav/i18n/fr_FR.csv b/app/code/Magento/Eav/i18n/fr_FR.csv
index bed65a5677c..dee07cd04a8 100644
--- a/app/code/Magento/Eav/i18n/fr_FR.csv
+++ b/app/code/Magento/Eav/i18n/fr_FR.csv
@@ -41,7 +41,7 @@
 "Attribute object is undefined","L'attribut de l'objet n'est pas défini"
 "Attribute set with the ""%s"" name already exists.","Un attribut avec le nom ""%s"" existe déjà."
 "Attribute with the same code","Attribut avec le même code"
-"Can\'t create table: %s","Ne peut pas créer la table : %s"
+"Can't create table: %s","Ne peut pas créer la table : %s"
 "Catalog Input Type for Store Owner","Type d'entrée de catalogue pour le propriétaire de la boutique"
 "Current module EAV entity is undefined","L'entité de module actuelle EAV n'est pas définie"
 "Current module pathname is undefined","Le nom du répertoire du module actuel n'est pas défini"
@@ -107,7 +107,7 @@
 "System","Système"
 "Text Area","Zone de texte"
 "Text Field","Champ de texte"
-"The attribute code \'%s\' is reserved by system. Please try another attribute code","Le code d'attribut  \'%s\' est réservé par le système. Veuillez essayer un autre code"
+"The attribute code '%s' is reserved by system. Please try another attribute code","Le code d'attribut  '%s' est réservé par le système. Veuillez essayer un autre code"
 "The value of attribute ""%s"" must be unique","La valeur de l'attribut ""%s"" doit être unique"
 "The value of attribute ""%s"" must be unique.","La valeur de l'attribut ""%s"" doit être unique."
 "URL","URL"
diff --git a/app/code/Magento/Eav/i18n/nl_NL.csv b/app/code/Magento/Eav/i18n/nl_NL.csv
index 0e58223045a..fc59d4a4f3f 100644
--- a/app/code/Magento/Eav/i18n/nl_NL.csv
+++ b/app/code/Magento/Eav/i18n/nl_NL.csv
@@ -41,7 +41,7 @@
 "Attribute object is undefined","Attribuut object is ongedefinieerd"
 "Attribute set with the ""%s"" name already exists.","Attributenset met naam ""%s"" bestaat al."
 "Attribute with the same code","Attribuut met zelfde code"
-"Can\'t create table: %s","Kan geen tabel creëren: %s"
+"Can't create table: %s","Kan geen tabel creëren: %s"
 "Catalog Input Type for Store Owner","Catalogus Input Type voor Winkeleigenaar"
 "Current module EAV entity is undefined","Huidige module EAV eenheid in ongedefinieerd"
 "Current module pathname is undefined","Huidige module padnaam is ongedefinieerd"
@@ -107,7 +107,7 @@
 "System","Systeem"
 "Text Area","Tekstgebied"
 "Text Field","Tekstveld"
-"The attribute code \'%s\' is reserved by system. Please try another attribute code","De attribuutcode \'%s\' is door het systeem gereserveerd. Probeer alsjeblieft een andere attribuutcode."
+"The attribute code '%s' is reserved by system. Please try another attribute code","De attribuutcode '%s' is door het systeem gereserveerd. Probeer alsjeblieft een andere attribuutcode."
 "The value of attribute ""%s"" must be unique","De waarde van attribuut ""%s"" moet uniek zijn"
 "The value of attribute ""%s"" must be unique.","De waarde van attribute ""%s"" moet uniek zijn."
 "URL","URL"
diff --git a/app/code/Magento/Eav/i18n/pt_BR.csv b/app/code/Magento/Eav/i18n/pt_BR.csv
index 4629f833bce..41e063a9973 100644
--- a/app/code/Magento/Eav/i18n/pt_BR.csv
+++ b/app/code/Magento/Eav/i18n/pt_BR.csv
@@ -41,7 +41,7 @@
 "Attribute object is undefined","Objeto do atributo é indefinido"
 "Attribute set with the ""%s"" name already exists.","Atributo definido com o nome ""%s"" já existe."
 "Attribute with the same code","Atributo com o mesmo código"
-"Can\'t create table: %s","Não é possível criar tabela: %s"
+"Can't create table: %s","Não é possível criar tabela: %s"
 "Catalog Input Type for Store Owner","Catálogo de Tipo de Entrada para Dono da Loja"
 "Current module EAV entity is undefined","Módulo de entidade EAV atual indefinido"
 "Current module pathname is undefined","Nome do caminho do módulo atual indefinido"
@@ -107,7 +107,7 @@
 "System","Sistema"
 "Text Area","Área de texto"
 "Text Field","Campo de texto"
-"The attribute code \'%s\' is reserved by system. Please try another attribute code","O código de atributo \'%s\' é reservado pelo sistema. Tente outro código de atributo"
+"The attribute code '%s' is reserved by system. Please try another attribute code","O código de atributo '%s' é reservado pelo sistema. Tente outro código de atributo"
 "The value of attribute ""%s"" must be unique","O valor do atributo ""%s"" tem de ser único."
 "The value of attribute ""%s"" must be unique.","O valor do atributo ""%s"" tem de ser único."
 "URL","URL"
diff --git a/app/code/Magento/Eav/i18n/zh_CN.csv b/app/code/Magento/Eav/i18n/zh_CN.csv
index 5d54aa8a219..d74c3a83478 100644
--- a/app/code/Magento/Eav/i18n/zh_CN.csv
+++ b/app/code/Magento/Eav/i18n/zh_CN.csv
@@ -41,7 +41,7 @@
 "Attribute object is undefined","属性对象未定义"
 "Attribute set with the ""%s"" name already exists.","使用“%s”为名的属性已存在。"
 "Attribute with the same code","使用相同代码的属性"
-"Can\'t create table: %s","无法创建表格:%s"
+"Can't create table: %s","无法创建表格:%s"
 "Catalog Input Type for Store Owner","店铺所有者的分类输出类型"
 "Current module EAV entity is undefined","当前模块EAV实体未定义"
 "Current module pathname is undefined","当前模块路径名未定义"
@@ -107,7 +107,7 @@
 "System","系统"
 "Text Area","文本区"
 "Text Field","文本字段"
-"The attribute code \'%s\' is reserved by system. Please try another attribute code","属性代码‘%s’已被系统预留。请尝试另一个属性代码"
+"The attribute code '%s' is reserved by system. Please try another attribute code","属性代码‘%s’已被系统预留。请尝试另一个属性代码"
 "The value of attribute ""%s"" must be unique","属性“%s”的值必须为唯一"
 "The value of attribute ""%s"" must be unique.","属性“%s”的值必须为唯一。"
 "URL","URL"
diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php b/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php
index c9b0322d3ef..db9c1d15cca 100644
--- a/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php
+++ b/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php
@@ -36,7 +36,7 @@ namespace Magento\Email\Block\Adminhtml\Template;
 class Edit extends \Magento\Backend\Block\Widget
 {
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registryManager;
 
@@ -75,7 +75,7 @@ class Edit extends \Magento\Backend\Block\Widget
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Json\EncoderInterface $jsonEncoder
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Backend\Model\Menu\Config $menuConfig
      * @param \Magento\Backend\Model\Config\Structure $configStructure
      * @param \Magento\Email\Model\Template\Config $emailConfig
@@ -85,7 +85,7 @@ class Edit extends \Magento\Backend\Block\Widget
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Json\EncoderInterface $jsonEncoder,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Backend\Model\Menu\Config $menuConfig,
         \Magento\Backend\Model\Config\Structure $configStructure,
         \Magento\Email\Model\Template\Config $emailConfig,
diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php b/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php
index d04321a6b97..75c642e0b79 100644
--- a/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php
+++ b/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php
@@ -44,7 +44,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\VariableFactory $variableFactory
      * @param \Magento\Email\Model\Source\Variables $variables
@@ -52,7 +52,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\VariableFactory $variableFactory,
         \Magento\Email\Model\Source\Variables $variables,
diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Filter/Type.php b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Filter/Type.php
index 631aeecc8a9..f9ee75c43c8 100644
--- a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Filter/Type.php
+++ b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Filter/Type.php
@@ -41,8 +41,8 @@ class Type extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select
      */
     protected static $_types = array(
         null => null,
-        \Magento\Email\Model\Template::TYPE_HTML => 'HTML',
-        \Magento\Email\Model\Template::TYPE_TEXT => 'Text',
+        \Magento\App\TemplateTypesInterface::TYPE_HTML => 'HTML',
+        \Magento\App\TemplateTypesInterface::TYPE_TEXT => 'Text',
     );
 
     /**
diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Type.php b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Type.php
index 9914474f69a..47511c3db31 100644
--- a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Type.php
+++ b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Type.php
@@ -40,8 +40,8 @@ class Type extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe
      * @var array
      */
     protected static $_types = array(
-        \Magento\Email\Model\Template::TYPE_HTML => 'HTML',
-        \Magento\Email\Model\Template::TYPE_TEXT => 'Text',
+        \Magento\App\TemplateTypesInterface::TYPE_HTML => 'HTML',
+        \Magento\App\TemplateTypesInterface::TYPE_TEXT => 'Text',
     );
 
     /**
diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php b/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php
index 2214cc2ee34..f3df50ff705 100644
--- a/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php
+++ b/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php
@@ -36,7 +36,7 @@ namespace Magento\Email\Block\Adminhtml\Template;
 class Preview extends \Magento\Backend\Block\Widget
 {
     /**
-     * @var \Magento\Core\Model\Input\Filter\MaliciousCode
+     * @var \Magento\Filter\Input\MaliciousCode
      */
     protected $_maliciousCode;
 
@@ -47,13 +47,13 @@ class Preview extends \Magento\Backend\Block\Widget
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Input\Filter\MaliciousCode $maliciousCode
+     * @param \Magento\Filter\Input\MaliciousCode $maliciousCode
      * @param \Magento\Email\Model\TemplateFactory $emailFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Input\Filter\MaliciousCode $maliciousCode,
+        \Magento\Filter\Input\MaliciousCode $maliciousCode,
         \Magento\Email\Model\TemplateFactory $emailFactory,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php b/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php
index 1fe3730df8a..7d07797f55a 100644
--- a/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php
+++ b/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php
@@ -37,17 +37,17 @@ class Template extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
@@ -152,7 +152,7 @@ class Template extends \Magento\Backend\App\Action
             }
 
             if ($request->getParam('_change_type_flag')) {
-                $template->setTemplateType(\Magento\Email\Model\Template::TYPE_TEXT);
+                $template->setTemplateType(\Magento\App\TemplateTypesInterface::TYPE_TEXT);
                 $template->setTemplateStyles('');
             }
 
diff --git a/app/code/Magento/Email/Model/BackendTemplate.php b/app/code/Magento/Email/Model/BackendTemplate.php
index a1252d2520a..9d4235c0700 100644
--- a/app/code/Magento/Email/Model/BackendTemplate.php
+++ b/app/code/Magento/Email/Model/BackendTemplate.php
@@ -42,9 +42,9 @@ class BackendTemplate extends Template
     private $_structure;
 
     /**
-     * @param \Magento\Core\Model\Context $context
+     * @param \Magento\Model\Context $context
      * @param \Magento\View\DesignInterface $design
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\App\Emulation $appEmulation
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\Filesystem $filesystem
@@ -60,9 +60,9 @@ class BackendTemplate extends Template
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
+        \Magento\Model\Context $context,
         \Magento\View\DesignInterface $design,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Core\Model\App\Emulation $appEmulation,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\Filesystem $filesystem,
diff --git a/app/code/Magento/Email/Model/Info.php b/app/code/Magento/Email/Model/Info.php
deleted file mode 100644
index ce03de10015..00000000000
--- a/app/code/Magento/Email/Model/Info.php
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category    Magento
- * @package     Magento_Email
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Email information model
- * Email message may contain addresses in any of these three fields:
- *  -To:  Primary recipients
- *  -Cc:  Carbon copy to secondary recipients and other interested parties
- *  -Bcc: Blind carbon copy to tertiary recipients who receive the message
- *        without anyone else (including the To, Cc, and Bcc recipients) seeing who the tertiary recipients are
- *
- * @category    Magento
- * @package     Magento_Email
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Email\Model;
-
-class Info extends \Magento\Object
-{
-    /**
-     * Name list of "Bcc" recipients
-     *
-     * @var string[]
-     */
-    protected $_bccNames = array();
-
-    /**
-     * Email list of "Bcc" recipients
-     *
-     * @var string[]
-     */
-    protected $_bccEmails = array();
-
-    /**
-     * Name list of "To" recipients
-     *
-     * @var string[]
-     */
-    protected $_toNames = array();
-
-    /**
-     * Email list of "To" recipients
-     *
-     * @var string[]
-     */
-    protected $_toEmails = array();
-
-
-    /**
-     * Add new "Bcc" recipient to current email
-     *
-     * @param string $email
-     * @param string|null $name
-     * @return $this
-     */
-    public function addBcc($email, $name = null)
-    {
-        $this->_bccNames[] = $name;
-        $this->_bccEmails[] = $email;
-        return $this;
-    }
-
-    /**
-     * Add new "To" recipient to current email
-     *
-     * @param string $email
-     * @param string|null $name
-     * @return $this
-     */
-    public function addTo($email, $name = null)
-    {
-        $this->_toNames[] = $name;
-        $this->_toEmails[] = $email;
-        return $this;
-    }
-
-    /**
-     * Get the name list of "Bcc" recipients
-     *
-     * @return string[]
-     */
-    public function getBccNames()
-    {
-        return $this->_bccNames;
-    }
-
-    /**
-     * Get the email list of "Bcc" recipients
-     *
-     * @return string[]
-     */
-    public function getBccEmails()
-    {
-        return $this->_bccEmails;
-    }
-
-    /**
-     * Get the name list of "To" recipients
-     *
-     * @return string[]
-     */
-    public function getToNames()
-    {
-        return $this->_toNames;
-    }
-
-    /**
-     * Get the email list of "To" recipients
-     *
-     * @return string[]
-     */
-    public function getToEmails()
-    {
-        return $this->_toEmails;
-    }
-}
diff --git a/app/code/Magento/Email/Model/Sender.php b/app/code/Magento/Email/Model/Sender.php
deleted file mode 100644
index aeb7681b37f..00000000000
--- a/app/code/Magento/Email/Model/Sender.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category    Magento
- * @package     Magento_Email
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Email\Model;
-
-/**
- * Common sender
- *
- * @category   Magento
- * @package    Magento_Email
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-class Sender
-{
-    /**
-     * @var \Magento\Email\Model\Template\Mailer
-     */
-    protected $_mailer;
-
-    /**
-     * @var \Magento\Email\Model\Info
-     */
-    protected $_emailInfo;
-
-    /**
-     * @var \Magento\Core\Model\Store
-     */
-    protected $_store;
-
-    /**
-     * @param \Magento\Email\Model\Template\Mailer $mailer
-     * @param \Magento\Email\Model\Info $info
-     * @param \Magento\Core\Model\StoreManagerInterface $storeManager
-     */
-    public function __construct(
-        \Magento\Email\Model\Template\Mailer $mailer,
-        \Magento\Email\Model\Info $info,
-        \Magento\Core\Model\StoreManagerInterface $storeManager
-    ) {
-        $this->_mailer = $mailer;
-        $this->_emailInfo = $info;
-        $this->_store = $storeManager->getStore();
-    }
-
-    /**
-     * @param string $email
-     * @param string $name
-     * @param string $template
-     * @param string $sender
-     * @param array $templateParams
-     * @param int $storeId
-     * @return $this
-     */
-    public function send($email, $name, $template, $sender, $templateParams, $storeId)
-    {
-        $this->_store->load($storeId);
-        $this->_emailInfo->addTo($email, $name);
-        $this->_mailer->addEmailInfo($this->_emailInfo);
-        $this->_mailer->setSender($this->_store->getConfig($sender, $this->_store->getId()));
-        $this->_mailer->setStoreId($this->_store->getId());
-        $this->_mailer->setTemplateId($this->_store->getConfig($template, $this->_store->getId()));
-        $this->_mailer->setTemplateParams($templateParams);
-        $this->_mailer->send();
-        return $this;
-    }
-}
diff --git a/app/code/Magento/Email/Model/Source/Variables.php b/app/code/Magento/Email/Model/Source/Variables.php
index 4c07c230f4e..cf8e873889d 100644
--- a/app/code/Magento/Email/Model/Source/Variables.php
+++ b/app/code/Magento/Email/Model/Source/Variables.php
@@ -32,7 +32,7 @@ namespace Magento\Email\Model\Source;
  * @package    Magento_Email
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-class Variables implements \Magento\Core\Model\Option\ArrayInterface
+class Variables implements \Magento\Option\ArrayInterface
 {
     /**
      * Assoc array of configuration variables
diff --git a/app/code/Magento/Email/Model/Template.php b/app/code/Magento/Email/Model/Template.php
index 335f8b39a85..864dc2ca7d7 100644
--- a/app/code/Magento/Email/Model/Template.php
+++ b/app/code/Magento/Email/Model/Template.php
@@ -71,7 +71,7 @@ use Magento\Filter\Template as FilterTemplate;
  *
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  */
-class Template extends \Magento\Core\Model\Template
+class Template extends \Magento\Core\Model\Template implements  \Magento\Mail\TemplateInterface
 {
     /**
      * Configuration path for default email templates
@@ -121,6 +121,11 @@ class Template extends \Magento\Core\Model\Template
      */
     protected $_replyTo = '';
 
+    /**
+     * @var array
+     */
+    protected $_vars = array();
+
     /**
      * @var \Exception|null
      */
@@ -163,15 +168,9 @@ class Template extends \Magento\Core\Model\Template
     protected $_emailFilterFactory;
 
     /**
-     * Types of template
-     */
-    const TYPE_TEXT = 1;
-    const TYPE_HTML = 2;
-
-    /**
-     * @param \Magento\Core\Model\Context $context
+     * @param \Magento\Model\Context $context
      * @param \Magento\View\DesignInterface $design
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\App\Emulation $appEmulation
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\Filesystem $filesystem
@@ -179,16 +178,16 @@ class Template extends \Magento\Core\Model\Template
      * @param \Magento\View\FileSystem $viewFileSystem
      * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig
      * @param \Magento\App\ConfigInterface $coreConfig
-     * @param \Magento\Email\Model\Template\FilterFactory $emailFilterFactory
-     * @param \Magento\Email\Model\Template\Config $emailConfig
+     * @param Template\FilterFactory $emailFilterFactory
+     * @param Template\Config $emailConfig
      * @param array $data
      *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
+        \Magento\Model\Context $context,
         \Magento\View\DesignInterface $design,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Core\Model\App\Emulation $appEmulation,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\Filesystem $filesystem,
@@ -270,16 +269,6 @@ class Template extends \Magento\Core\Model\Template
         return $store->getFrontendName();
     }
 
-    /**
-     * Retrieve mail object instance
-     *
-     * @return \Zend_Mail
-     */
-    protected function _getMail()
-    {
-        return new \Zend_Mail('utf-8');
-    }
-
     /**
      * Declare template processing filter
      *
@@ -402,7 +391,12 @@ class Template extends \Magento\Core\Model\Template
      */
     public function getType()
     {
-        return $this->getTemplateType();
+        $templateType = $this->getTemplateType();
+        if (is_null($templateType) && $this->getId()) {
+            $templateType = $this->_emailConfig->getTemplateType($this->getId());
+            $templateType = $templateType == 'html' ? self::TYPE_HTML : self::TYPE_TEXT;
+        }
+        return $templateType;
     }
 
     /**
@@ -410,7 +404,7 @@ class Template extends \Magento\Core\Model\Template
      *
      * @param array $variables
      * @return string
-     * @throws \Exception
+     * @throws \Magento\Mail\Exception
      */
     public function getProcessedTemplate(array $variables = array())
     {
@@ -443,9 +437,8 @@ class Template extends \Magento\Core\Model\Template
                 ->filter($this->getPreparedTemplateText());
         } catch (\Exception $e) {
             $this->_cancelDesignConfig();
-            throw $e;
+            throw new \Magento\Mail\Exception($e->getMessage(), $e->getCode(), $e);
         }
-        $this->_cancelDesignConfig();
         return $processedResult;
     }
 
@@ -481,101 +474,6 @@ class Template extends \Magento\Core\Model\Template
         return $includeTemplate->getProcessedTemplate($variables);
     }
 
-    /**
-     * Send mail to recipient
-     *
-     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
-     * @SuppressWarnings(PHPMD.NPathComplexity)
-     * @param array|string $email E-mail(s)
-     * @param array|string|null $name receiver name(s)
-     * @param array $variables template variables
-     * @return bool
-     */
-    public function send($email, $name = null, array $variables = array())
-    {
-        if (!$this->isValidForSend()) {
-            $this->_logger->logException(
-                new \Exception('This letter cannot be sent.') // translation is intentionally omitted
-            );
-            return false;
-        }
-
-        $emails = array_values((array)$email);
-        $names = is_array($name) ? $name : (array)$name;
-        $names = array_values($names);
-        foreach ($emails as $key => $email) {
-            if (!isset($names[$key])) {
-                $names[$key] = substr($email, 0, strpos($email, '@'));
-            }
-        }
-
-        $variables['email'] = reset($emails);
-        $variables['name'] = reset($names);
-
-        ini_set('SMTP', $this->_coreStoreConfig->getConfig('system/smtp/host'));
-        ini_set('smtp_port', $this->_coreStoreConfig->getConfig('system/smtp/port'));
-
-        $mail = $this->_getMail();
-        foreach ($this->_bcc as $bcc) {
-            $mail->addBcc($bcc);
-        }
-        if ($this->_returnPath) {
-            $mail->setReturnPath($this->_returnPath);
-        }
-        if ($this->_replyTo) {
-            $mail->setReplyTo($this->_replyTo);
-        }
-
-        $setReturnPath = $this->_coreStoreConfig->getConfig(self::XML_PATH_SENDING_SET_RETURN_PATH);
-        switch ($setReturnPath) {
-            case 1:
-                $returnPathEmail = $this->getSenderEmail();
-                break;
-            case 2:
-                $returnPathEmail = $this->_coreStoreConfig->getConfig(self::XML_PATH_SENDING_RETURN_PATH_EMAIL);
-                break;
-            default:
-                $returnPathEmail = null;
-                break;
-        }
-
-        if ($returnPathEmail !== null) {
-            $mailTransport = new \Zend_Mail_Transport_Sendmail("-f" . $returnPathEmail);
-            \Zend_Mail::setDefaultTransport($mailTransport);
-        }
-
-        foreach ($emails as $key => $email) {
-            $mail->addTo($email, '=?utf-8?B?' . base64_encode($names[$key]) . '?=');
-        }
-
-        $this->setUseAbsoluteLinks(true);
-        $text = $this->getProcessedTemplate($variables, true);
-
-        if ($this->isPlain()) {
-            $mail->setBodyText($text);
-        } else {
-            $mail->setBodyHTML($text);
-        }
-
-        $mail->setSubject('=?utf-8?B?' . base64_encode($this->getProcessedTemplateSubject($variables)) . '?=');
-        $mail->setFrom($this->getSenderEmail(), $this->getSenderName());
-
-        $result = false;
-        $this->_sendingException = null;
-        try {
-            $mail->send();
-            $result = true;
-        } catch (\Exception $e) {
-            $this->_logger->logException($e);
-            $this->_sendingException = $e;
-        }
-        $this->_bcc = array();
-        $this->_returnPath = '';
-        $this->_replyTo = '';
-
-        return $result;
-    }
-
     /**
      * Get exception, generated during send() method
      *
@@ -586,60 +484,12 @@ class Template extends \Magento\Core\Model\Template
         return $this->_sendingException;
     }
 
-    /**
-     * Send transactional email to recipient
-     *
-     * @param int|string $templateId
-     * @param string|array $sender sender information, can be declared as part of config path
-     * @param string $email recipient email
-     * @param string $name recipient name
-     * @param array $vars variables which can be used in template
-     * @param int|null $storeId
-     * @return $this
-     * @throws Exception
-     */
-    public function sendTransactional($templateId, $sender, $email, $name, $vars = array(), $storeId = null)
-    {
-        $this->setSentSuccess(false);
-        if (($storeId === null) && $this->getDesignConfig()->getStore()) {
-            $storeId = $this->getDesignConfig()->getStore();
-        }
-
-        if (is_numeric($templateId)) {
-            $this->load($templateId);
-        } else {
-            $this->loadDefault($templateId);
-        }
-
-        if (!$this->getId()) {
-            throw new Exception(__('Invalid transactional email code: %1', $templateId));
-        }
-
-        if (!is_array($sender)) {
-            $this->setSenderName(
-                $this->_coreStoreConfig->getConfig('trans_email/ident_' . $sender . '/name', $storeId)
-            );
-            $this->setSenderEmail(
-                $this->_coreStoreConfig->getConfig('trans_email/ident_' . $sender . '/email', $storeId)
-            );
-        } else {
-            $this->setSenderName($sender['name']);
-            $this->setSenderEmail($sender['email']);
-        }
-
-        if (!isset($vars['store'])) {
-            $vars['store'] = $this->_storeManager->getStore($storeId);
-        }
-        $this->setSentSuccess($this->send($email, $name, $vars));
-        return $this;
-    }
-
     /**
      * Process email subject
      *
      * @param array $variables
      * @return string
-     * @throws \Exception
+     * @throws \Magento\Mail\Exception
      */
     public function getProcessedTemplateSubject(array $variables)
     {
@@ -658,7 +508,7 @@ class Template extends \Magento\Core\Model\Template
                 ->filter($this->getTemplateSubject());
         } catch (\Exception $e) {
             $this->_cancelDesignConfig();
-            throw $e;
+            throw new \Magento\Mail\Exception($e->getMessage(), $e->getCode(), $e);
         }
         $this->_cancelDesignConfig();
         return $processedResult;
@@ -746,18 +596,85 @@ class Template extends \Magento\Core\Model\Template
     /**
      * Validate email template code
      *
-     * @throws Exception
+     * @throws \Magento\Mail\Exception
      * @return $this
      */
     protected function _beforeSave()
     {
         $code = $this->getTemplateCode();
         if (empty($code)) {
-            throw new Exception(__('The template Name must not be empty.'));
+            throw new \Magento\Mail\Exception(__('The template Name must not be empty.'));
         }
         if ($this->_getResource()->checkCodeUsage($this)) {
-            throw new Exception(__('Duplicate Of Template Name'));
+            throw new \Magento\Mail\Exception(__('Duplicate Of Template Name'));
         }
         return parent::_beforeSave();
     }
+
+    /**
+     * Get processed template
+     *
+     * @return string
+     * @throws \Magento\Mail\Exception
+     */
+    public function processTemplate()
+    {
+        $templateId = $this->getId();
+        if (is_numeric($templateId)) {
+            $this->load($templateId);
+        } else {
+            $this->loadDefault($templateId);
+        }
+
+        if (!$this->getId()) {
+            throw new \Magento\Mail\Exception(__('Invalid transactional email code: %1', $templateId));
+        }
+
+        $this->setUseAbsoluteLinks(true);
+        $text = $this->getProcessedTemplate($this->_getVars(), true);
+        return $text;
+    }
+
+    /**
+     * Get processed subject
+     *
+     * @return string
+     */
+    public function getSubject()
+    {
+        return $this->getProcessedTemplateSubject($this->_getVars());
+    }
+
+    /**
+     * Set template variables
+     *
+     * @param array $vars
+     * @return $this
+     */
+    public function setVars(array $vars)
+    {
+        $this->_vars = $vars;
+        return $this;
+    }
+
+    /**
+     * Set template options
+     *
+     * @param array $options
+     * @return $this
+     */
+    public function setOptions(array $options)
+    {
+        return $this->setDesignConfig($options);
+    }
+
+    /**
+     * Retrieve template variables
+     *
+     * @return array
+     */
+    protected function _getVars()
+    {
+        return $this->_vars;
+    }
 }
diff --git a/app/code/Magento/Email/Model/Template/Mailer.php b/app/code/Magento/Email/Model/Template/Mailer.php
deleted file mode 100644
index 3725becbef4..00000000000
--- a/app/code/Magento/Email/Model/Template/Mailer.php
+++ /dev/null
@@ -1,195 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category    Magento
- * @package     Magento_Email
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Email\Model\Template;
-
-use Magento\Email\Model\Info;
-
-/**
- * Email Template Mailer Model
- *
- * @category    Magento
- * @package     Magento_Email
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Mailer extends \Magento\Object
-{
-    /**
-     * List of email infos
-     *
-     * @var array
-     * @see Info
-     */
-    protected $_emailInfos = array();
-
-    /**
-     * Email template factory
-     *
-     * @var \Magento\Email\Model\TemplateFactory
-     */
-    protected $_coreEmailTemplateFactory;
-
-    /**
-     * @param \Magento\Email\Model\TemplateFactory $coreEmailTemplateFactory
-     * @param array $data
-     */
-    public function __construct(
-        \Magento\Email\Model\TemplateFactory $coreEmailTemplateFactory,
-        array $data = array()
-    ) {
-        parent::__construct($data);
-        $this->_coreEmailTemplateFactory = $coreEmailTemplateFactory;
-    }
-
-    /**
-     * Add new email info to corresponding list
-     *
-     * @param Info $emailInfo
-     * @return $this
-     */
-    public function addEmailInfo(Info $emailInfo)
-    {
-        $this->_emailInfos[] = $emailInfo;
-        return $this;
-    }
-
-    /**
-     * Send all emails from email list
-     * @see self::$_emailInfos
-     *
-     * @return $this
-     */
-    public function send()
-    {
-        /** @var $emailTemplate \Magento\Email\Model\Template */
-        $emailTemplate = $this->_coreEmailTemplateFactory->create();
-        // Send all emails from corresponding list
-        while (!empty($this->_emailInfos)) {
-            $emailInfo = array_pop($this->_emailInfos);
-            // Handle "Bcc" recipients of the current email
-            $emailTemplate->addBcc($emailInfo->getBccEmails());
-            // Set required design parameters and delegate email sending to \Magento\Email\Model\Template
-            $designConfig = array(
-                'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
-                'store' => $this->getStoreId()
-            );
-            $emailTemplate->setDesignConfig($designConfig);
-
-            $emailTemplate->sendTransactional(
-                $this->getTemplateId(),
-                $this->getSender(),
-                $emailInfo->getToEmails(),
-                $emailInfo->getToNames(),
-                $this->getTemplateParams(),
-                $this->getStoreId()
-            );
-        }
-        return $this;
-    }
-
-    /**
-     * Set email sender
-     *
-     * @param string|array $sender
-     * @return $this
-     */
-    public function setSender($sender)
-    {
-        return $this->setData('sender', $sender);
-    }
-
-    /**
-     * Get email sender
-     *
-     * @return string|array|null
-     */
-    public function getSender()
-    {
-        return $this->_getData('sender');
-    }
-
-    /**
-     * Set store id
-     *
-     * @param int $storeId
-     * @return $this
-     */
-    public function setStoreId($storeId)
-    {
-        return $this->setData('store_id', $storeId);
-    }
-
-    /**
-     * Get store id
-     *
-     * @return int|null
-     */
-    public function getStoreId()
-    {
-        return $this->_getData('store_id');
-    }
-
-    /**
-     * Set template id
-     *
-     * @param int $templateId
-     * @return $this
-     */
-    public function setTemplateId($templateId)
-    {
-        return $this->setData('template_id', $templateId);
-    }
-
-    /**
-     * Get template id
-     *
-     * @return int|null
-     */
-    public function getTemplateId()
-    {
-        return $this->_getData('template_id');
-    }
-
-    /**
-     * Set template parameters
-     *
-     * @param array $templateParams
-     * @return $this
-     */
-    public function setTemplateParams(array $templateParams)
-    {
-        return $this->setData('template_params', $templateParams);
-    }
-
-    /**
-     * Get template parameters
-     *
-     * @return array|null
-     */
-    public function getTemplateParams()
-    {
-        return $this->_getData('template_params');
-    }
-}
diff --git a/app/code/Magento/Email/Model/Template/SenderResolver.php b/app/code/Magento/Email/Model/Template/SenderResolver.php
new file mode 100644
index 00000000000..0c05aa045d3
--- /dev/null
+++ b/app/code/Magento/Email/Model/Template/SenderResolver.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_Email
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Email\Model\Template;
+
+class SenderResolver implements \Magento\Mail\Template\SenderResolverInterface
+{
+    /**
+     * Core store config
+     *
+     * @var \Magento\Core\Model\Store\Config
+     */
+    protected $_storeConfig;
+
+    /**
+     * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig
+     */
+    public function __construct(
+        \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig
+    ) {
+        $this->_storeConfig = $coreStoreConfig;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function resolve($sender, $scopeId = null)
+    {
+        $result = array();
+
+        if (!is_array($sender)) {
+            $result['name'] = $this->_storeConfig->getConfig('trans_email/ident_' . $sender . '/name', $scopeId);
+            $result['email'] = $this->_storeConfig->getConfig('trans_email/ident_' . $sender . '/email', $scopeId);
+        } else {
+            $result = $sender;
+        }
+
+        if (!isset($result['name']) || !isset($result['email'])) {
+            throw new \Magento\Mail\Exception(__('Invalid sender data'));
+        }
+
+        return $result;
+    }
+}
diff --git a/app/code/Magento/Email/etc/di.xml b/app/code/Magento/Email/etc/di.xml
index 04b5c5f6238..0152107669b 100644
--- a/app/code/Magento/Email/etc/di.xml
+++ b/app/code/Magento/Email/etc/di.xml
@@ -24,7 +24,9 @@
  */
 -->
 <config>
+    <preference for="Magento\Mail\TemplateInterface" type="Magento\Email\Model\Template" />
+    <preference for="Magento\Mail\Template\FactoryInterface" type="Magento\Mail\Template\Factory" />
+    <preference for="Magento\Mail\TransportInterface" type="Magento\Mail\Transport" />
+    <preference for="Magento\Mail\MessageInterface" type="Magento\Mail\Message" />
+    <preference for="Magento\Mail\Template\SenderResolverInterface" type="Magento\Email\Model\Template\SenderResolver" />
 </config>
-
-<!--/var/www/magetwo-firedrakes.localhost/app/code/Magento/Email/etc/di.xml-->
-<!--/var/www/magetwo-firedrakes.localhost/app/etc/code/Magento/Email/etc/di.xml-->
\ No newline at end of file
diff --git a/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Form.php b/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Form.php
index 8ebed8e02cf..cd16e668097 100644
--- a/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Form.php
+++ b/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Form.php
@@ -38,18 +38,18 @@ class Form extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/GiftMessage/Model/Message.php b/app/code/Magento/GiftMessage/Model/Message.php
index ff24e5a9ded..396c46440ed 100644
--- a/app/code/Magento/GiftMessage/Model/Message.php
+++ b/app/code/Magento/GiftMessage/Model/Message.php
@@ -53,16 +53,16 @@ class Message extends \Magento\Core\Model\AbstractModel
     protected $_typeFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\GiftMessage\Model\Resource\Message $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param \Magento\GiftMessage\Model\TypeFactory $typeFactory
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\GiftMessage\Model\Resource\Message $resource,
         \Magento\Data\Collection\Db $resourceCollection,
         \Magento\GiftMessage\Model\TypeFactory $typeFactory,
diff --git a/app/code/Magento/GoogleAdwords/Helper/Data.php b/app/code/Magento/GoogleAdwords/Helper/Data.php
index 630af875512..4f9060df290 100644
--- a/app/code/Magento/GoogleAdwords/Helper/Data.php
+++ b/app/code/Magento/GoogleAdwords/Helper/Data.php
@@ -82,7 +82,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
     protected $_storeConfig;
 
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
@@ -90,13 +90,13 @@ class Data extends \Magento\App\Helper\AbstractHelper
      * @param \Magento\App\Helper\Context $context
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      */
     public function __construct(
         \Magento\App\Helper\Context $context,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Store\ConfigInterface $storeConfig,
-        \Magento\Core\Model\Registry $registry
+        \Magento\Registry $registry
     ) {
         parent::__construct($context);
         $this->_config = $config;
diff --git a/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php b/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php
index 8ab09a8cca5..b49e6599527 100644
--- a/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php
+++ b/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php
@@ -41,8 +41,8 @@ abstract class AbstractConversion extends \Magento\Core\Model\Config\Value
     protected $_validatorFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Validator\ObjectFactory $validatorCompositeFactory
@@ -52,8 +52,8 @@ abstract class AbstractConversion extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Validator\ObjectFactory $validatorCompositeFactory,
diff --git a/app/code/Magento/GoogleAdwords/Model/Config/Source/Language.php b/app/code/Magento/GoogleAdwords/Model/Config/Source/Language.php
index 3b7ecdf143d..486ec5e0f1d 100644
--- a/app/code/Magento/GoogleAdwords/Model/Config/Source/Language.php
+++ b/app/code/Magento/GoogleAdwords/Model/Config/Source/Language.php
@@ -28,7 +28,7 @@ namespace Magento\GoogleAdwords\Model\Config\Source;
 /**
  * @SuppressWarnings(PHPMD.LongVariable)
  */
-class Language implements \Magento\Core\Model\Option\ArrayInterface
+class Language implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Zend_Locale
diff --git a/app/code/Magento/GoogleAdwords/Model/Config/Source/ValueType.php b/app/code/Magento/GoogleAdwords/Model/Config/Source/ValueType.php
index f932af03235..0ccdf743671 100644
--- a/app/code/Magento/GoogleAdwords/Model/Config/Source/ValueType.php
+++ b/app/code/Magento/GoogleAdwords/Model/Config/Source/ValueType.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\GoogleAdwords\Model\Config\Source;
 
-class ValueType implements \Magento\Core\Model\Option\ArrayInterface
+class ValueType implements \Magento\Option\ArrayInterface
 {
     /**
      * Get conversation value type option
diff --git a/app/code/Magento/GoogleAdwords/Model/Observer.php b/app/code/Magento/GoogleAdwords/Model/Observer.php
index 4e82eb584f9..b762db0ed3b 100644
--- a/app/code/Magento/GoogleAdwords/Model/Observer.php
+++ b/app/code/Magento/GoogleAdwords/Model/Observer.php
@@ -41,12 +41,12 @@ class Observer
      * Constructor
      *
      * @param \Magento\GoogleAdwords\Helper\Data $helper
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Model\Resource\Order\Collection $collection
      */
     public function __construct(
         \Magento\GoogleAdwords\Helper\Data $helper,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Sales\Model\Resource\Order\Collection $collection
     ) {
         $this->_helper = $helper;
diff --git a/app/code/Magento/GoogleCheckout/Model/Api.php b/app/code/Magento/GoogleCheckout/Model/Api.php
index 0bc99cb88f1..bd552f70b25 100644
--- a/app/code/Magento/GoogleCheckout/Model/Api.php
+++ b/app/code/Magento/GoogleCheckout/Model/Api.php
@@ -256,7 +256,7 @@ class Api extends \Magento\Object
     {
         if ($this->getDebugFlag()) {
             $this->objectManager->create(
-                'Magento\Core\Model\Log\Adapter',
+                'Magento\Logger\Adapter',
                 array('fileName' => 'payment_googlecheckout.log')
             )->setFilterDataKeys($this->_debugReplacePrivateDataKeys)->log($debugData);
         }
diff --git a/app/code/Magento/GoogleCheckout/Model/Payment.php b/app/code/Magento/GoogleCheckout/Model/Payment.php
index 6ebdafea5c9..d7c5dfd8bef 100644
--- a/app/code/Magento/GoogleCheckout/Model/Payment.php
+++ b/app/code/Magento/GoogleCheckout/Model/Payment.php
@@ -66,7 +66,7 @@ class Payment extends \Magento\Payment\Model\Method\AbstractMethod
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Core\Model\DateFactory $dateFactory,
         \Magento\UrlFactory $urlFactory,
         \Magento\GoogleCheckout\Model\ApiFactory $apiFactory,
diff --git a/app/code/Magento/GoogleCheckout/Model/Source/Checkout/Image.php b/app/code/Magento/GoogleCheckout/Model/Source/Checkout/Image.php
index feb6d7ead90..c8a64c1fd13 100644
--- a/app/code/Magento/GoogleCheckout/Model/Source/Checkout/Image.php
+++ b/app/code/Magento/GoogleCheckout/Model/Source/Checkout/Image.php
@@ -27,7 +27,7 @@
 
 namespace Magento\GoogleCheckout\Model\Source\Checkout;
 
-class Image implements \Magento\Core\Model\Option\ArrayInterface
+class Image implements \Magento\Option\ArrayInterface
 {
     public function toOptionArray()
     {
diff --git a/app/code/Magento/GoogleCheckout/Model/Source/Locale.php b/app/code/Magento/GoogleCheckout/Model/Source/Locale.php
index 73abb3374eb..f51d3ec4d1a 100644
--- a/app/code/Magento/GoogleCheckout/Model/Source/Locale.php
+++ b/app/code/Magento/GoogleCheckout/Model/Source/Locale.php
@@ -27,7 +27,7 @@
 
 namespace Magento\GoogleCheckout\Model\Source;
 
-class Locale implements \Magento\Core\Model\Option\ArrayInterface
+class Locale implements \Magento\Option\ArrayInterface
 {
     public function toOptionArray()
     {
diff --git a/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Carrier.php b/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Carrier.php
index 7d1f4428f65..b8d21e4ef6d 100644
--- a/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Carrier.php
+++ b/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Carrier.php
@@ -27,7 +27,7 @@
 
 namespace Magento\GoogleCheckout\Model\Source\Shipping;
 
-class Carrier implements \Magento\Core\Model\Option\ArrayInterface
+class Carrier implements \Magento\Option\ArrayInterface
 {
     public function toOptionArray()
     {
diff --git a/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Category.php b/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Category.php
index b08c138721e..35575ad7489 100644
--- a/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Category.php
+++ b/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Category.php
@@ -27,7 +27,7 @@
 
 namespace Magento\GoogleCheckout\Model\Source\Shipping;
 
-class Category implements \Magento\Core\Model\Option\ArrayInterface
+class Category implements \Magento\Option\ArrayInterface
 {
     public function toOptionArray()
     {
diff --git a/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Units.php b/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Units.php
index ff4dff7b7b8..eb77f171f75 100644
--- a/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Units.php
+++ b/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Units.php
@@ -27,7 +27,7 @@
 
 namespace Magento\GoogleCheckout\Model\Source\Shipping;
 
-class Units implements \Magento\Core\Model\Option\ArrayInterface
+class Units implements \Magento\Option\ArrayInterface
 {
     public function toOptionArray()
     {
diff --git a/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Virtual/Method.php b/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Virtual/Method.php
index 5f2f38a8d74..09e64f900d1 100644
--- a/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Virtual/Method.php
+++ b/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Virtual/Method.php
@@ -27,7 +27,7 @@
 
 namespace Magento\GoogleCheckout\Model\Source\Shipping\Virtual;
 
-class Method implements \Magento\Core\Model\Option\ArrayInterface
+class Method implements \Magento\Option\ArrayInterface
 {
     public function toOptionArray()
     {
diff --git a/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Virtual/Schedule.php b/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Virtual/Schedule.php
index 8241d6a2432..2f5a89397af 100644
--- a/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Virtual/Schedule.php
+++ b/app/code/Magento/GoogleCheckout/Model/Source/Shipping/Virtual/Schedule.php
@@ -27,7 +27,7 @@
 
 namespace Magento\GoogleCheckout\Model\Source\Shipping\Virtual;
 
-class Schedule implements \Magento\Core\Model\Option\ArrayInterface
+class Schedule implements \Magento\Option\ArrayInterface
 {
     public function toOptionArray()
     {
diff --git a/app/code/Magento/GoogleOptimizer/Block/AbstractCode.php b/app/code/Magento/GoogleOptimizer/Block/AbstractCode.php
index bbd4b6945cc..7065fef6526 100644
--- a/app/code/Magento/GoogleOptimizer/Block/AbstractCode.php
+++ b/app/code/Magento/GoogleOptimizer/Block/AbstractCode.php
@@ -33,7 +33,7 @@ abstract class AbstractCode extends \Magento\View\Element\Template
     protected $_registryName;
 
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
@@ -50,14 +50,14 @@ abstract class AbstractCode extends \Magento\View\Element\Template
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\GoogleOptimizer\Helper\Data $helper
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\GoogleOptimizer\Helper\Code $codeHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\GoogleOptimizer\Helper\Data $helper,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\GoogleOptimizer\Helper\Code $codeHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/GoogleOptimizer/Block/Adminhtml/AbstractTab.php b/app/code/Magento/GoogleOptimizer/Block/Adminhtml/AbstractTab.php
index b6069c8ec6d..4a26443b4bd 100644
--- a/app/code/Magento/GoogleOptimizer/Block/Adminhtml/AbstractTab.php
+++ b/app/code/Magento/GoogleOptimizer/Block/Adminhtml/AbstractTab.php
@@ -34,7 +34,7 @@ abstract class AbstractTab
     protected $_helperData;
 
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
@@ -51,7 +51,7 @@ abstract class AbstractTab
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\GoogleOptimizer\Helper\Data $helperData
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\GoogleOptimizer\Helper\Code $codeHelper
      * @param \Magento\GoogleOptimizer\Helper\Form $formHelper
      * @param \Magento\Data\FormFactory $formFactory
@@ -60,7 +60,7 @@ abstract class AbstractTab
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\GoogleOptimizer\Helper\Data $helperData,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\GoogleOptimizer\Helper\Code $codeHelper,
         \Magento\GoogleOptimizer\Helper\Form $formHelper,
         \Magento\Data\FormFactory $formFactory,
diff --git a/app/code/Magento/GoogleOptimizer/Block/Adminhtml/Catalog/Category/Edit/Tab/Googleoptimizer.php b/app/code/Magento/GoogleOptimizer/Block/Adminhtml/Catalog/Category/Edit/Tab/Googleoptimizer.php
index f7381f6a057..2ab61a2520f 100644
--- a/app/code/Magento/GoogleOptimizer/Block/Adminhtml/Catalog/Category/Edit/Tab/Googleoptimizer.php
+++ b/app/code/Magento/GoogleOptimizer/Block/Adminhtml/Catalog/Category/Edit/Tab/Googleoptimizer.php
@@ -29,7 +29,7 @@ class Googleoptimizer
     extends \Magento\Catalog\Block\Adminhtml\Form
 {
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
@@ -45,7 +45,7 @@ class Googleoptimizer
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\GoogleOptimizer\Helper\Code $codeHelper
      * @param \Magento\GoogleOptimizer\Helper\Form $formHelper
@@ -53,7 +53,7 @@ class Googleoptimizer
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\GoogleOptimizer\Helper\Code $codeHelper,
         \Magento\GoogleOptimizer\Helper\Form $formHelper,
diff --git a/app/code/Magento/GoogleOptimizer/Block/Code/Page.php b/app/code/Magento/GoogleOptimizer/Block/Code/Page.php
index 52d4ae14912..85861557f21 100644
--- a/app/code/Magento/GoogleOptimizer/Block/Code/Page.php
+++ b/app/code/Magento/GoogleOptimizer/Block/Code/Page.php
@@ -35,7 +35,7 @@ class Page extends \Magento\GoogleOptimizer\Block\AbstractCode
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\GoogleOptimizer\Helper\Data $helper
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\GoogleOptimizer\Helper\Code $codeHelper
      * @param \Magento\Cms\Model\Page $page
      * @param array $data
@@ -43,7 +43,7 @@ class Page extends \Magento\GoogleOptimizer\Block\AbstractCode
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\GoogleOptimizer\Helper\Data $helper,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\GoogleOptimizer\Helper\Code $codeHelper,
         \Magento\Cms\Model\Page $page,
         array $data = array()
diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit.php
index 6cb7e0e3b53..59593bf18f3 100644
--- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit.php
+++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit.php
@@ -33,18 +33,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Form.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Form.php
index 213a6bf347d..dbeb6a710bb 100644
--- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Form.php
+++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Form.php
@@ -48,7 +48,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -82,7 +82,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\GoogleShopping\Model\Resource\Type\CollectionFactory $typeCollectionFactory
      * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $eavCollectionFactory
@@ -94,7 +94,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\GoogleShopping\Model\Resource\Type\CollectionFactory $typeCollectionFactory,
         \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $eavCollectionFactory,
diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php
index 59151f74761..9e994564c7c 100644
--- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php
+++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php
@@ -35,17 +35,17 @@ class Types extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/GoogleShopping/Model/Attribute.php b/app/code/Magento/GoogleShopping/Model/Attribute.php
index ee98f4a13c8..a801c3be2c3 100644
--- a/app/code/Magento/GoogleShopping/Model/Attribute.php
+++ b/app/code/Magento/GoogleShopping/Model/Attribute.php
@@ -91,8 +91,8 @@ class Attribute extends \Magento\Core\Model\AbstractModel
     protected $_productFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\GoogleShopping\Helper\Data $gsData
      * @param \Magento\GoogleShopping\Helper\Product $gsProduct
@@ -102,8 +102,8 @@ class Attribute extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\GoogleShopping\Helper\Data $gsData,
         \Magento\GoogleShopping\Helper\Product $gsProduct,
diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/ContentLanguage.php b/app/code/Magento/GoogleShopping/Model/Attribute/ContentLanguage.php
index 01a96861e44..eda5dfb2b06 100644
--- a/app/code/Magento/GoogleShopping/Model/Attribute/ContentLanguage.php
+++ b/app/code/Magento/GoogleShopping/Model/Attribute/ContentLanguage.php
@@ -42,8 +42,8 @@ class ContentLanguage extends \Magento\GoogleShopping\Model\Attribute\DefaultAtt
     protected $_config;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\GoogleShopping\Helper\Data $gsData
      * @param \Magento\GoogleShopping\Helper\Product $gsProduct
@@ -54,8 +54,8 @@ class ContentLanguage extends \Magento\GoogleShopping\Model\Attribute\DefaultAtt
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\GoogleShopping\Helper\Data $gsData,
         \Magento\GoogleShopping\Helper\Product $gsProduct,
diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/Destinations.php b/app/code/Magento/GoogleShopping/Model/Attribute/Destinations.php
index fb3a8378f17..ecf0a91c02f 100644
--- a/app/code/Magento/GoogleShopping/Model/Attribute/Destinations.php
+++ b/app/code/Magento/GoogleShopping/Model/Attribute/Destinations.php
@@ -42,8 +42,8 @@ class Destinations extends \Magento\GoogleShopping\Model\Attribute\DefaultAttrib
     protected $_config;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\GoogleShopping\Helper\Data $gsData
      * @param \Magento\GoogleShopping\Helper\Product $gsProduct
@@ -54,8 +54,8 @@ class Destinations extends \Magento\GoogleShopping\Model\Attribute\DefaultAttrib
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\GoogleShopping\Helper\Data $gsData,
         \Magento\GoogleShopping\Helper\Product $gsProduct,
diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/GoogleProductCategory.php b/app/code/Magento/GoogleShopping/Model/Attribute/GoogleProductCategory.php
index 6258d88110c..e04937a8f65 100644
--- a/app/code/Magento/GoogleShopping/Model/Attribute/GoogleProductCategory.php
+++ b/app/code/Magento/GoogleShopping/Model/Attribute/GoogleProductCategory.php
@@ -49,8 +49,8 @@ class GoogleProductCategory extends \Magento\GoogleShopping\Model\Attribute\Defa
     protected $_typeFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\GoogleShopping\Helper\Data $gsData
      * @param \Magento\GoogleShopping\Helper\Product $gsProduct
@@ -62,8 +62,8 @@ class GoogleProductCategory extends \Magento\GoogleShopping\Model\Attribute\Defa
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\GoogleShopping\Helper\Data $gsData,
         \Magento\GoogleShopping\Helper\Product $gsProduct,
diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/ImageLink.php b/app/code/Magento/GoogleShopping/Model/Attribute/ImageLink.php
index f05d2814fc7..afd8ec78071 100644
--- a/app/code/Magento/GoogleShopping/Model/Attribute/ImageLink.php
+++ b/app/code/Magento/GoogleShopping/Model/Attribute/ImageLink.php
@@ -40,8 +40,8 @@ class ImageLink extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute
     protected $_catalogProduct = null;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\GoogleShopping\Helper\Data $gsData
      * @param \Magento\GoogleShopping\Helper\Product $gsProduct
@@ -52,8 +52,8 @@ class ImageLink extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\GoogleShopping\Helper\Data $gsData,
         \Magento\GoogleShopping\Helper\Product $gsProduct,
diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/Link.php b/app/code/Magento/GoogleShopping/Model/Attribute/Link.php
index a5cdea27283..6e4d63b9ec4 100644
--- a/app/code/Magento/GoogleShopping/Model/Attribute/Link.php
+++ b/app/code/Magento/GoogleShopping/Model/Attribute/Link.php
@@ -42,8 +42,8 @@ class Link extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute
     protected $_coreStoreConfig;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\GoogleShopping\Helper\Data $gsData
      * @param \Magento\GoogleShopping\Helper\Product $gsProduct
@@ -54,8 +54,8 @@ class Link extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\GoogleShopping\Helper\Data $gsData,
         \Magento\GoogleShopping\Helper\Product $gsProduct,
diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/Price.php b/app/code/Magento/GoogleShopping/Model/Attribute/Price.php
index 8bced43baca..88fb052adb0 100644
--- a/app/code/Magento/GoogleShopping/Model/Attribute/Price.php
+++ b/app/code/Magento/GoogleShopping/Model/Attribute/Price.php
@@ -69,8 +69,8 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute
     protected $catalogPrice;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\GoogleShopping\Helper\Data $gsData
      * @param \Magento\GoogleShopping\Helper\Product $gsProduct
@@ -84,8 +84,8 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\GoogleShopping\Helper\Data $gsData,
         \Magento\GoogleShopping\Helper\Product $gsProduct,
diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/ProductType.php b/app/code/Magento/GoogleShopping/Model/Attribute/ProductType.php
index 0d28c42396b..7529ba3bd91 100644
--- a/app/code/Magento/GoogleShopping/Model/Attribute/ProductType.php
+++ b/app/code/Magento/GoogleShopping/Model/Attribute/ProductType.php
@@ -42,8 +42,8 @@ class ProductType extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribu
     protected $_categoryFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\GoogleShopping\Helper\Data $gsData
      * @param \Magento\GoogleShopping\Helper\Product $gsProduct
@@ -54,8 +54,8 @@ class ProductType extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribu
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\GoogleShopping\Helper\Data $gsData,
         \Magento\GoogleShopping\Helper\Product $gsProduct,
diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/TargetCountry.php b/app/code/Magento/GoogleShopping/Model/Attribute/TargetCountry.php
index ecffcee6fcd..4c1adcc0fd1 100644
--- a/app/code/Magento/GoogleShopping/Model/Attribute/TargetCountry.php
+++ b/app/code/Magento/GoogleShopping/Model/Attribute/TargetCountry.php
@@ -42,8 +42,8 @@ class TargetCountry extends \Magento\GoogleShopping\Model\Attribute\DefaultAttri
     protected $_config;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\GoogleShopping\Helper\Data $gsData
      * @param \Magento\GoogleShopping\Helper\Product $gsProduct
@@ -54,8 +54,8 @@ class TargetCountry extends \Magento\GoogleShopping\Model\Attribute\DefaultAttri
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\GoogleShopping\Helper\Data $gsData,
         \Magento\GoogleShopping\Helper\Product $gsProduct,
diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/Tax.php b/app/code/Magento/GoogleShopping/Model/Attribute/Tax.php
index ea9b5986e5e..ba7614a13ea 100644
--- a/app/code/Magento/GoogleShopping/Model/Attribute/Tax.php
+++ b/app/code/Magento/GoogleShopping/Model/Attribute/Tax.php
@@ -57,8 +57,8 @@ class Tax extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute
     protected $_config;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\GoogleShopping\Helper\Data $gsData
      * @param \Magento\GoogleShopping\Helper\Product $gsProduct
@@ -71,8 +71,8 @@ class Tax extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\GoogleShopping\Helper\Data $gsData,
         \Magento\GoogleShopping\Helper\Product $gsProduct,
diff --git a/app/code/Magento/GoogleShopping/Model/Item.php b/app/code/Magento/GoogleShopping/Model/Item.php
index 151a4b99434..46c8383856d 100644
--- a/app/code/Magento/GoogleShopping/Model/Item.php
+++ b/app/code/Magento/GoogleShopping/Model/Item.php
@@ -79,8 +79,8 @@ class Item extends \Magento\Core\Model\AbstractModel
     protected $_productFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\GoogleShopping\Model\Service\ItemFactory $itemFactory
      * @param \Magento\GoogleShopping\Model\TypeFactory $typeFactory
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
@@ -90,8 +90,8 @@ class Item extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\GoogleShopping\Model\Service\ItemFactory $itemFactory,
         \Magento\GoogleShopping\Model\TypeFactory $typeFactory,
         \Magento\Catalog\Model\ProductFactory $productFactory,
diff --git a/app/code/Magento/GoogleShopping/Model/Service.php b/app/code/Magento/GoogleShopping/Model/Service.php
index af05e102dce..9e7150e3484 100644
--- a/app/code/Magento/GoogleShopping/Model/Service.php
+++ b/app/code/Magento/GoogleShopping/Model/Service.php
@@ -44,7 +44,7 @@ class Service extends \Magento\Object
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -58,7 +58,7 @@ class Service extends \Magento\Object
     /**
      * Log adapter factory
      *
-     * @var \Magento\Core\Model\Log\AdapterFactory
+     * @var \Magento\Logger\AdapterFactory
      */
     protected $_logAdapterFactory;
 
@@ -80,15 +80,15 @@ class Service extends \Magento\Object
      * By default is looking for first argument as array and assigns it as object
      * attributes This behavior may change in child classes
      *
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\GoogleShopping\Model\Config $config
      * @param \Magento\Gdata\Gshopping\ContentFactory $contentFactory
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
+        \Magento\Registry $coreRegistry,
         \Magento\GoogleShopping\Model\Config $config,
         \Magento\Gdata\Gshopping\ContentFactory $contentFactory,
         array $data = array()
diff --git a/app/code/Magento/GoogleShopping/Model/Service/Item.php b/app/code/Magento/GoogleShopping/Model/Service/Item.php
index 97fb4588e46..3baca8e8ca6 100644
--- a/app/code/Magento/GoogleShopping/Model/Service/Item.php
+++ b/app/code/Magento/GoogleShopping/Model/Service/Item.php
@@ -47,8 +47,8 @@ class Item extends \Magento\GoogleShopping\Model\Service
     protected $_date;
 
     /**
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\GoogleShopping\Model\Config $config
      * @param \Magento\Gdata\Gshopping\ContentFactory $contentFactory
      * @param \Magento\Core\Model\Date $date
@@ -56,8 +56,8 @@ class Item extends \Magento\GoogleShopping\Model\Service
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
+        \Magento\Registry $coreRegistry,
         \Magento\GoogleShopping\Model\Config $config,
         \Magento\Gdata\Gshopping\ContentFactory $contentFactory,
         \Magento\Core\Model\Date $date,
diff --git a/app/code/Magento/GoogleShopping/Model/Source/Accounttype.php b/app/code/Magento/GoogleShopping/Model/Source/Accounttype.php
index d11cd661133..265f9bc06b6 100644
--- a/app/code/Magento/GoogleShopping/Model/Source/Accounttype.php
+++ b/app/code/Magento/GoogleShopping/Model/Source/Accounttype.php
@@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model\Source;
  * @package    Magento_GoogleShopping
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-class Accounttype implements \Magento\Core\Model\Option\ArrayInterface
+class Accounttype implements \Magento\Option\ArrayInterface
 {
     /**
      * Retrieve option array with account types
diff --git a/app/code/Magento/GoogleShopping/Model/Source/Authtype.php b/app/code/Magento/GoogleShopping/Model/Source/Authtype.php
index 3878f89c57f..24231fd8aea 100644
--- a/app/code/Magento/GoogleShopping/Model/Source/Authtype.php
+++ b/app/code/Magento/GoogleShopping/Model/Source/Authtype.php
@@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model\Source;
  * @package    Magento_GoogleShopping
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-class Authtype implements \Magento\Core\Model\Option\ArrayInterface
+class Authtype implements \Magento\Option\ArrayInterface
 {
     /**
      * Retrieve option array with authentification types
diff --git a/app/code/Magento/GoogleShopping/Model/Source/Country.php b/app/code/Magento/GoogleShopping/Model/Source/Country.php
index 6a7f0677af4..31f0125f5ad 100644
--- a/app/code/Magento/GoogleShopping/Model/Source/Country.php
+++ b/app/code/Magento/GoogleShopping/Model/Source/Country.php
@@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model\Source;
  * @package    Magento_GoogleShopping
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-class Country implements \Magento\Core\Model\Option\ArrayInterface
+class Country implements \Magento\Option\ArrayInterface
 {
     /**
      * Config
diff --git a/app/code/Magento/GoogleShopping/Model/Source/Destinationstates.php b/app/code/Magento/GoogleShopping/Model/Source/Destinationstates.php
index 855425ececa..9f1177628fc 100644
--- a/app/code/Magento/GoogleShopping/Model/Source/Destinationstates.php
+++ b/app/code/Magento/GoogleShopping/Model/Source/Destinationstates.php
@@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model\Source;
  * @package    Magento_GoogleShopping
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-class Destinationstates implements \Magento\Core\Model\Option\ArrayInterface
+class Destinationstates implements \Magento\Option\ArrayInterface
 {
     /**
      * Retrieve option array with destinations
diff --git a/app/code/Magento/GoogleShopping/Model/Type.php b/app/code/Magento/GoogleShopping/Model/Type.php
index 8bf42813b71..b39c2b1c506 100644
--- a/app/code/Magento/GoogleShopping/Model/Type.php
+++ b/app/code/Magento/GoogleShopping/Model/Type.php
@@ -76,8 +76,8 @@ class Type extends \Magento\Core\Model\AbstractModel
     protected $_collectionFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\GoogleShopping\Model\Resource\Attribute\CollectionFactory $collectionFactory
      * @param \Magento\GoogleShopping\Model\AttributeFactory $attributeFactory
      * @param \Magento\GoogleShopping\Model\Config $config
@@ -88,8 +88,8 @@ class Type extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\GoogleShopping\Model\Resource\Attribute\CollectionFactory $collectionFactory,
         \Magento\GoogleShopping\Model\AttributeFactory $attributeFactory,
         \Magento\GoogleShopping\Model\Config $config,
diff --git a/app/code/Magento/GoogleShopping/i18n/en_US.csv b/app/code/Magento/GoogleShopping/i18n/en_US.csv
index 8f49cd4dc99..1a543673558 100644
--- a/app/code/Magento/GoogleShopping/i18n/en_US.csv
+++ b/app/code/Magento/GoogleShopping/i18n/en_US.csv
@@ -81,7 +81,7 @@
 "Manage Attribute Mapping","Manage Attribute Mapping"
 "Manage Attributes","Manage Attributes"
 "Manage Items","Manage Items"
-"Manufacturer\'s Part Number (MPN)","Manufacturer\'s Part Number (MPN)"
+"Manufacturer's Part Number (MPN)","Manufacturer's Part Number (MPN)"
 "Material","Material"
 "Netherlands","Netherlands"
 "New Attribute Mapping","New Attribute Mapping"
@@ -107,7 +107,7 @@
 "Sale Price Effective From Date","Sale Price Effective From Date"
 "Sale Price Effective To Date","Sale Price Effective To Date"
 "Save Mapping","Save Mapping"
-"See '\\1'","See '\\1'"
+"See '\1'","See '\1'"
 "Session expired during export. Please revise exported products and repeat the process if necessary.","Session expired during export. Please revise exported products and repeat the process if necessary."
 "Shipping Weight","Shipping Weight"
 "Size","Size"
@@ -117,11 +117,11 @@
 "Synchronize","Synchronize"
 "Target Country","Target Country"
 "The Google Content item for product '%s' (in '%s' store) has already exist.","The Google Content item for product '%s' (in '%s' store) has already exist."
-"The attribute ""%s"" has incorrect type for Google Shopping. The product with this attribute hasn\'t been updated in Google Content.","The attribute ""%s"" has incorrect type for Google Shopping. The product with this attribute hasn\'t been updated in Google Content."
+"The attribute ""%s"" has incorrect type for Google Shopping. The product with this attribute hasn't been updated in Google Content.","The attribute ""%s"" has incorrect type for Google Shopping. The product with this attribute hasn't been updated in Google Content."
 "The attribute mapping has been saved.","The attribute mapping has been saved."
-"The item ""%s"" hasn\'t been deleted.","The item ""%s"" hasn\'t been deleted."
-"The item ""%s"" hasn\'t been updated.","The item ""%s"" hasn\'t been updated."
-"The product ""%s"" hasn\'t been added to Google Content.","The product ""%s"" hasn\'t been added to Google Content."
+"The item ""%s"" hasn't been deleted.","The item ""%s"" hasn't been deleted."
+"The item ""%s"" hasn't been updated.","The item ""%s"" hasn't been updated."
+"The product ""%s"" hasn't been added to Google Content.","The product ""%s"" hasn't been added to Google Content."
 "The store's currency should be set to %s for %s in system configuration. Otherwise item prices won't be correct in Google Content.","The store's currency should be set to %s for %s in system configuration. Otherwise item prices won't be correct in Google Content."
 "This action will update items attributes and remove the items which are not available in Google Content. If an attributes was deleted from mapping, it will be deleted from Google too. Continue?","This action will update items attributes and remove the items which are not available in Google Content. If an attributes was deleted from mapping, it will be deleted from Google too. Continue?"
 "Title","Title"
diff --git a/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php b/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php
index 267ebe36897..797444a9f41 100644
--- a/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php
+++ b/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php
@@ -51,7 +51,7 @@ class Grouped
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -65,13 +65,13 @@ class Grouped
      * @param \Magento\Core\Helper\Data $coreHelper
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php b/app/code/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php
index 312717b8692..468e44972d0 100644
--- a/app/code/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php
+++ b/app/code/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php
@@ -38,18 +38,18 @@ class ListAssociatedProducts extends \Magento\Backend\Block\Template
     /**
      * Registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         parent::__construct($context, $data);
diff --git a/app/code/Magento/GroupedProduct/Controller/Adminhtml/Edit.php b/app/code/Magento/GroupedProduct/Controller/Adminhtml/Edit.php
index 57a627c6b53..6a1d13762bc 100644
--- a/app/code/Magento/GroupedProduct/Controller/Adminhtml/Edit.php
+++ b/app/code/Magento/GroupedProduct/Controller/Adminhtml/Edit.php
@@ -27,7 +27,7 @@ namespace Magento\GroupedProduct\Controller\Adminhtml;
 class Edit extends \Magento\Backend\App\AbstractAction
 {
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $registry;
 
@@ -43,13 +43,13 @@ class Edit extends \Magento\Backend\App\AbstractAction
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $factory
      * @param \Magento\Logger $logger
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $factory,
         \Magento\Logger $logger
     ) {
@@ -104,4 +104,4 @@ class Edit extends \Magento\Backend\App\AbstractAction
         $this->_view->loadLayout(false);
         $this->_view->renderLayout();
     }
-} 
+}
diff --git a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php
index 2bac6613980..82760deef5b 100644
--- a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php
+++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php
@@ -104,7 +104,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType
      * @param \Magento\Core\Helper\Data $coreData
      * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb
      * @param \Magento\App\Filesystem $filesystem
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Logger $logger
      * @param \Magento\GroupedProduct\Model\Resource\Product\Link $catalogProductLink
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -123,7 +123,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType
         \Magento\Core\Helper\Data $coreData,
         \Magento\Core\Helper\File\Storage\Database $fileStorageDb,
         \Magento\App\Filesystem $filesystem,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Logger $logger,
         \Magento\GroupedProduct\Model\Resource\Product\Link $catalogProductLink,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
diff --git a/app/code/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php b/app/code/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php
index e9a0ceaa349..bae0ea2b2d9 100644
--- a/app/code/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php
+++ b/app/code/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php
@@ -37,7 +37,7 @@ class AssociatedProductsCollection
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -60,17 +60,17 @@ class AssociatedProductsCollection
      * @param \Magento\Validator\UniversalFactory $universalFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Catalog\Helper\Product\Flat $catalogProductFlat
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
      * @param \Magento\Catalog\Model\Resource\Url $catalogUrl
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Stdlib\DateTime $dateTime
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $config
      * @param mixed $connection
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
@@ -85,14 +85,14 @@ class AssociatedProductsCollection
         \Magento\Validator\UniversalFactory $universalFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Catalog\Helper\Product\Flat $catalogProductFlat,
+        \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
         \Magento\Catalog\Model\Resource\Url $catalogUrl,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Stdlib\DateTime $dateTime,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Catalog\Model\ProductTypes\ConfigInterface $config,
         $connection = null
     ) {
@@ -110,7 +110,7 @@ class AssociatedProductsCollection
             $universalFactory,
             $storeManager,
             $catalogData,
-            $catalogProductFlat,
+            $catalogProductFlatState,
             $coreStoreConfig,
             $productOptionFactory,
             $catalogUrl,
diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Edit/Form.php b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Edit/Form.php
index 1a55dfc2404..f3664442717 100644
--- a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Edit/Form.php
+++ b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Edit/Form.php
@@ -47,7 +47,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\ImportExport\Model\Source\Export\EntityFactory $entityFactory
      * @param \Magento\ImportExport\Model\Source\Export\FormatFactory $formatFactory
@@ -55,7 +55,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\ImportExport\Model\Source\Export\EntityFactory $entityFactory,
         \Magento\ImportExport\Model\Source\Export\FormatFactory $formatFactory,
diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Form/After.php b/app/code/Magento/ImportExport/Block/Adminhtml/Form/After.php
index 8a95585134f..0913db1759b 100644
--- a/app/code/Magento/ImportExport/Block/Adminhtml/Form/After.php
+++ b/app/code/Magento/ImportExport/Block/Adminhtml/Form/After.php
@@ -32,18 +32,18 @@ namespace Magento\ImportExport\Block\Adminhtml\Form;
 class After extends \Magento\Backend\Block\Template
 {
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_registry = $registry;
diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php
index d28fdd28762..1da9a152dc2 100644
--- a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php
+++ b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php
@@ -53,7 +53,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\ImportExport\Model\Import $importModel
      * @param \Magento\ImportExport\Model\Source\Import\EntityFactory $entityFactory
@@ -62,7 +62,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\ImportExport\Model\Import $importModel,
         \Magento\ImportExport\Model\Source\Import\EntityFactory $entityFactory,
diff --git a/app/code/Magento/ImportExport/Model/AbstractModel.php b/app/code/Magento/ImportExport/Model/AbstractModel.php
index 280c9619e49..e0282c73c30 100644
--- a/app/code/Magento/ImportExport/Model/AbstractModel.php
+++ b/app/code/Magento/ImportExport/Model/AbstractModel.php
@@ -42,8 +42,8 @@ abstract class AbstractModel extends \Magento\Object
     protected $_debugMode = false;
 
     /**
-     * Loger instance
-     * @var \Magento\Core\Model\Log\Adapter
+     * Logger instance
+     * @var \Magento\Logger\Adapter
      */
     protected $_logInstance;
 
@@ -72,20 +72,20 @@ abstract class AbstractModel extends \Magento\Object
     protected $_varDirectory;
 
     /**
-     * @var \Magento\Core\Model\Log\AdapterFactory
+     * @var \Magento\Logger\AdapterFactory
      */
     protected $_adapterFactory;
 
     /**
      * @param \Magento\Logger $logger
      * @param \Magento\App\Filesystem $filesystem
-     * @param \Magento\Core\Model\Log\AdapterFactory $adapterFactory
+     * @param \Magento\Logger\AdapterFactory $adapterFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Logger $logger,
         \Magento\App\Filesystem $filesystem,
-        \Magento\Core\Model\Log\AdapterFactory $adapterFactory,
+        \Magento\Logger\AdapterFactory $adapterFactory,
         array $data = array()
     ) {
         $this->_logger = $logger;
diff --git a/app/code/Magento/ImportExport/Model/Export.php b/app/code/Magento/ImportExport/Model/Export.php
index 8fa57ee1feb..09bd82c4551 100644
--- a/app/code/Magento/ImportExport/Model/Export.php
+++ b/app/code/Magento/ImportExport/Model/Export.php
@@ -77,7 +77,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel
     /**
      * @param \Magento\Logger $logger
      * @param \Magento\App\Filesystem $filesystem
-     * @param \Magento\Core\Model\Log\AdapterFactory $adapterFactory
+     * @param \Magento\Logger\AdapterFactory $adapterFactory
      * @param \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig
      * @param \Magento\ImportExport\Model\Export\Entity\Factory $entityFactory
      * @param \Magento\ImportExport\Model\Export\Adapter\Factory $exportAdapterFac
@@ -86,7 +86,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel
     public function __construct(
         \Magento\Logger $logger,
         \Magento\App\Filesystem $filesystem,
-        \Magento\Core\Model\Log\AdapterFactory $adapterFactory,
+        \Magento\Logger\AdapterFactory $adapterFactory,
         \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig,
         \Magento\ImportExport\Model\Export\Entity\Factory $entityFactory,
         \Magento\ImportExport\Model\Export\Adapter\Factory $exportAdapterFac,
diff --git a/app/code/Magento/ImportExport/Model/Import.php b/app/code/Magento/ImportExport/Model/Import.php
index 7aa86b28ba5..c724fc58e79 100644
--- a/app/code/Magento/ImportExport/Model/Import.php
+++ b/app/code/Magento/ImportExport/Model/Import.php
@@ -138,7 +138,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel
     /**
      * @param \Magento\Logger $logger
      * @param \Magento\App\Filesystem $filesystem
-     * @param \Magento\Core\Model\Log\AdapterFactory $adapterFactory
+     * @param \Magento\Logger\AdapterFactory $adapterFactory
      * @param \Magento\ImportExport\Helper\Data $importExportData
      * @param \Magento\App\ConfigInterface $coreConfig
      * @param \Magento\ImportExport\Model\Import\ConfigInterface $importConfig
@@ -154,7 +154,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel
     public function __construct(
         \Magento\Logger $logger,
         \Magento\App\Filesystem $filesystem,
-        \Magento\Core\Model\Log\AdapterFactory $adapterFactory,
+        \Magento\Logger\AdapterFactory $adapterFactory,
         \Magento\ImportExport\Helper\Data $importExportData,
         \Magento\App\ConfigInterface $coreConfig,
         \Magento\ImportExport\Model\Import\ConfigInterface $importConfig,
diff --git a/app/code/Magento/ImportExport/Model/Source/Export/Entity.php b/app/code/Magento/ImportExport/Model/Source/Export/Entity.php
index 46b88ad7f9e..ddc47bae557 100644
--- a/app/code/Magento/ImportExport/Model/Source/Export/Entity.php
+++ b/app/code/Magento/ImportExport/Model/Source/Export/Entity.php
@@ -32,7 +32,7 @@ namespace Magento\ImportExport\Model\Source\Export;
  * @package     Magento_ImportExport
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-class Entity implements \Magento\Core\Model\Option\ArrayInterface
+class Entity implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\ImportExport\Model\Export\ConfigInterface
diff --git a/app/code/Magento/ImportExport/Model/Source/Export/Format.php b/app/code/Magento/ImportExport/Model/Source/Export/Format.php
index a4e4a257587..06f4853b230 100644
--- a/app/code/Magento/ImportExport/Model/Source/Export/Format.php
+++ b/app/code/Magento/ImportExport/Model/Source/Export/Format.php
@@ -32,7 +32,7 @@ namespace Magento\ImportExport\Model\Source\Export;
  * @package     Magento_ImportExport
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-class Format implements \Magento\Core\Model\Option\ArrayInterface
+class Format implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\ImportExport\Model\Export\ConfigInterface
diff --git a/app/code/Magento/ImportExport/Model/Source/Import/AbstractBehavior.php b/app/code/Magento/ImportExport/Model/Source/Import/AbstractBehavior.php
index 0e10b6b0bf1..b22a7174a8e 100644
--- a/app/code/Magento/ImportExport/Model/Source/Import/AbstractBehavior.php
+++ b/app/code/Magento/ImportExport/Model/Source/Import/AbstractBehavior.php
@@ -32,7 +32,7 @@ namespace Magento\ImportExport\Model\Source\Import;
  * @package     Magento_ImportExport
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-abstract class AbstractBehavior implements \Magento\Core\Model\Option\ArrayInterface
+abstract class AbstractBehavior implements \Magento\Option\ArrayInterface
 {
     /**
      * Get array of possible values
diff --git a/app/code/Magento/ImportExport/Model/Source/Import/Entity.php b/app/code/Magento/ImportExport/Model/Source/Import/Entity.php
index 2a87f47c216..5167dfb414a 100644
--- a/app/code/Magento/ImportExport/Model/Source/Import/Entity.php
+++ b/app/code/Magento/ImportExport/Model/Source/Import/Entity.php
@@ -32,7 +32,7 @@ namespace Magento\ImportExport\Model\Source\Import;
  * @package     Magento_ImportExport
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-class Entity implements \Magento\Core\Model\Option\ArrayInterface
+class Entity implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\ImportExport\Model\Import\ConfigInterface
diff --git a/app/code/Magento/Index/Block/Adminhtml/Process/Edit.php b/app/code/Magento/Index/Block/Adminhtml/Process/Edit.php
index d091e2951ff..b96cf377635 100644
--- a/app/code/Magento/Index/Block/Adminhtml/Process/Edit.php
+++ b/app/code/Magento/Index/Block/Adminhtml/Process/Edit.php
@@ -31,18 +31,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Index/Controller/Adminhtml/Process.php b/app/code/Magento/Index/Controller/Adminhtml/Process.php
index befa6f651b0..f700b05a7a6 100644
--- a/app/code/Magento/Index/Controller/Adminhtml/Process.php
+++ b/app/code/Magento/Index/Controller/Adminhtml/Process.php
@@ -32,7 +32,7 @@ class Process extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -48,13 +48,13 @@ class Process extends \Magento\Backend\App\Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Index\Model\ProcessFactory $processFactory
      * @param \Magento\Index\Model\Indexer $indexer
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Index\Model\ProcessFactory $processFactory,
         \Magento\Index\Model\Indexer $indexer
     ) {
diff --git a/app/code/Magento/Index/Model/Event.php b/app/code/Magento/Index/Model/Event.php
index 9bb89c8ed8e..cd861a188a7 100644
--- a/app/code/Magento/Index/Model/Event.php
+++ b/app/code/Magento/Index/Model/Event.php
@@ -85,8 +85,8 @@ class Event extends \Magento\Core\Model\AbstractModel
     protected $dateTime;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param Indexer $indexer
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -94,8 +94,8 @@ class Event extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         Indexer $indexer,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Index/Model/Process.php b/app/code/Magento/Index/Model/Process.php
index 4cdb1a0d4d2..00eb26af61e 100644
--- a/app/code/Magento/Index/Model/Process.php
+++ b/app/code/Magento/Index/Model/Process.php
@@ -118,8 +118,8 @@ class Process extends \Magento\Core\Model\AbstractModel
     protected $_indexerConfig;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Index\Model\Resource\Event $resourceEvent
      * @param \Magento\Index\Model\Indexer\Factory $indexerFactory
      * @param \Magento\Index\Model\Indexer $indexer
@@ -131,8 +131,8 @@ class Process extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Index\Model\Resource\Event $resourceEvent,
         \Magento\Index\Model\Indexer\Factory $indexerFactory,
         \Magento\Index\Model\Indexer $indexer,
diff --git a/app/code/Magento/Index/Model/Shell.php b/app/code/Magento/Index/Model/Shell.php
index e2a53a23415..002efdc41ac 100644
--- a/app/code/Magento/Index/Model/Shell.php
+++ b/app/code/Magento/Index/Model/Shell.php
@@ -32,7 +32,7 @@ namespace Magento\Index\Model;
  * @package     Magento_Index
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-class Shell extends \Magento\Core\Model\AbstractShell
+class Shell extends \Magento\App\AbstractShell
 {
     /**
      * Error status - whether errors have happened
diff --git a/app/code/Magento/Indexer/Model/Indexer/State.php b/app/code/Magento/Indexer/Model/Indexer/State.php
index c85db8e4b5a..6b5bab824b1 100644
--- a/app/code/Magento/Indexer/Model/Indexer/State.php
+++ b/app/code/Magento/Indexer/Model/Indexer/State.php
@@ -55,15 +55,15 @@ class State extends \Magento\Core\Model\AbstractModel
     protected $_eventObject = 'indexer_state';
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Indexer\Model\Resource\Indexer\State $resource
      * @param \Magento\Indexer\Model\Resource\Indexer\State\Collection $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Indexer\Model\Resource\Indexer\State $resource,
         \Magento\Indexer\Model\Resource\Indexer\State\Collection $resourceCollection,
         array $data = array()
diff --git a/app/code/Magento/Indexer/Model/Shell.php b/app/code/Magento/Indexer/Model/Shell.php
index be4829e44c3..dbe2a024ce4 100644
--- a/app/code/Magento/Indexer/Model/Shell.php
+++ b/app/code/Magento/Indexer/Model/Shell.php
@@ -24,7 +24,7 @@
 
 namespace Magento\Indexer\Model;
 
-class Shell extends \Magento\Core\Model\AbstractShell
+class Shell extends \Magento\App\AbstractShell
 {
     /**
      * Error status - whether errors have happened
diff --git a/app/code/Magento/Install/i18n/de_DE.csv b/app/code/Magento/Install/i18n/de_DE.csv
index e5d2aca4a37..9324bf68199 100644
--- a/app/code/Magento/Install/i18n/de_DE.csv
+++ b/app/code/Magento/Install/i18n/de_DE.csv
@@ -93,7 +93,7 @@
 "Provide a complete base URL for SSL connection. For example: %s","Stellen Sie eine vollständige Base URL für die SSL Verbindung zur Verfügung. Zum Beispiel: %s"
 "Report All Bugs","Alle Bugs Melden"
 "Required Fields","Pflichtfelder"
-"Response from server isn\'t valid.","Serverantwort ist nicht gültig."
+"Response from server isn't valid.","Serverantwort ist nicht gültig."
 "Run admin interface with SSL","Admininterface mit SSL ausführen"
 "Run this in your shell from Magento root folder:","Führen Sie dies in Ihrer Shell aus dem Magento Rootordner aus:"
 "Save Session Data In","Sessiondaten speichern in"
@@ -106,7 +106,7 @@
 "Tables Prefix","Tabellenpräfix"
 "The URL ""%s"" is invalid.","Die URL ""%s"" ist ungültig."
 "The URL ""%s"" is not accessible.","Die URL ""%s"" ist nicht verfügbar."
-"The database server version doesn\'t match system requirements (required: %s, actual: %s).","Die Version des Datenbankservers stimmt nicht mit den Systemanforderungen (benötigt: %s, vorhanden: %s) überein."
+"The database server version doesn't match system requirements (required: %s, actual: %s).","Die Version des Datenbankservers stimmt nicht mit den Systemanforderungen (benötigt: %s, vorhanden: %s) überein."
 "The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_), the first character should be a letter.","Das Tabellen-Präfix darf nur Buchstaben (a-z), Ziffern (0-9) oder Unterstriche (_) enthalten; das erste Zeichen sollte ein Buchstabe sein."
 "There was a problem installing Magento packages. Please read the log, correct errors and try again.","Beim Installieren der Magento Packages ist ein Fehler aufgetreten. Bitte lesen Sie das Log, korrigieren Sie Fehler und versuchen sie es erneut."
 "Time Zone","Zeitzone"
diff --git a/app/code/Magento/Install/i18n/en_US.csv b/app/code/Magento/Install/i18n/en_US.csv
index 2fb240ea147..43192dd0f4c 100644
--- a/app/code/Magento/Install/i18n/en_US.csv
+++ b/app/code/Magento/Install/i18n/en_US.csv
@@ -93,7 +93,7 @@
 "Provide a complete base URL for SSL connection. For example: %s","Provide a complete base URL for SSL connection. For example: %s"
 "Report All Bugs","Report All Bugs"
 "Required Fields","Required Fields"
-"Response from server isn\'t valid.","Response from server isn\'t valid."
+"Response from server isn't valid.","Response from server isn't valid."
 "Run admin interface with SSL","Run admin interface with SSL"
 "Run this in your shell from Magento root folder:","Run this in your shell from Magento root folder:"
 "Save Session Data In","Save Session Data In"
@@ -106,7 +106,7 @@
 "Tables Prefix","Tables Prefix"
 "The URL ""%s"" is invalid.","The URL ""%s"" is invalid."
 "The URL ""%s"" is not accessible.","The URL ""%s"" is not accessible."
-"The database server version doesn\'t match system requirements (required: %s, actual: %s).","The database server version doesn\'t match system requirements (required: %s, actual: %s)."
+"The database server version doesn't match system requirements (required: %s, actual: %s).","The database server version doesn't match system requirements (required: %s, actual: %s)."
 "The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_), the first character should be a letter.","The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_), the first character should be a letter."
 "There was a problem installing Magento packages. Please read the log, correct errors and try again.","There was a problem installing Magento packages. Please read the log, correct errors and try again."
 "Time Zone","Time Zone"
diff --git a/app/code/Magento/Install/i18n/es_ES.csv b/app/code/Magento/Install/i18n/es_ES.csv
index 36a6422dc42..9264b240d65 100644
--- a/app/code/Magento/Install/i18n/es_ES.csv
+++ b/app/code/Magento/Install/i18n/es_ES.csv
@@ -93,7 +93,7 @@
 "Provide a complete base URL for SSL connection. For example: %s","Proporcione una completa URL base para conexión SSL. Por ejemplo: %s"
 "Report All Bugs","Informar de todos los errores"
 "Required Fields","Campos obligatorios"
-"Response from server isn\'t valid.","La respuesta del servidor no es válida."
+"Response from server isn't valid.","La respuesta del servidor no es válida."
 "Run admin interface with SSL","Ejecutar la interfaz de administración con SSL"
 "Run this in your shell from Magento root folder:","Ejecute esto en su sistema desde la carpeta raíz de Magento:"
 "Save Session Data In","Guardar datos de sesión en"
@@ -106,7 +106,7 @@
 "Tables Prefix","Prefijo de tablas"
 "The URL ""%s"" is invalid.","El URL ""%s"" no es válido."
 "The URL ""%s"" is not accessible.","No se puede acceder al URL ""%s""."
-"The database server version doesn\'t match system requirements (required: %s, actual: %s).","La versión del servidor de la base de datos no se adecua a los requisitos del sistema (requeridos: %s, existentes: %s)."
+"The database server version doesn't match system requirements (required: %s, actual: %s).","La versión del servidor de la base de datos no se adecua a los requisitos del sistema (requeridos: %s, existentes: %s)."
 "The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_), the first character should be a letter.","El prefijo de tabla solo debe contener letras (a-z), números (0-9) o el carácter de subrayado (_), el primer carácter debería ser una letra."
 "There was a problem installing Magento packages. Please read the log, correct errors and try again.","Hubo un problema al instalar los paquetes de Magento. Por favor lea el registro, corrija los errores e inténtelo de nuevo."
 "Time Zone","Zona Horaria"
diff --git a/app/code/Magento/Install/i18n/fr_FR.csv b/app/code/Magento/Install/i18n/fr_FR.csv
index 93e8dc9a3ff..b0dcd01de95 100644
--- a/app/code/Magento/Install/i18n/fr_FR.csv
+++ b/app/code/Magento/Install/i18n/fr_FR.csv
@@ -93,7 +93,7 @@
 "Provide a complete base URL for SSL connection. For example: %s","Fournir une base complète d'URL pour une connexion SSL. Par exemple : %s"
 "Report All Bugs","Rapporter tous les bugs"
 "Required Fields","Champs requis"
-"Response from server isn\'t valid.","La réponse du serveur n'est pas valide."
+"Response from server isn't valid.","La réponse du serveur n'est pas valide."
 "Run admin interface with SSL","Exécuter l'interface admin avec SSL"
 "Run this in your shell from Magento root folder:","Exécuter ceci dans votre shell depuis le dossier racine de Magento :"
 "Save Session Data In","Enregistrer les données de la session dans"
@@ -106,7 +106,7 @@
 "Tables Prefix","Préfixe de tables"
 "The URL ""%s"" is invalid.","L'URL ""%s"" n'est pas valide."
 "The URL ""%s"" is not accessible.","L'URL ""%s"" n'est pas accessible."
-"The database server version doesn\'t match system requirements (required: %s, actual: %s).","La version du serveur de base de données ne correspond pas aux conditions du système (requis : %s, présent : %s)."
+"The database server version doesn't match system requirements (required: %s, actual: %s).","La version du serveur de base de données ne correspond pas aux conditions du système (requis : %s, présent : %s)."
 "The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_), the first character should be a letter.","Le préfixe du tableau ne doit contenir que des lettres (a-z), des chiffres (0-9) ou des tirets bas (_), et le premier caractère doit être une lettre."
 "There was a problem installing Magento packages. Please read the log, correct errors and try again.","Un problème est survenu lors de l'installation des paquets Magento. Veuillez lire le journal, corriger les erreurs et réessayer."
 "Time Zone","Fuseau horaire"
diff --git a/app/code/Magento/Install/i18n/nl_NL.csv b/app/code/Magento/Install/i18n/nl_NL.csv
index 5f347bd891e..4dc5d5cffeb 100644
--- a/app/code/Magento/Install/i18n/nl_NL.csv
+++ b/app/code/Magento/Install/i18n/nl_NL.csv
@@ -93,7 +93,7 @@
 "Provide a complete base URL for SSL connection. For example: %s","Geef een volledige basis URL voor SSL connectie. Bijvoorbeeld: %s"
 "Report All Bugs","Rapporteer Alle Bugs"
 "Required Fields","Benodigde Velden"
-"Response from server isn\'t valid.","Antwoord van de server is niet valide."
+"Response from server isn't valid.","Antwoord van de server is niet valide."
 "Run admin interface with SSL","Start administratie bedieningspaneel met SSL"
 "Run this in your shell from Magento root folder:","Voer dit in uw shell van uw Magento root folder uit:"
 "Save Session Data In","Sla Sessie Data Op In"
@@ -106,7 +106,7 @@
 "Tables Prefix","Tabellen Voorvoegsel"
 "The URL ""%s"" is invalid.","De URL ""%s"" is ongeldig."
 "The URL ""%s"" is not accessible.","De URL ""%s"" is niet toegankelijk."
-"The database server version doesn\'t match system requirements (required: %s, actual: %s).","De database server komt niet overeen met systeemvereisten (benodigd: %s, werkelijk: %s)."
+"The database server version doesn't match system requirements (required: %s, actual: %s).","De database server komt niet overeen met systeemvereisten (benodigd: %s, werkelijk: %s)."
 "The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_), the first character should be a letter.","In de tabel prefix mogen alleen letters (az), cijfers (0-9) en onderstrepingstekens (_) bevatten, het eerste karakter moet een letter zijn."
 "There was a problem installing Magento packages. Please read the log, correct errors and try again.","Er was een probleem met het installeren van Magento pakketten. Lees alstublieft het logboek, verbeter fouten en probeer het opnieuw."
 "Time Zone","Tijdszone"
diff --git a/app/code/Magento/Install/i18n/pt_BR.csv b/app/code/Magento/Install/i18n/pt_BR.csv
index 49ec5da8995..13257692b18 100644
--- a/app/code/Magento/Install/i18n/pt_BR.csv
+++ b/app/code/Magento/Install/i18n/pt_BR.csv
@@ -93,7 +93,7 @@
 "Provide a complete base URL for SSL connection. For example: %s","Forneça um URL base completo para a conexão SSL. Por exemplo: %s"
 "Report All Bugs","Reporte Todos os Erros"
 "Required Fields","Campos Obrigatórios"
-"Response from server isn\'t valid.","Resposta do servidor não é válida."
+"Response from server isn't valid.","Resposta do servidor não é válida."
 "Run admin interface with SSL","Execute a interface de administração com SSL"
 "Run this in your shell from Magento root folder:","Execute isto em seu sistema operativo a partir da pasta raiz Magento:"
 "Save Session Data In","Salve Dados de Sessão Em"
@@ -106,7 +106,7 @@
 "Tables Prefix","Prefixo das Tabelas"
 "The URL ""%s"" is invalid.","O URL ""%s"" é inválido."
 "The URL ""%s"" is not accessible.","O URL ""%s"" não está acessível."
-"The database server version doesn\'t match system requirements (required: %s, actual: %s).","A versão do servidor do banco de dados não combina com os requisitos de sistema (requerido: %s, atual: %s)."
+"The database server version doesn't match system requirements (required: %s, actual: %s).","A versão do servidor do banco de dados não combina com os requisitos de sistema (requerido: %s, atual: %s)."
 "The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_), the first character should be a letter.","O prefixo da tabela deve conter somente letras (a-z), números (0-9) ou sublinhados (_), o primeiro caractere deve ser uma letra."
 "There was a problem installing Magento packages. Please read the log, correct errors and try again.","Houve um problema ao instalar pacotes Magento. Por favor leia o registro, corrija erros e tente novamente."
 "Time Zone","Fuso Horário"
diff --git a/app/code/Magento/Install/i18n/zh_CN.csv b/app/code/Magento/Install/i18n/zh_CN.csv
index 0f40aedac1f..18671198c20 100644
--- a/app/code/Magento/Install/i18n/zh_CN.csv
+++ b/app/code/Magento/Install/i18n/zh_CN.csv
@@ -93,7 +93,7 @@
 "Provide a complete base URL for SSL connection. For example: %s","为SSL连接提供完整的基本UEL,例如:%s"
 "Report All Bugs","报告所有Bug"
 "Required Fields","必须的字段"
-"Response from server isn\'t valid.","来自服务器的响应无效。"
+"Response from server isn't valid.","来自服务器的响应无效。"
 "Run admin interface with SSL","使用SSL运行管理界面。"
 "Run this in your shell from Magento root folder:","在您的外壳中从Magento根文件夹运行这个:"
 "Save Session Data In","保存会话数据至"
@@ -106,7 +106,7 @@
 "Tables Prefix","表格前缀"
 "The URL ""%s"" is invalid.","URL ""%s"" 无效。"
 "The URL ""%s"" is not accessible.","URL “%s” 无法访问。"
-"The database server version doesn\'t match system requirements (required: %s, actual: %s).","数据库服务器版本不满足要求(需要:%s,实际:%s)。"
+"The database server version doesn't match system requirements (required: %s, actual: %s).","数据库服务器版本不满足要求(需要:%s,实际:%s)。"
 "The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_), the first character should be a letter.","表前缀只能包含字母 (a-z)、数字 (0-9),或下划线 (_),第一个字符必须是字母。"
 "There was a problem installing Magento packages. Please read the log, correct errors and try again.","安装Magento包时遇到了错误。请阅读日志,解决问题,并重试。"
 "Time Zone","时区"
diff --git a/app/code/Magento/Install/view/install/css/validate.css b/app/code/Magento/Install/view/install/css/validate.css
index d711bafdfeb..ad76ef7a83a 100644
--- a/app/code/Magento/Install/view/install/css/validate.css
+++ b/app/code/Magento/Install/view/install/css/validate.css
@@ -28,7 +28,7 @@ input.mage-error, textarea.mage-error, ul.mage-error, select.mage-error {
 
 }
 div.mage-error {
-    background: url("../images/validation_advice_bg.gif") no-repeat scroll 2px 1px transparent;
+    background: url(../images/validation_advice_bg.gif) no-repeat scroll 2px 1px transparent;
     clear: both;
     font-size: 0.95em;
     font-weight: bold;
diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php
index b0382acaa5d..98fd4ac0347 100644
--- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php
+++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php
@@ -33,7 +33,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry = null;
 
@@ -44,13 +44,13 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
      * Initialize dependencies.
      *
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Integration\Helper\Data $integrationHelper
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Integration\Helper\Data $integrationHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Integration/Controller/Adminhtml/Integration.php b/app/code/Magento/Integration/Controller/Adminhtml/Integration.php
index e394cb01c39..021db1a7beb 100644
--- a/app/code/Magento/Integration/Controller/Adminhtml/Integration.php
+++ b/app/code/Magento/Integration/Controller/Adminhtml/Integration.php
@@ -46,7 +46,7 @@ class Integration extends Action
     const REGISTRY_KEY_CURRENT_INTEGRATION = 'current_integration';
 
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
@@ -72,7 +72,7 @@ class Integration extends Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Logger $logger
      * @param \Magento\Integration\Service\IntegrationV1Interface $integrationService
      * @param IntegrationOauthService $oauthService
@@ -82,7 +82,7 @@ class Integration extends Action
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Logger $logger,
         \Magento\Integration\Service\IntegrationV1Interface $integrationService,
         IntegrationOauthService $oauthService,
diff --git a/app/code/Magento/Integration/Model/Integration.php b/app/code/Magento/Integration/Model/Integration.php
index 9af81d5aa46..9e0bdbf54f9 100644
--- a/app/code/Magento/Integration/Model/Integration.php
+++ b/app/code/Magento/Integration/Model/Integration.php
@@ -79,16 +79,16 @@ class Integration extends \Magento\Core\Model\AbstractModel
     protected $_dateTime;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Integration/Model/Integration/Source/Status.php b/app/code/Magento/Integration/Model/Integration/Source/Status.php
index f62da5a0f35..8a0abd73bc4 100644
--- a/app/code/Magento/Integration/Model/Integration/Source/Status.php
+++ b/app/code/Magento/Integration/Model/Integration/Source/Status.php
@@ -26,7 +26,7 @@ namespace Magento\Integration\Model\Integration\Source;
 /**
  * Integration status options.
  */
-class Status implements \Magento\Core\Model\Option\ArrayInterface
+class Status implements \Magento\Option\ArrayInterface
 {
     /**
      * Retrieve status options array.
diff --git a/app/code/Magento/Integration/Model/Oauth/Consumer.php b/app/code/Magento/Integration/Model/Oauth/Consumer.php
index b477341532c..12ad275feb0 100644
--- a/app/code/Magento/Integration/Model/Oauth/Consumer.php
+++ b/app/code/Magento/Integration/Model/Oauth/Consumer.php
@@ -57,8 +57,8 @@ class Consumer extends \Magento\Core\Model\AbstractModel implements ConsumerInte
     protected $_keyLengthFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Integration\Model\Oauth\Consumer\Validator\KeyLengthFactory $keyLengthFactory
      * @param \Magento\Url\Validator $urlValidator
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -66,8 +66,8 @@ class Consumer extends \Magento\Core\Model\AbstractModel implements ConsumerInte
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Integration\Model\Oauth\Consumer\Validator\KeyLengthFactory $keyLengthFactory,
         \Magento\Url\Validator $urlValidator,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Integration/Model/Oauth/Nonce.php b/app/code/Magento/Integration/Model/Oauth/Nonce.php
index 0e2d8caf8fd..d6109360d5a 100644
--- a/app/code/Magento/Integration/Model/Oauth/Nonce.php
+++ b/app/code/Magento/Integration/Model/Oauth/Nonce.php
@@ -45,16 +45,16 @@ class Nonce extends \Magento\Core\Model\AbstractModel
     protected $_oauthData;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Integration\Helper\Oauth\Data $oauthData
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Integration\Helper\Oauth\Data $oauthData,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Integration/Model/Oauth/Token.php b/app/code/Magento/Integration/Model/Oauth/Token.php
index 3f38e219c58..cf76dc4cbf2 100644
--- a/app/code/Magento/Integration/Model/Oauth/Token.php
+++ b/app/code/Magento/Integration/Model/Oauth/Token.php
@@ -107,8 +107,8 @@ class Token extends \Magento\Core\Model\AbstractModel
     /**
      * Initialize dependencies.
      *
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Integration\Model\Oauth\Consumer\Validator\KeyLengthFactory $keyLengthFactory
      * @param \Magento\Url\Validator $urlValidator
      * @param \Magento\Stdlib\DateTime $dateTime
@@ -121,8 +121,8 @@ class Token extends \Magento\Core\Model\AbstractModel
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Integration\Model\Oauth\Consumer\Validator\KeyLengthFactory $keyLengthFactory,
         \Magento\Url\Validator $urlValidator,
         \Magento\Stdlib\DateTime $dateTime,
diff --git a/app/code/Magento/Log/Model/Aggregation.php b/app/code/Magento/Log/Model/Aggregation.php
index 68f0bbfaf11..d8b8b258b24 100644
--- a/app/code/Magento/Log/Model/Aggregation.php
+++ b/app/code/Magento/Log/Model/Aggregation.php
@@ -50,16 +50,16 @@ class Aggregation extends \Magento\Core\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Log/Model/Cron.php b/app/code/Magento/Log/Model/Cron.php
index 376a45bb2d5..c0b5be51106 100644
--- a/app/code/Magento/Log/Model/Cron.php
+++ b/app/code/Magento/Log/Model/Cron.php
@@ -71,14 +71,14 @@ class Cron extends \Magento\Core\Model\AbstractModel
     protected $_log;
 
     /**
-     * @var \Magento\Email\Model\TemplateFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_templateFactory;
+    protected $_transportBuilder;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
-     * @param \Magento\Email\Model\TemplateFactory $templateFactory
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param \Magento\Log\Model\Log $log
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\TranslateInterface $translate
@@ -88,9 +88,9 @@ class Cron extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
-        \Magento\Email\Model\TemplateFactory $templateFactory,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\Log\Model\Log $log,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\TranslateInterface $translate,
@@ -99,7 +99,7 @@ class Cron extends \Magento\Core\Model\AbstractModel
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
     ) {
-        $this->_templateFactory = $templateFactory;
+        $this->_transportBuilder = $transportBuilder;
         $this->_log = $log;
         $this->_storeManager = $storeManager;
         $this->_translate = $translate;
@@ -121,23 +121,20 @@ class Cron extends \Magento\Core\Model\AbstractModel
             return $this;
         }
 
-
         $this->_translate->setTranslateInline(false);
 
-        $emailTemplate = $this->_templateFactory->create();
-        /* @var $emailTemplate \Magento\Email\Model\Template */
-        $emailTemplate->setDesignConfig(
-            array(
-                'area' => 'backend',
+        $transport = $this->_transportBuilder
+            ->setTemplateIdentifier($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_LOG_CLEAN_TEMPLATE))
+            ->setTemplateOptions(array(
+                'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
                 'store' => $this->_storeManager->getStore()->getId()
-            )
-        )->sendTransactional(
-            $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_LOG_CLEAN_TEMPLATE),
-            $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_LOG_CLEAN_IDENTITY),
-            $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_LOG_CLEAN_RECIPIENT),
-            null,
-            array('warnings' => join("\n", $this->_errors))
-        );
+            ))
+            ->setTemplateVars(array('warnings' => join("\n", $this->_errors)))
+            ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_LOG_CLEAN_IDENTITY))
+            ->addTo($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_LOG_CLEAN_RECIPIENT))
+            ->getTransport();
+
+        $transport->sendMessage();
 
         $this->_translate->setTranslateInline(true);
         return $this;
diff --git a/app/code/Magento/Log/Model/Customer.php b/app/code/Magento/Log/Model/Customer.php
index 61d0abcf90d..10e696e1943 100644
--- a/app/code/Magento/Log/Model/Customer.php
+++ b/app/code/Magento/Log/Model/Customer.php
@@ -53,16 +53,16 @@ class Customer extends \Magento\Core\Model\AbstractModel
     protected $dateTime;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Log/Model/Log.php b/app/code/Magento/Log/Model/Log.php
index 4727613c54f..e511aca581f 100644
--- a/app/code/Magento/Log/Model/Log.php
+++ b/app/code/Magento/Log/Model/Log.php
@@ -57,16 +57,16 @@ class Log extends \Magento\Core\Model\AbstractModel
     protected $_coreStoreConfig;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Log/Model/Shell.php b/app/code/Magento/Log/Model/Shell.php
index e90e674e3db..73074528048 100644
--- a/app/code/Magento/Log/Model/Shell.php
+++ b/app/code/Magento/Log/Model/Shell.php
@@ -32,7 +32,7 @@ namespace Magento\Log\Model;
  * @package     Magento_Log
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-class Shell extends \Magento\Core\Model\AbstractShell
+class Shell extends \Magento\App\AbstractShell
 {
     /**
      * @var \Magento\Log\Model\Shell\Command\Factory
diff --git a/app/code/Magento/Log/Model/Visitor.php b/app/code/Magento/Log/Model/Visitor.php
index 35a192d1cd9..86c56dc64c0 100644
--- a/app/code/Magento/Log/Model/Visitor.php
+++ b/app/code/Magento/Log/Model/Visitor.php
@@ -114,8 +114,8 @@ class Visitor extends \Magento\Core\Model\AbstractModel
     protected $dateTime;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Customer\Model\CustomerFactory $customerFactory
      * @param \Magento\Sales\Model\QuoteFactory $quoteFactory
@@ -133,8 +133,8 @@ class Visitor extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Customer\Model\CustomerFactory $customerFactory,
         \Magento\Sales\Model\QuoteFactory $quoteFactory,
diff --git a/app/code/Magento/Log/Model/Visitor/Online.php b/app/code/Magento/Log/Model/Visitor/Online.php
index 38c8f12e7de..8f7efd2687f 100644
--- a/app/code/Magento/Log/Model/Visitor/Online.php
+++ b/app/code/Magento/Log/Model/Visitor/Online.php
@@ -59,16 +59,16 @@ class Online extends \Magento\Core\Model\AbstractModel
     protected $_coreStoreConfig;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Log/etc/module.xml b/app/code/Magento/Log/etc/module.xml
index f3d7e8dd56d..5a11ddf352b 100755
--- a/app/code/Magento/Log/etc/module.xml
+++ b/app/code/Magento/Log/etc/module.xml
@@ -34,7 +34,6 @@
             <module name="Magento_Customer"/>
             <module name="Magento_Sales"/>
             <module name="Magento_Backend"/>
-            <module name="Magento_Email"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/Multishipping/Block/Checkout/Address/Select.php b/app/code/Magento/Multishipping/Block/Checkout/Address/Select.php
index 38abc957847..7b6ddf70346 100644
--- a/app/code/Magento/Multishipping/Block/Checkout/Address/Select.php
+++ b/app/code/Magento/Multishipping/Block/Checkout/Address/Select.php
@@ -24,17 +24,48 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\Multishipping\Block\Checkout\Address;
+
+use Magento\Customer\Service\V1\CustomerAddressServiceInterface;
+use Magento\Customer\Helper\Address as CustomerAddressHelper;
+use Magento\Exception\NoSuchEntityException;
+
 /**
  * Multishipping checkout select billing address
- *
- * @category   Magento
- * @package    Magento_Checkout
- * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Multishipping\Block\Checkout\Address;
-
 class Select extends \Magento\Multishipping\Block\Checkout\AbstractMultishipping
 {
+    /**
+     * @var CustomerAddressServiceInterface
+     */
+    protected $_customerAddressService;
+
+    /**
+     * @var CustomerAddressHelper
+     */
+    protected $_customerAddressHelper;
+
+    /**
+     * Initialize dependencies.
+     *
+     * @param \Magento\View\Element\Template\Context $context
+     * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping
+     * @param CustomerAddressServiceInterface $customerAddressService
+     * @param CustomerAddressHelper $customerAddressHelper
+     * @param array $data
+     */
+    public function __construct(
+        \Magento\View\Element\Template\Context $context,
+        \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping,
+        CustomerAddressServiceInterface $customerAddressService,
+        CustomerAddressHelper $customerAddressHelper,
+        array $data = array()
+    ) {
+        $this->_customerAddressService = $customerAddressService;
+        $this->_customerAddressHelper = $customerAddressHelper;
+        parent::__construct($context, $multishipping, $data);
+    }
+
     /**
      * @var bool
      */
@@ -48,34 +79,85 @@ class Select extends \Magento\Multishipping\Block\Checkout\AbstractMultishipping
         return parent::_prepareLayout();
     }
 
+    /**
+     * Get a list of current customer addresses.
+     *
+     * @return \Magento\Customer\Service\V1\Dto\Address[]
+     */
     public function getAddressCollection()
     {
-        $collection = $this->getData('address_collection');
-        if (is_null($collection)) {
-            $collection = $this->_multishipping->getCustomer()->getAddresses();
-            $this->setData('address_collection', $collection);
+        $addresses = $this->getData('address_collection');
+        if (is_null($addresses)) {
+            try{
+                $addresses = $this->_customerAddressService->getAddresses(
+                    $this->_multishipping->getCustomer()->getCustomerId()
+                );
+            } catch (NoSuchEntityException $e) {
+                return [];
+            }
+            $this->setData('address_collection', $addresses);
         }
-        return $collection;
+        return $addresses;
     }
-    
+
+    /**
+     * Represent customer address in HTML format.
+     *
+     * @param \Magento\Customer\Service\V1\Dto\Address $addressData
+     * @return string
+     */
+    public function getAddressAsHtml($addressData)
+    {
+        $formatTypeRenderer = $this->_customerAddressHelper->getFormatTypeRenderer('html');
+        $result = '';
+        if ($formatTypeRenderer) {
+            $result = $formatTypeRenderer->renderArray($addressData->getAttributes());
+        }
+        return $result;
+    }
+
+    /**
+     * Check if provided address is default customer billing address.
+     *
+     * @param \Magento\Customer\Service\V1\Dto\Address $address
+     * @return bool
+     */
     public function isAddressDefaultBilling($address)
     {
         return $address->getId() == $this->_multishipping->getCustomer()->getDefaultBilling();
     }
-    
+
+    /**
+     * Check if provided address is default customer shipping address.
+     *
+     * @param \Magento\Customer\Service\V1\Dto\Address $address
+     * @return bool
+     */
     public function isAddressDefaultShipping($address)
     {
         return $address->getId() == $this->_multishipping->getCustomer()->getDefaultShipping();
     }
-    
+
+    /**
+     * Get URL of customer address edit page.
+     *
+     * @param \Magento\Customer\Service\V1\Dto\Address $address
+     * @return string
+     */
     public function getEditAddressUrl($address)
     {
-        return $this->getUrl('*/*/editAddress', array('id'=>$address->getId()));
+        return $this->getUrl('*/*/editAddress', array('id' => $address->getId()));
     }
 
+    /**
+     * Get URL of page, at which customer billing address can be set.
+     *
+     * @param \Magento\Customer\Service\V1\Dto\Address $address
+     * @return string
+     */
     public function getSetAddressUrl($address)
     {
-        return $this->getUrl('*/*/setBilling', array('id'=>$address->getId()));
+        return $this->getUrl('*/*/setBilling', array('id' => $address->getId()));
     }
 
     public function getAddNewUrl()
diff --git a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php
index 1325daba0e8..6f9ae540977 100644
--- a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php
+++ b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php
@@ -84,6 +84,9 @@ class Shipping extends \Magento\Sales\Block\Items\AbstractItems
         return parent::_prepareLayout();
     }
 
+    /**
+     * @return \Magento\Customer\Model\Address[]
+     */
     public function getAddresses()
     {
         return $this->getCheckout()->getQuote()->getAllShippingAddresses();
diff --git a/app/code/Magento/Multishipping/Controller/Checkout.php b/app/code/Magento/Multishipping/Controller/Checkout.php
index 6272f1848a7..a43b59692db 100644
--- a/app/code/Magento/Multishipping/Controller/Checkout.php
+++ b/app/code/Magento/Multishipping/Controller/Checkout.php
@@ -18,25 +18,45 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Checkout
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
-/**
- * Multishipping checkout controller
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
 namespace Magento\Multishipping\Controller;
 
-use Magento\App\Action\NotFoundException;
 use Magento\App\RequestInterface;
 use Magento\Multishipping\Model\Checkout\Type\Multishipping\State;
+use Magento\Customer\Service\V1\CustomerServiceInterface as CustomerService;
+use Magento\Customer\Service\V1\CustomerAccountServiceInterface as CustomerAccountService;
+use Magento\Customer\Service\V1\CustomerMetadataServiceInterface as CustomerMetadataService;
 
+/**
+ * Multishipping checkout controller
+ */
 class Checkout extends \Magento\Checkout\Controller\Action
 {
+    /**
+     * @param \Magento\App\Action\Context $context
+     * @param \Magento\Customer\Model\Session $customerSession
+     * @param CustomerService $customerService
+     * @param CustomerAccountService $customerAccountService
+     * @param CustomerMetadataService $customerMetadataService
+     */
+    public function __construct(
+        \Magento\App\Action\Context $context,
+        \Magento\Customer\Model\Session $customerSession,
+        CustomerService $customerService,
+        CustomerAccountService $customerAccountService,
+        CustomerMetadataService $customerMetadataService
+    ) {
+        parent::__construct(
+            $context,
+            $customerSession,
+            $customerService,
+            $customerAccountService,
+            $customerMetadataService
+        );
+    }
+
     /**
      * Retrieve checkout model
      *
@@ -77,17 +97,6 @@ class Checkout extends \Magento\Checkout\Controller\Action
         return $this->_objectManager->get('Magento\Checkout\Model\Session');
     }
 
-    /**
-     * @param \Magento\App\Action\Context $context
-     * @param \Magento\Customer\Model\Session $customerSession
-     */
-    public function __construct(
-        \Magento\App\Action\Context $context,
-        \Magento\Customer\Model\Session $customerSession
-    ) {
-        parent::__construct($context, $customerSession);
-    }
-
     /**
      * Dispatch request
      *
diff --git a/app/code/Magento/Multishipping/Controller/Checkout/Address.php b/app/code/Magento/Multishipping/Controller/Checkout/Address.php
index 08bfabfc5e5..d766bd7eb17 100644
--- a/app/code/Magento/Multishipping/Controller/Checkout/Address.php
+++ b/app/code/Magento/Multishipping/Controller/Checkout/Address.php
@@ -18,23 +18,37 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Checkout
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-/**
- * Multishipping checkout address matipulation controller
- *
- * @category   Magento
- * @package    Magento_Checkout
- * @author      Magento Core Team <core@magentocommerce.com>
- */
 namespace Magento\Multishipping\Controller\Checkout;
 
+use Magento\App\Action\Context;
+use Magento\Customer\Service\V1\CustomerAddressServiceInterface;
+
+/**
+ * Multishipping checkout address manipulation controller
+ */
 class Address extends \Magento\App\Action\Action
 {
+    /** @var CustomerAddressServiceInterface */
+    protected $_customerAddressService;
+
+    /**
+     * Initialize dependencies.
+     *
+     * @param Context $context
+     * @param CustomerAddressServiceInterface $customerAddressService
+     */
+    public function __construct(
+        \Magento\App\Action\Context $context,
+        CustomerAddressServiceInterface $customerAddressService
+    ) {
+        $this->_customerAddressService = $customerAddressService;
+        parent::__construct($context);
+    }
+
     /**
      * Retrieve multishipping checkout model
      *
@@ -89,7 +103,8 @@ class Address extends \Magento\App\Action\Action
         /**
          * if we create first address we need reset emd init checkout
          */
-        if (count($this->_getCheckout()->getCustomer()->getAddresses()) == 1) {
+        $customerId = $this->_getCheckout()->getCustomer()->getCustomerId();
+        if (count($this->_customerAddressService->getAddresses($customerId)) == 1) {
             $this->_getCheckout()->reset();
         }
         $this->_redirect('*/checkout/addresses');
diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php
index e6f33650156..755d7bccc98 100644
--- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php
+++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php
@@ -18,21 +18,17 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Checkout
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\Multishipping\Model\Checkout\Type;
+
+use Magento\Customer\Service\V1\CustomerAddressServiceInterface;
+
 /**
  * Multishipping checkout model
- *
- * @category    Magento
- * @package     Magento_Checkout
- * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Multishipping\Model\Checkout\Type;
-
 class Multishipping extends \Magento\Checkout\Model\Type\AbstractType
 {
     /**
@@ -82,6 +78,8 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType
     protected $paymentSpecification;
 
     /**
+     * Initialize dependencies.
+     *
      * @var \Magento\Multishipping\Helper\Data
      */
     protected $helper;
@@ -90,6 +88,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType
      * @param \Magento\Checkout\Model\Session $checkoutSession
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Sales\Model\OrderFactory $orderFactory
+     * @param CustomerAddressServiceInterface $customerAddressService
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Core\Model\Session $session
@@ -104,6 +103,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType
         \Magento\Checkout\Model\Session $checkoutSession,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Sales\Model\OrderFactory $orderFactory,
+        CustomerAddressServiceInterface $customerAddressService,
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Core\Model\Session $session,
@@ -122,7 +122,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType
         $this->_storeManager = $storeManager;
         $this->paymentSpecification = $paymentSpecification;
         $this->helper = $helper;
-        parent::__construct($checkoutSession, $customerSession, $orderFactory, $data);
+        parent::__construct($checkoutSession, $customerSession, $orderFactory, $customerAddressService, $data);
         $this->_init();
     }
 
@@ -138,7 +138,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType
          * reset quote shipping addresses and items
          */
         $quote = $this->getQuote();
-        if (!$this->getCustomer()->getId()) {
+        if (!$this->getCustomer()->getCustomerId()) {
             return $this;
         }
 
@@ -154,7 +154,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType
 
             $defaultShipping = $this->getCustomerDefaultShippingAddress();
             if ($defaultShipping) {
-                $quote->getShippingAddress()->importCustomerAddress($defaultShipping);
+                $quote->getShippingAddress()->importCustomerAddressData($defaultShipping);
 
                 foreach ($this->getQuoteItems() as $item) {
                     /**
@@ -169,8 +169,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType
             }
 
             if ($this->getCustomerDefaultBillingAddress()) {
-                $quote->getBillingAddress()
-                    ->importCustomerAddress($this->getCustomerDefaultBillingAddress());
+                $quote->getBillingAddress()->importCustomerAddressData($this->getCustomerDefaultBillingAddress());
                 foreach ($this->getQuoteItems() as $item) {
                     if ($item->getParentItemId()) {
                         continue;
@@ -336,7 +335,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType
 
             $customerDefaultBilling = $this->getCustomerDefaultBillingAddress();
             if ($customerDefaultBilling) {
-                $quote->getBillingAddress()->importCustomerAddress($customerDefaultBilling);
+                $quote->getBillingAddress()->importCustomerAddressData($customerDefaultBilling);
             }
 
             foreach ($quote->getAllItems() as $_item) {
@@ -386,10 +385,14 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType
             }
             $quoteItem->setMultishippingQty((int)$quoteItem->getMultishippingQty()+$qty);
             $quoteItem->setQty($quoteItem->getMultishippingQty());
-            $address = $this->getCustomer()->getAddressById($addressId);
-            if ($address->getId()) {
+            try {
+                $address = $this->_customerAddressService->getAddressById($addressId);
+            } catch (\Exception $e) {
+                /** Customer address does not exist. */
+            }
+            if (isset($address)) {
                 if (!$quoteAddress = $this->getQuote()->getShippingAddressByCustomerAddressId($address->getId())) {
-                    $quoteAddress = $this->_addressFactory->create()->importCustomerAddress($address);
+                    $quoteAddress = $this->_addressFactory->create()->importCustomerAddressData($address);
                     $this->getQuote()->addShippingAddress($quoteAddress);
                 }
 
@@ -417,11 +420,15 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType
      */
     public function updateQuoteCustomerShippingAddress($addressId)
     {
-        $address = $this->getCustomer()->getAddressById($addressId);
-        if ($address) {
+        try {
+            $address = $this->_customerAddressService->getAddressById($addressId);
+        } catch (\Exception $e) {
+            /** Customer address does not exist. */
+        }
+        if (isset($address)) {
             $this->getQuote()->getShippingAddressByCustomerAddressId($addressId)
                 ->setCollectShippingRates(true)
-                ->importCustomerAddress($address)
+                ->importCustomerAddressData($address)
                 ->collectTotals();
             $this->getQuote()->save();
         }
@@ -436,10 +443,14 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType
      */
     public function setQuoteCustomerBillingAddress($addressId)
     {
-        $address = $this->getCustomer()->getAddressById($addressId);
-        if ($address) {
+        try {
+            $address = $this->_customerAddressService->getAddressById($addressId);
+        } catch (\Exception $e) {
+            /** Customer address does not exist. */
+        }
+        if (isset($address)) {
             $this->getQuote()->getBillingAddress($addressId)
-                ->importCustomerAddress($address)
+                ->importCustomerAddressData($address)
                 ->collectTotals();
             $this->getQuote()->collectTotals()->save();
         }
diff --git a/app/code/Magento/Multishipping/view/frontend/checkout/address/select.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/address/select.phtml
index 25f8a4fdfab..83429561c33 100644
--- a/app/code/Magento/Multishipping/view/frontend/checkout/address/select.phtml
+++ b/app/code/Magento/Multishipping/view/frontend/checkout/address/select.phtml
@@ -18,10 +18,11 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    design
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+
+/** @var \Magento\Multishipping\Block\Checkout\Address\Select $this */
 ?>
 <div class="multicheckout block change billing">
     <div class="actions">
@@ -30,7 +31,7 @@
     <?php foreach ($this->getAddressCollection() as $_address): ?>
         <div class="box billing">
             <address>
-                <?php echo $_address->format('html') ?>
+                <?php echo $this->getAddressAsHtml($_address) ?>
                 <?php if($this->isAddressDefaultBilling($_address)): ?>
                     <br /><strong><?php echo __('Default Billing') ?></strong>
                 <?php endif; ?>
diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php
index 9862e6010fc..8db0800be89 100644
--- a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php
+++ b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php
@@ -41,7 +41,7 @@ class Edit extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -53,13 +53,13 @@ class Edit extends \Magento\Backend\Block\Template
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit/Form.php b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit/Form.php
index ccc52cbe309..d214d1ba6f8 100644
--- a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit/Form.php
+++ b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit/Form.php
@@ -25,8 +25,6 @@
  */
 namespace Magento\Newsletter\Block\Adminhtml\Queue\Edit;
 
-use Magento\Newsletter\Model\Queue;
-
 /**
  * Newsletter queue edit form
  *
@@ -53,7 +51,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Newsletter\Model\QueueFactory $queueFactory
      * @param \Magento\Core\Model\System\Store $systemStore
@@ -62,7 +60,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Newsletter\Model\QueueFactory $queueFactory,
         \Magento\Core\Model\System\Store $systemStore,
@@ -84,6 +82,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     protected function _prepareForm()
     {
+        /* @var $queue \Magento\Newsletter\Model\Queue */
         $queue = $this->getQueue();
 
         /** @var \Magento\Data\Form $form */
@@ -97,7 +96,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
         $dateFormat = $this->_locale->getDateFormat(\Magento\Core\Model\LocaleInterface::FORMAT_TYPE_MEDIUM);
         $timeFormat = $this->_locale->getTimeFormat(\Magento\Core\Model\LocaleInterface::FORMAT_TYPE_MEDIUM);
 
-        if ($queue->getQueueStatus() == Queue::STATUS_NEVER) {
+        if ($queue->getQueueStatus() == \Magento\Newsletter\Model\Queue::STATUS_NEVER) {
             $fieldset->addField('date', 'date', array(
                 'name'      =>    'start_at',
                 'date_format' => $dateFormat,
@@ -204,7 +203,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
                 'container_id'  => 'field_newsletter_styles',
                 'value'         => $queue->getTemplate()->getTemplateStyles()
             ));
-        } elseif (Queue::STATUS_NEVER != $queue->getQueueStatus()) {
+        } elseif (\Magento\Newsletter\Model\Queue::STATUS_NEVER != $queue->getQueueStatus()) {
             $fieldset->addField('text', 'textarea', array(
                 'name'      =>    'text',
                 'label'     =>    __('Message'),
@@ -249,7 +248,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
     /**
      * Retrieve queue object
      *
-     * @return Queue
+     * @return \Magento\Newsletter\Model\Queue
      */
     protected function getQueue()
     {
diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php
index 5a02cb98f3a..87e7f9804ff 100644
--- a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php
+++ b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php
@@ -44,7 +44,7 @@ class Website
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -63,7 +63,7 @@ class Website
      * @param \Magento\Core\Model\Resource\Helper $resourceHelper
      * @param \Magento\Core\Model\Resource\Website\CollectionFactory $websitesFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
@@ -71,7 +71,7 @@ class Website
         \Magento\Core\Model\Resource\Helper $resourceHelper,
         \Magento\Core\Model\Resource\Website\CollectionFactory $websitesFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php
index 9b7b2f862d7..577f9f71dcb 100644
--- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php
+++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php
@@ -45,7 +45,7 @@ class Edit extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -57,13 +57,13 @@ class Edit extends \Magento\Backend\Block\Widget
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit/Form.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit/Form.php
index 1eb60eb5e4a..593e8318f38 100644
--- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit/Form.php
+++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit/Form.php
@@ -43,14 +43,14 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig,
         array $data = array()
diff --git a/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/GroupOptionHash.php b/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/GroupOptionHash.php
index 71db70818e4..ff7d7055da3 100644
--- a/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/GroupOptionHash.php
+++ b/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/GroupOptionHash.php
@@ -25,21 +25,19 @@
  */
 namespace Magento\Newsletter\Block\Subscribe\Grid\Options;
 
-use Magento\Core\Model\System\Store;
-
-class GroupOptionHash implements \Magento\Core\Model\Option\ArrayInterface
+class GroupOptionHash implements \Magento\Option\ArrayInterface
 {
     /**
      * System Store Model
      *
-     * @var Store
+     * @var \Magento\Core\Model\System\Store
      */
     protected $_systemStore;
 
     /**
-     * @param Store $systemStore
+     * @param \Magento\Core\Model\System\Store $systemStore
      */
-    public function __construct(Store $systemStore)
+    public function __construct(\Magento\Core\Model\System\Store $systemStore)
     {
         $this->_systemStore = $systemStore;
     }
diff --git a/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/StoreOptionHash.php b/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/StoreOptionHash.php
index b48e45a4b14..a10143abdf6 100644
--- a/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/StoreOptionHash.php
+++ b/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/StoreOptionHash.php
@@ -25,21 +25,19 @@
  */
 namespace Magento\Newsletter\Block\Subscribe\Grid\Options;
 
-use Magento\Core\Model\System\Store;
-
-class StoreOptionHash implements \Magento\Core\Model\Option\ArrayInterface
+class StoreOptionHash implements \Magento\Option\ArrayInterface
 {
     /**
      * System Store Model
      *
-     * @var Store
+     * @var \Magento\Core\Model\System\Store
      */
     protected $_systemStore;
 
     /**
-     * @param Store $systemStore
+     * @param \Magento\Core\Model\System\Store $systemStore
      */
-    public function __construct(Store $systemStore)
+    public function __construct(\Magento\Core\Model\System\Store $systemStore)
     {
         $this->_systemStore = $systemStore;
     }
diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php
index c9aac04b51e..fb3e2497230 100644
--- a/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php
+++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php
@@ -38,17 +38,17 @@ class Queue extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php
index d23f4f97730..3f8e37a187a 100644
--- a/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php
+++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php
@@ -37,16 +37,16 @@ class Template extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Newsletter/Helper/Data.php b/app/code/Magento/Newsletter/Helper/Data.php
index fb9ffa05c65..aaf19f61c06 100644
--- a/app/code/Magento/Newsletter/Helper/Data.php
+++ b/app/code/Magento/Newsletter/Helper/Data.php
@@ -44,7 +44,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
      */
     public function getConfirmationUrl($subscriber)
     {
-        return $this->_urlBuilder->setStore($subscriber->getStoreId())
+        return $this->_urlBuilder->setScope($subscriber->getStoreId())
             ->getUrl('newsletter/subscriber/confirm', array(
                 'id'     => $subscriber->getId(),
                 'code'   => $subscriber->getCode(),
@@ -60,7 +60,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
      */
     public function getUnsubscribeUrl($subscriber)
     {
-        return $this->_urlBuilder->setStore($subscriber->getStoreId())
+        return $this->_urlBuilder->setScope($subscriber->getStoreId())
             ->getUrl('newsletter/subscriber/unsubscribe', array(
                 'id'     => $subscriber->getId(),
                 'code'   => $subscriber->getCode(),
diff --git a/app/code/Magento/Newsletter/Model/Problem.php b/app/code/Magento/Newsletter/Model/Problem.php
index a16c5a65ab3..52f29879df3 100644
--- a/app/code/Magento/Newsletter/Model/Problem.php
+++ b/app/code/Magento/Newsletter/Model/Problem.php
@@ -62,16 +62,16 @@ class Problem extends \Magento\Core\Model\AbstractModel
     /**
      * Construct
      *
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Newsletter/Model/Queue.php b/app/code/Magento/Newsletter/Model/Queue.php
index 65c4851d1ba..1e29e9e94cb 100644
--- a/app/code/Magento/Newsletter/Model/Queue.php
+++ b/app/code/Magento/Newsletter/Model/Queue.php
@@ -61,11 +61,6 @@ class Queue extends \Magento\Core\Model\Template
      */
     protected $_template;
 
-    /**
-     * @var \Magento\Email\Model\Template
-     */
-    protected $_emailTemplate = null;
-
     /**
      * Subscribers collection
      *
@@ -114,13 +109,6 @@ class Queue extends \Magento\Core\Model\Template
      */
     protected $_locale;
 
-    /**
-     * Email template factory
-     *
-     * @var \Magento\Email\Model\TemplateFactory
-     */
-    protected $_emailTemplateFactory;
-
     /**
      * Problem factory
      *
@@ -136,9 +124,14 @@ class Queue extends \Magento\Core\Model\Template
     protected $_templateFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
+     * @var \Magento\Newsletter\Model\Queue\TransportBuilder
+     */
+    protected $_transportBuilder;
+
+    /**
+     * @param \Magento\Model\Context $context
      * @param \Magento\View\DesignInterface $design
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\App\Emulation $appEmulation
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Newsletter\Model\Template\Filter $templateFilter
@@ -146,14 +139,14 @@ class Queue extends \Magento\Core\Model\Template
      * @param \Magento\Core\Model\Date $date
      * @param \Magento\Newsletter\Model\TemplateFactory $templateFactory
      * @param \Magento\Newsletter\Model\ProblemFactory $problemFactory
-     * @param \Magento\Email\Model\TemplateFactory $emailTemplateFactory
      * @param \Magento\Newsletter\Model\Resource\Subscriber\CollectionFactory $subscriberCollectionFactory
+     * @param \Magento\Newsletter\Model\Queue\TransportBuilder $transportBuilder
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
+        \Magento\Model\Context $context,
         \Magento\View\DesignInterface $design,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Core\Model\App\Emulation $appEmulation,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Newsletter\Model\Template\Filter $templateFilter,
@@ -161,8 +154,8 @@ class Queue extends \Magento\Core\Model\Template
         \Magento\Core\Model\Date $date,
         \Magento\Newsletter\Model\TemplateFactory $templateFactory,
         \Magento\Newsletter\Model\ProblemFactory $problemFactory,
-        \Magento\Email\Model\TemplateFactory $emailTemplateFactory,
         \Magento\Newsletter\Model\Resource\Subscriber\CollectionFactory $subscriberCollectionFactory,
+        \Magento\Newsletter\Model\Queue\TransportBuilder $transportBuilder,
         array $data = array()
     ) {
         parent::__construct($context, $design, $registry, $appEmulation, $storeManager, $data);
@@ -171,8 +164,8 @@ class Queue extends \Magento\Core\Model\Template
         $this->_locale = $locale;
         $this->_templateFactory = $templateFactory;
         $this->_problemFactory = $problemFactory;
-        $this->_emailTemplateFactory = $emailTemplateFactory;
         $this->_subscribersCollection = $subscriberCollectionFactory->create();
+        $this->_transportBuilder = $transportBuilder;
     }
 
     /**
@@ -183,14 +176,6 @@ class Queue extends \Magento\Core\Model\Template
     protected function _construct()
     {
         parent::_construct();
-        $emailTemplate = $this->_getData('email_template');
-        if ($emailTemplate) {
-            $this->unsetData('email_template');
-            if (!($emailTemplate instanceof \Magento\Email\Model\Template)) {
-                throw new \Exception('Instance of \Magento\Email\Model\Template is expected.');
-            }
-            $this->_emailTemplate = $emailTemplate;
-        }
         $this->_init('Magento\Newsletter\Model\Resource\Queue');
     }
 
@@ -225,11 +210,10 @@ class Queue extends \Magento\Core\Model\Template
     /**
      * Send messages to subscribers for this queue
      *
-     * @param   int     $count
-     * @param   array   $additionalVariables
+     * @param int $count
      * @return $this
      */
-    public function sendPerSubscriber($count = 20, array $additionalVariables = array())
+    public function sendPerSubscriber($count = 20)
     {
         if ($this->getQueueStatus() != self::STATUS_SENDING
            && ($this->getQueueStatus() != self::STATUS_NEVER && $this->getQueueStartAt())
@@ -253,43 +237,37 @@ class Queue extends \Magento\Core\Model\Template
             ->setCurPage(1)
             ->load();
 
-        /** @var \Magento\Email\Model\Template $sender */
-        $sender = $this->_emailTemplate ?: $this->_emailTemplateFactory->create();
-        $sender->setSenderName($this->getNewsletterSenderName())
-            ->setSenderEmail($this->getNewsletterSenderEmail())
-            ->setTemplateType(self::TYPE_HTML)
-            ->setTemplateSubject($this->getNewsletterSubject())
-            ->setTemplateText($this->getNewsletterText())
-            ->setTemplateStyles($this->getNewsletterStyles())
-            ->setTemplateFilter($this->_templateFilter);
+        $this->_transportBuilder->setTemplateData(array(
+            'template_subject' => $this->getNewsletterSubject(),
+            'template_text' => $this->getNewsletterText(),
+            'template_styles' => $this->getNewsletterStyles(),
+            'template_filter' => $this->_templateFilter,
+            'template_type' => self::TYPE_HTML,
+        ));
 
         /** @var \Magento\Newsletter\Model\Subscriber $item */
         foreach ($collection->getItems() as $item) {
-            $email = $item->getSubscriberEmail();
-            $name = $item->getSubscriberFullName();
-
-            $sender->emulateDesign($item->getStoreId());
-            $successSend = $this->_appState->emulateAreaCode(
-                self::DEFAULT_DESIGN_AREA,
-                array($sender, 'send'),
-                array($email, $name, array('subscriber' => $item))
-            );
-            $sender->revertDesign();
-
-            if ($successSend) {
-                $item->received($this);
-            } else {
+            $transport = $this->_transportBuilder
+                ->setTemplateOptions(array(
+                    'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                    'store' => $item->getStoreId()
+                ))
+                ->setTemplateVars(array('subscriber' => $item))
+                ->setFrom(['name' => $this->getNewsletterSenderEmail(), 'email' => $this->getNewsletterSenderName()])
+                ->addTo($item->getSubscriberEmail(), $item->getSubscriberFullName())
+                ->getTransport();
+
+            try {
+                $transport->sendMessage();
+            } catch (\Magento\Mail\Exception $e) {
                 /** @var \Magento\Newsletter\Model\Problem $problem */
                 $problem = $this->_problemFactory->create();
                 $problem->addSubscriberData($item);
                 $problem->addQueueData($this);
-                $e = $sender->getSendingException();
-                if ($e) {
-                    $problem->addErrorData($e);
-                }
+                $problem->addErrorData($e);
                 $problem->save();
-                $item->received($this);
             }
+            $item->received($this);
         }
 
         if (count($collection->getItems()) < $count-1 || count($collection->getItems()) == 0) {
diff --git a/app/code/Magento/Newsletter/Model/Queue/Options/Status.php b/app/code/Magento/Newsletter/Model/Queue/Options/Status.php
index 151dc948915..e086ed561b2 100644
--- a/app/code/Magento/Newsletter/Model/Queue/Options/Status.php
+++ b/app/code/Magento/Newsletter/Model/Queue/Options/Status.php
@@ -34,7 +34,7 @@
 
 namespace Magento\Newsletter\Model\Queue\Options;
 
-class Status implements \Magento\Core\Model\Option\ArrayInterface
+class Status implements \Magento\Option\ArrayInterface
 {
     /**
      * Return statuses option array
diff --git a/app/code/Magento/Newsletter/Model/Queue/TransportBuilder.php b/app/code/Magento/Newsletter/Model/Queue/TransportBuilder.php
new file mode 100644
index 00000000000..be0ac2f1159
--- /dev/null
+++ b/app/code/Magento/Newsletter/Model/Queue/TransportBuilder.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Newsletter\Model\Queue;
+
+class TransportBuilder extends \Magento\Mail\Template\TransportBuilder
+{
+    /**
+     * Template data
+     *
+     * @var array
+     */
+    protected $templateData = array();
+
+    /**
+     * Set template data
+     *
+     * @param array $data
+     * @return $this
+     */
+    public function setTemplateData($data)
+    {
+        $this->templateData = $data;
+        return $this;
+    }
+
+    /**
+     * @inheritdoc
+     */
+    protected function prepareMessage()
+    {
+        $template = $this->getTemplate()->setData($this->templateData);
+
+        $this->message->setMessageType(\Magento\Mail\MessageInterface::TYPE_HTML)
+            ->setBody($template->getProcessedTemplate())
+            ->setSubject($template->getSubject());
+
+        return $this;
+    }
+}
diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php
index 083eb89e181..e35dc1cae0e 100644
--- a/app/code/Magento/Newsletter/Model/Subscriber.php
+++ b/app/code/Magento/Newsletter/Model/Subscriber.php
@@ -31,17 +31,17 @@ namespace Magento\Newsletter\Model;
  * @method \Magento\Newsletter\Model\Resource\Subscriber _getResource()
  * @method \Magento\Newsletter\Model\Resource\Subscriber getResource()
  * @method int getStoreId()
- * @method Subscriber setStoreId(int $value)
+ * @method $this setStoreId(int $value)
  * @method string getChangeStatusAt()
- * @method Subscriber setChangeStatusAt(string $value)
+ * @method $this setChangeStatusAt(string $value)
  * @method int getCustomerId()
- * @method Subscriber setCustomerId(int $value)
+ * @method $this setCustomerId(int $value)
  * @method string getSubscriberEmail()
- * @method Subscriber setSubscriberEmail(string $value)
+ * @method $this setSubscriberEmail(string $value)
  * @method int getSubscriberStatus()
- * @method Subscriber setSubscriberStatus(int $value)
+ * @method $this setSubscriberStatus(int $value)
  * @method string getSubscriberConfirmCode()
- * @method Subscriber setSubscriberConfirmCode(string $value)
+ * @method $this setSubscriberConfirmCode(string $value)
  *
  * @category    Magento
  * @package     Magento_Newsletter
@@ -49,19 +49,19 @@ namespace Magento\Newsletter\Model;
  */
 class Subscriber extends \Magento\Core\Model\AbstractModel
 {
-    const STATUS_SUBSCRIBED     = 1;
-    const STATUS_NOT_ACTIVE     = 2;
-    const STATUS_UNSUBSCRIBED   = 3;
-    const STATUS_UNCONFIRMED    = 4;
+    const STATUS_SUBSCRIBED = 1;
+    const STATUS_NOT_ACTIVE = 2;
+    const STATUS_UNSUBSCRIBED = 3;
+    const STATUS_UNCONFIRMED = 4;
 
-    const XML_PATH_CONFIRM_EMAIL_TEMPLATE       = 'newsletter/subscription/confirm_email_template';
-    const XML_PATH_CONFIRM_EMAIL_IDENTITY       = 'newsletter/subscription/confirm_email_identity';
-    const XML_PATH_SUCCESS_EMAIL_TEMPLATE       = 'newsletter/subscription/success_email_template';
-    const XML_PATH_SUCCESS_EMAIL_IDENTITY       = 'newsletter/subscription/success_email_identity';
-    const XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE   = 'newsletter/subscription/un_email_template';
-    const XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY   = 'newsletter/subscription/un_email_identity';
-    const XML_PATH_CONFIRMATION_FLAG            = 'newsletter/subscription/confirm';
-    const XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG   = 'newsletter/subscription/allow_guest_subscribe';
+    const XML_PATH_CONFIRM_EMAIL_TEMPLATE = 'newsletter/subscription/confirm_email_template';
+    const XML_PATH_CONFIRM_EMAIL_IDENTITY = 'newsletter/subscription/confirm_email_identity';
+    const XML_PATH_SUCCESS_EMAIL_TEMPLATE = 'newsletter/subscription/success_email_template';
+    const XML_PATH_SUCCESS_EMAIL_IDENTITY = 'newsletter/subscription/success_email_identity';
+    const XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE = 'newsletter/subscription/un_email_template';
+    const XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY = 'newsletter/subscription/un_email_identity';
+    const XML_PATH_CONFIRMATION_FLAG = 'newsletter/subscription/confirm';
+    const XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG = 'newsletter/subscription/allow_guest_subscribe';
 
     /**
      * Prefix of model events names
@@ -129,20 +129,18 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
     protected $_customerFactory;
 
     /**
-     * Email template factory
-     *
-     * @var \Magento\Email\Model\TemplateFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_emailTemplateFactory;
+    protected $_transportBuilder;
 
     /**
      * Construct
      *
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Newsletter\Helper\Data $newsletterData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Email\Model\TemplateFactory $emailTemplateFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param \Magento\Customer\Model\CustomerFactory $customerFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\TranslateInterface $translate
@@ -152,11 +150,11 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Newsletter\Helper\Data $newsletterData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Email\Model\TemplateFactory $emailTemplateFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\Customer\Model\CustomerFactory $customerFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\TranslateInterface $translate,
@@ -168,7 +166,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
         parent::__construct($context, $registry, $resource, $resourceCollection, $data);
         $this->_newsletterData = $newsletterData;
         $this->_coreStoreConfig = $coreStoreConfig;
-        $this->_emailTemplateFactory = $emailTemplateFactory;
+        $this->_transportBuilder = $transportBuilder;
         $this->_customerFactory = $customerFactory;
         $this->_storeManager = $storeManager;
         $this->_translate = $translate;
@@ -310,8 +308,8 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
      */
     public function setIsStatusChanged($value)
     {
-        $this->_isStatusChanged = (boolean) $value;
-           return $this;
+        $this->_isStatusChanged = (boolean)$value;
+        return $this;
     }
 
     /**
@@ -331,7 +329,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
      */
     public function isSubscribed()
     {
-        if ($this->getId() && $this->getStatus()==self::STATUS_SUBSCRIBED) {
+        if ($this->getId() && $this->getStatus() == self::STATUS_SUBSCRIBED) {
             return true;
         }
 
@@ -364,7 +362,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
         if (!empty($data) && $customer->getId() && !$this->getCustomerId()) {
             $this->setCustomerId($customer->getId());
             $this->setSubscriberConfirmCode($this->randomSequence());
-            if ($this->getStatus()==self::STATUS_NOT_ACTIVE) {
+            if ($this->getStatus() == self::STATUS_NOT_ACTIVE) {
                 $this->setStatus($customer->getIsSubscribed() ? self::STATUS_SUBSCRIBED : self::STATUS_UNSUBSCRIBED);
             }
             $this->save();
@@ -378,16 +376,16 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
      * @param int $length
      * @return string
      */
-    public function randomSequence($length=32)
+    public function randomSequence($length = 32)
     {
         $id = '';
         $par = array();
-        $char = array_merge(range('a','z'), range(0,9));
-        $charLen = count($char)-1;
-        for ($i=0; $i<$length; $i++){
+        $char = array_merge(range('a', 'z'), range(0, 9));
+        $charLen = count($char) - 1;
+        for ($i = 0; $i < $length; $i++) {
             $disc = mt_rand(0, $charLen);
             $par[$i] = $char[$disc];
-            $id = $id.$char[$disc];
+            $id = $id . $char[$disc];
         }
         return $id;
     }
@@ -407,7 +405,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
             $this->setSubscriberConfirmCode($this->randomSequence());
         }
 
-        $isConfirmNeed   = ($this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1) ? true : false;
+        $isConfirmNeed = ($this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1) ? true : false;
         $isOwnSubscribes = false;
         $ownerId = $this->_customerFactory->create()
             ->setWebsiteId($this->_storeManager->getStore()->getWebsiteId())
@@ -523,7 +521,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
          */
         $confirmation = null;
         if ($customer->isConfirmationRequired() && ($customer->getConfirmation() != $customer->getPassword())) {
-           $confirmation = $customer->getConfirmation();
+            $confirmation = $customer->getConfirmation();
         }
 
         $sendInformationEmail = false;
@@ -583,7 +581,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
      */
     public function confirm($code)
     {
-        if ($this->getCode()==$code) {
+        if ($this->getCode() == $code) {
             $this->setStatus(self::STATUS_SUBSCRIBED)
                 ->setIsStatusChanged(true)
                 ->save();
@@ -601,7 +599,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
      */
     public function received(\Magento\Newsletter\Model\Queue $queue)
     {
-        $this->getResource()->received($this,$queue);
+        $this->getResource()->received($this, $queue);
         return $this;
     }
 
@@ -616,27 +614,33 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
             return $this;
         }
 
-        if(!$this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_TEMPLATE)
-           || !$this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_IDENTITY)
-        )  {
+        if (!$this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_TEMPLATE)
+            || !$this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_IDENTITY)
+        ) {
             return $this;
         }
 
+        $translate = $this->_translate->getTranslateInline();
         $this->_translate->setTranslateInline(false);
 
-        /** @var \Magento\Email\Model\Template $email */
-        $email = $this->_emailTemplateFactory->create();
-
-        $email->sendTransactional(
-            $this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_TEMPLATE),
-            $this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_IDENTITY),
-            $this->getEmail(),
-            $this->getName(),
-            array('subscriber'=>$this)
-        );
-
-        $this->_translate->setTranslateInline(true);
-
+        $this->_transportBuilder
+            ->setTemplateIdentifier(
+                $this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_TEMPLATE)
+            )
+            ->setTemplateOptions(array(
+                'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                'store' => $this->_storeManager->getStore()->getId(),
+            ))
+            ->setTemplateVars(array(
+                'subscriber' => $this,
+                'store' => $this->_storeManager->getStore(),
+            ))
+            ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_IDENTITY))
+            ->addTo($this->getEmail(), $this->getName());
+        $transport = $this->_transportBuilder->getTransport();
+        $transport->sendMessage();
+
+        $this->_translate->setTranslateInline($translate);
         return $this;
     }
 
@@ -651,27 +655,30 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
             return $this;
         }
 
-        if(!$this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_TEMPLATE)
-           || !$this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_IDENTITY)
+        if (!$this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_TEMPLATE)
+            || !$this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_IDENTITY)
         ) {
             return $this;
         }
 
+        $translate = $this->_translate->getTranslateInline();
         $this->_translate->setTranslateInline(false);
 
-        /** @var \Magento\Email\Model\Template $email */
-        $email = $this->_emailTemplateFactory->create();
-
-        $email->sendTransactional(
-            $this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_TEMPLATE),
-            $this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_IDENTITY),
-            $this->getEmail(),
-            $this->getName(),
-            array('subscriber'=>$this)
-        );
-
-        $this->_translate->setTranslateInline(true);
-
+        $this->_transportBuilder
+            ->setTemplateIdentifier(
+                $this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_TEMPLATE)
+            )
+            ->setTemplateOptions(array(
+                'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                'store' => $this->_storeManager->getStore()->getId(),
+            ))
+            ->setTemplateVars(array('subscriber' => $this))
+            ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_IDENTITY))
+            ->addTo($this->getEmail(), $this->getName());
+        $transport = $this->_transportBuilder->getTransport();
+        $transport->sendMessage();
+
+        $this->_translate->setTranslateInline($translate);
         return $this;
     }
 
@@ -685,27 +692,32 @@ class Subscriber extends \Magento\Core\Model\AbstractModel
         if ($this->getImportMode()) {
             return $this;
         }
-        if(!$this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE)
-           || !$this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY)
+        if (!$this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE)
+            || !$this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY)
         ) {
             return $this;
         }
 
+        $translate = $this->_translate->getTranslateInline();
         $this->_translate->setTranslateInline(false);
 
-        /** @var \Magento\Email\Model\Template $email */
-        $email = $this->_emailTemplateFactory->create();
-
-        $email->sendTransactional(
-            $this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE),
-            $this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY),
-            $this->getEmail(),
-            $this->getName(),
-            array('subscriber'=>$this)
-        );
-
-        $this->_translate->setTranslateInline(true);
-
+        $this->_transportBuilder
+                ->setTemplateIdentifier(
+                $this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE)
+            )
+            ->setTemplateOptions(array(
+                'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                'store' => $this->_storeManager->getStore()->getId(),
+            ))
+            ->setTemplateVars(array('subscriber' => $this))
+            ->setFrom(
+                $this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY)
+            )
+            ->addTo($this->getEmail(), $this->getName());
+        $transport = $this->_transportBuilder->getTransport();
+        $transport->sendMessage();
+
+        $this->_translate->setTranslateInline($translate);
         return $this;
     }
 
diff --git a/app/code/Magento/Newsletter/Model/Template.php b/app/code/Magento/Newsletter/Model/Template.php
index 2b710a5c01e..a0d65f78754 100644
--- a/app/code/Magento/Newsletter/Model/Template.php
+++ b/app/code/Magento/Newsletter/Model/Template.php
@@ -113,9 +113,9 @@ class Template extends \Magento\Core\Model\Template
     protected $_filterManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
+     * @param \Magento\Model\Context $context
      * @param \Magento\View\DesignInterface $design
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\App\Emulation $appEmulation
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\RequestInterface $request
@@ -126,9 +126,9 @@ class Template extends \Magento\Core\Model\Template
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
+        \Magento\Model\Context $context,
         \Magento\View\DesignInterface $design,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Core\Model\App\Emulation $appEmulation,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\RequestInterface $request,
diff --git a/app/code/Magento/Ogone/Model/Api.php b/app/code/Magento/Ogone/Model/Api.php
index ccc601ae586..a043d7d48ca 100644
--- a/app/code/Magento/Ogone/Model/Api.php
+++ b/app/code/Magento/Ogone/Model/Api.php
@@ -223,7 +223,7 @@ class Api extends \Magento\Payment\Model\Method\AbstractMethod
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\UrlInterface $urlBuilder
@@ -235,7 +235,7 @@ class Api extends \Magento\Payment\Model\Method\AbstractMethod
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\UrlInterface $urlBuilder,
diff --git a/app/code/Magento/Ogone/Model/Source/PaymentAction.php b/app/code/Magento/Ogone/Model/Source/PaymentAction.php
index 3e1796abba3..8a30bd16d9e 100644
--- a/app/code/Magento/Ogone/Model/Source/PaymentAction.php
+++ b/app/code/Magento/Ogone/Model/Source/PaymentAction.php
@@ -29,7 +29,7 @@
  */
 namespace Magento\Ogone\Model\Source;
 
-class PaymentAction implements \Magento\Core\Model\Option\ArrayInterface
+class PaymentAction implements \Magento\Option\ArrayInterface
 {
     /**
      * Prepare payment action list as optional array
diff --git a/app/code/Magento/Ogone/Model/Source/Pmlist.php b/app/code/Magento/Ogone/Model/Source/Pmlist.php
index a1e8aaf78b7..8188f40b6dc 100644
--- a/app/code/Magento/Ogone/Model/Source/Pmlist.php
+++ b/app/code/Magento/Ogone/Model/Source/Pmlist.php
@@ -29,7 +29,7 @@
  */
 namespace Magento\Ogone\Model\Source;
 
-class Pmlist implements \Magento\Core\Model\Option\ArrayInterface
+class Pmlist implements \Magento\Option\ArrayInterface
 {
     /**
      * Prepare ogone payment block layout as option array
diff --git a/app/code/Magento/Ogone/Model/Source/Template.php b/app/code/Magento/Ogone/Model/Source/Template.php
index 9a9a6e5af23..f2038610669 100644
--- a/app/code/Magento/Ogone/Model/Source/Template.php
+++ b/app/code/Magento/Ogone/Model/Source/Template.php
@@ -29,7 +29,7 @@
  */
 namespace Magento\Ogone\Model\Source;
 
-class Template implements \Magento\Core\Model\Option\ArrayInterface
+class Template implements \Magento\Option\ArrayInterface
 {
     /**
      * Prepare ogone template mode list as option array
diff --git a/app/code/Magento/Ogone/i18n/de_DE.csv b/app/code/Magento/Ogone/i18n/de_DE.csv
index 06e117a8351..c929fbab689 100644
--- a/app/code/Magento/Ogone/i18n/de_DE.csv
+++ b/app/code/Magento/Ogone/i18n/de_DE.csv
@@ -4,7 +4,7 @@
 "Background Color of Ogone Template","Hintergrundfarbe des Ogone Templates"
 "Button Background Color of the Ogone Template","Schaltflächenhintergrundfarbe des Ogone Templates"
 "Button Text Color of the Ogone Template","Schaltflächentextfarbe des Ogone Templates"
-"Can\'t detect Ogone payment action","Ogone Zahlungsvorgang konnte nicht erkannt werden"
+"Can't detect Ogone payment action","Ogone Zahlungsvorgang konnte nicht erkannt werden"
 "Cancelled Ogone","Ogone wurde abgebrochen"
 "Debug","Fehlerbeseitigung"
 "Declined Ogone","Ogone wurde abgelehnt"
@@ -30,7 +30,7 @@
 "Magento","Magento"
 "Ogone","Ogone"
 "Ogone Default Operation","Ogone Standard-Operation"
-"Order can\'t save","Bestellung kann/nicht gespeichert werden"
+"Order can't save","Bestellung kann/nicht gespeichert werden"
 "PSPID","PSPID"
 "Payment Action","Zahlungsaktion"
 "Payment Template","Zahlungs-Template"
diff --git a/app/code/Magento/Ogone/i18n/en_US.csv b/app/code/Magento/Ogone/i18n/en_US.csv
index 7b24fd640c5..8c59ccf0a86 100644
--- a/app/code/Magento/Ogone/i18n/en_US.csv
+++ b/app/code/Magento/Ogone/i18n/en_US.csv
@@ -4,7 +4,7 @@
 "Background Color of Ogone Template","Background Color of Ogone Template"
 "Button Background Color of the Ogone Template","Button Background Color of the Ogone Template"
 "Button Text Color of the Ogone Template","Button Text Color of the Ogone Template"
-"Can\'t detect Ogone payment action","Can\'t detect Ogone payment action"
+"Can't detect Ogone payment action","Can't detect Ogone payment action"
 "Cancelled Ogone","Cancelled Ogone"
 "Debug","Debug"
 "Declined Ogone","Declined Ogone"
@@ -30,7 +30,7 @@
 "Magento","Magento"
 "Ogone","Ogone"
 "Ogone Default Operation","Ogone Default Operation"
-"Order can\'t save","Order can\'t save"
+"Order can't save","Order can't save"
 "PSPID","PSPID"
 "Payment Action","Payment Action"
 "Payment Template","Payment Template"
diff --git a/app/code/Magento/Ogone/i18n/es_ES.csv b/app/code/Magento/Ogone/i18n/es_ES.csv
index 79fdb7b8a63..fdb268e4089 100644
--- a/app/code/Magento/Ogone/i18n/es_ES.csv
+++ b/app/code/Magento/Ogone/i18n/es_ES.csv
@@ -4,7 +4,7 @@
 "Background Color of Ogone Template","Color de fondo del modelo de Ogone"
 "Button Background Color of the Ogone Template","Color de fondo del botón del modelo de Ogone"
 "Button Text Color of the Ogone Template","Color del texto del botón del modelo de Ogone"
-"Can\'t detect Ogone payment action","No se puede detectar la acción de pago de Ogone"
+"Can't detect Ogone payment action","No se puede detectar la acción de pago de Ogone"
 "Cancelled Ogone","Ogone cancelado"
 "Debug","Depurar"
 "Declined Ogone","Ogone rechazado"
@@ -30,7 +30,7 @@
 "Magento","Magento"
 "Ogone","Ogone"
 "Ogone Default Operation","Operación por Defecto de Ogone"
-"Order can\'t save","La solicitud no se puede archivar"
+"Order can't save","La solicitud no se puede archivar"
 "PSPID","PSPID"
 "Payment Action","Acción de Pago"
 "Payment Template","Plantilla de Pago"
diff --git a/app/code/Magento/Ogone/i18n/fr_FR.csv b/app/code/Magento/Ogone/i18n/fr_FR.csv
index 3b851546de4..7826499919b 100644
--- a/app/code/Magento/Ogone/i18n/fr_FR.csv
+++ b/app/code/Magento/Ogone/i18n/fr_FR.csv
@@ -4,7 +4,7 @@
 "Background Color of Ogone Template","Couleur de fond du modèle d'Ogone."
 "Button Background Color of the Ogone Template","Bouton de la couleur de fond du modèle d'Ogone."
 "Button Text Color of the Ogone Template","Bouton de la couleur du texte du modèle d'Ogone."
-"Can\'t detect Ogone payment action","N'arrive pas à détecter le paiement par Ogone."
+"Can't detect Ogone payment action","N'arrive pas à détecter le paiement par Ogone."
 "Cancelled Ogone","Ogone annulé."
 "Debug","Déboguer"
 "Declined Ogone","Ogone refusé."
@@ -30,7 +30,7 @@
 "Magento","Magento"
 "Ogone","Ogone"
 "Ogone Default Operation","Opération par défaut Ogone"
-"Order can\'t save","Impossible de sauvegarder commande"
+"Order can't save","Impossible de sauvegarder commande"
 "PSPID","PSPID"
 "Payment Action","Action de paiement"
 "Payment Template","Modèle paiement"
diff --git a/app/code/Magento/Ogone/i18n/nl_NL.csv b/app/code/Magento/Ogone/i18n/nl_NL.csv
index 30ffa1f38ad..fbd4aac6763 100644
--- a/app/code/Magento/Ogone/i18n/nl_NL.csv
+++ b/app/code/Magento/Ogone/i18n/nl_NL.csv
@@ -4,7 +4,7 @@
 "Background Color of Ogone Template","Achtergrond kleur van het Ogone Sjabloon"
 "Button Background Color of the Ogone Template","Knop Achtergrond Kleur op het Ogone Sjabloon"
 "Button Text Color of the Ogone Template","Knop Tekst Kleur op het Ogone Sjabloon"
-"Can\'t detect Ogone payment action","Kan Ogone Betalingsactie niet vinden"
+"Can't detect Ogone payment action","Kan Ogone Betalingsactie niet vinden"
 "Cancelled Ogone","Ogone Geannuleerd"
 "Debug","Debug"
 "Declined Ogone","Ogone Afgewezen"
@@ -30,7 +30,7 @@
 "Magento","Magento"
 "Ogone","Ogone"
 "Ogone Default Operation","Ogone Standaard Operatie"
-"Order can\'t save","Bestelling kan niet opgeslagen worden"
+"Order can't save","Bestelling kan niet opgeslagen worden"
 "PSPID","PSP ID"
 "Payment Action","Betaling"
 "Payment Template","Betaling Sjabloon"
diff --git a/app/code/Magento/Ogone/i18n/pt_BR.csv b/app/code/Magento/Ogone/i18n/pt_BR.csv
index 85cd9cb6eac..6a7548de1b9 100644
--- a/app/code/Magento/Ogone/i18n/pt_BR.csv
+++ b/app/code/Magento/Ogone/i18n/pt_BR.csv
@@ -4,7 +4,7 @@
 "Background Color of Ogone Template","Cor de Fundo de Modelo Ogone"
 "Button Background Color of the Ogone Template","Botão de Cor de Fundo do Modelo Ogone"
 "Button Text Color of the Ogone Template","Botão de Cor de Texto do Modelo Ogone"
-"Can\'t detect Ogone payment action","Não é possível detetar a ação de pagamento Ogone"
+"Can't detect Ogone payment action","Não é possível detetar a ação de pagamento Ogone"
 "Cancelled Ogone","Ogone Cancelada"
 "Debug","Debug"
 "Declined Ogone","Ogone Recusada"
@@ -30,7 +30,7 @@
 "Magento","Magento"
 "Ogone","Ogone"
 "Ogone Default Operation","Operação Predifinida Ogone"
-"Order can\'t save","Não pode salvar ordem"
+"Order can't save","Não pode salvar ordem"
 "PSPID","PSPID"
 "Payment Action","Ação de Pagamento"
 "Payment Template","Modelo de Pagamento"
diff --git a/app/code/Magento/Ogone/i18n/zh_CN.csv b/app/code/Magento/Ogone/i18n/zh_CN.csv
index cc0261f2580..0ca9dbe20a0 100644
--- a/app/code/Magento/Ogone/i18n/zh_CN.csv
+++ b/app/code/Magento/Ogone/i18n/zh_CN.csv
@@ -4,7 +4,7 @@
 "Background Color of Ogone Template","Ogone 模板的背景颜色"
 "Button Background Color of the Ogone Template","Ogone 模板的按钮背景颜色"
 "Button Text Color of the Ogone Template","Ogone 模板的的按钮文本颜色"
-"Can\'t detect Ogone payment action","无法检测 Ogone 支付操作"
+"Can't detect Ogone payment action","无法检测 Ogone 支付操作"
 "Cancelled Ogone","已取消 Ogone"
 "Debug","调试"
 "Declined Ogone","已拒绝 Ogone"
@@ -30,7 +30,7 @@
 "Magento","Magento"
 "Ogone","Ogone"
 "Ogone Default Operation","Ogone默认操作"
-"Order can\'t save","订单无法保存"
+"Order can't save","订单无法保存"
 "PSPID","PSPID"
 "Payment Action","支付操作"
 "Payment Template","支付模板"
diff --git a/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php b/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php
index 39336b5f30e..a713a176550 100644
--- a/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php
+++ b/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php
@@ -1,5 +1,5 @@
-<?php
-/**
+<?php
+/**
  * Magento
  *
  * NOTICE OF LICENSE
@@ -16,75 +16,75 @@
  *
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-namespace Magento\PageCache\Model\System\Config\Backend;
-
-/**
- * Backend model for processing Varnish settings
- *
- * Class Varnish
- * @package Magento\PageCache\Model\System\Config\Backend
- */
-class Varnish extends \Magento\Core\Model\Config\Value
-{
-    /**
-     * @var array
-     */
-    protected $defaultValues;
-
-    /**
-     * Set default data if empty fields have been left
-     *
-     * @return $this|\Magento\Core\Model\AbstractModel
-     * @throws \Magento\Core\Exception
-     */
-    protected function _beforeSave()
-    {
-        $data = $this->_getDefaultValues();
-        $currentValue = $this->getValue();
-        if(!$currentValue) {
-            $replaceValue = isset($data[$this->getField()]) ? $data[$this->getField()] : false;
-            $this->setValue($replaceValue);
-        }
-        return $this;
-    }
-
-    /**
-     * Get Default Config Values
-     *
-     * @return array
-     */
-    protected function _getDefaultValues()
-    {
-        if (!$this->defaultValues) {
-            $this->defaultValues = $this->_config->getValue('system/full_page_cache/default');
-        }
-        return $this->defaultValues;
-    }
-
-    /**
-     * If fields are empty fill them with default data
-     *
-     * @return $this|\Magento\Core\Model\AbstractModel
-     */
-    protected function _afterLoad()
-    {
-        $data = $this->_getDefaultValues();
-        $currentValue = $this->getValue();
-        if(!$currentValue) {
-            foreach ($data as $field => $value) {
-                if(strstr($this->getPath(), $field)) {
-                    $this->setValue($value);
-                    $this->save();
-                    break;
-                }
-            }
-        }
-        return $this;
-    }
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\PageCache\Model\System\Config\Backend;
+
+/**
+ * Backend model for processing Varnish settings
+ *
+ * Class Varnish
+ * @package Magento\PageCache\Model\System\Config\Backend
+ */
+class Varnish extends \Magento\Core\Model\Config\Value
+{
+    /**
+     * @var array
+     */
+    protected $defaultValues;
+
+    /**
+     * Set default data if empty fields have been left
+     *
+     * @return $this|\Magento\Core\Model\AbstractModel
+     * @throws \Magento\Core\Exception
+     */
+    protected function _beforeSave()
+    {
+        $data = $this->_getDefaultValues();
+        $currentValue = $this->getValue();
+        if(!$currentValue) {
+            $replaceValue = isset($data[$this->getField()]) ? $data[$this->getField()] : false;
+            $this->setValue($replaceValue);
+        }
+        return $this;
+    }
+
+    /**
+     * Get Default Config Values
+     *
+     * @return array
+     */
+    protected function _getDefaultValues()
+    {
+        if (!$this->defaultValues) {
+            $this->defaultValues = $this->_config->getValue('system/full_page_cache/default');
+        }
+        return $this->defaultValues;
+    }
+
+    /**
+     * If fields are empty fill them with default data
+     *
+     * @return $this|\Magento\Core\Model\AbstractModel
+     */
+    protected function _afterLoad()
+    {
+        $data = $this->_getDefaultValues();
+        $currentValue = $this->getValue();
+        if(!$currentValue) {
+            foreach ($data as $field => $value) {
+                if(strstr($this->getPath(), $field)) {
+                    $this->setValue($value);
+                    $this->save();
+                    break;
+                }
+            }
+        }
+        return $this;
+    }
 }
\ No newline at end of file
diff --git a/app/code/Magento/PageCache/Model/System/Config/Source/Application.php b/app/code/Magento/PageCache/Model/System/Config/Source/Application.php
index 5385933adc4..a0b015305af 100644
--- a/app/code/Magento/PageCache/Model/System/Config/Source/Application.php
+++ b/app/code/Magento/PageCache/Model/System/Config/Source/Application.php
@@ -1,5 +1,5 @@
-<?php
-/**
+<?php
+/**
  * Magento
  *
  * NOTICE OF LICENSE
@@ -16,49 +16,49 @@
  *
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category    Magento
- * @package     Magento_PageCache
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Used in creating options for Caching Application config value selection
- */
-namespace Magento\PageCache\Model\System\Config\Source;
-
-/**
- * Class Application
- *
- * @package Magento\PageCache\Model\System\Config\Source
- */
-class Application implements \Magento\Core\Model\Option\ArrayInterface
-{
-    /**
-     * Options getter
-     *
-     * @return array
-     */
-    public function toOptionArray()
-    {
-        return array(
-            array('value' => 0, 'label'=>__('Built-in Application')),
-            array('value' => 1, 'label'=>__('Varnish Caching')),
-        );
-    }
-
-    /**
-     * Get options in "key-value" format
-     *
-     * @return array
-     */
-    public function toArray()
-    {
-        return array(
-            0 => __('Built-in Application'),
-            1 => __('Varnish Caching'),
-        );
-    }
-} 
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_PageCache
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+/**
+ * Used in creating options for Caching Application config value selection
+ */
+namespace Magento\PageCache\Model\System\Config\Source;
+
+/**
+ * Class Application
+ *
+ * @package Magento\PageCache\Model\System\Config\Source
+ */
+class Application implements \Magento\Option\ArrayInterface
+{
+    /**
+     * Options getter
+     *
+     * @return array
+     */
+    public function toOptionArray()
+    {
+        return array(
+            array('value' => 0, 'label'=>__('Built-in Application')),
+            array('value' => 1, 'label'=>__('Varnish Caching')),
+        );
+    }
+
+    /**
+     * Get options in "key-value" format
+     *
+     * @return array
+     */
+    public function toArray()
+    {
+        return array(
+            0 => __('Built-in Application'),
+            1 => __('Varnish Caching'),
+        );
+    }
+}
diff --git a/app/code/Magento/PageCache/view/adminhtml/page_cache_validation.phtml b/app/code/Magento/PageCache/view/adminhtml/page_cache_validation.phtml
index 0c552a8d7cb..60810e648dc 100644
--- a/app/code/Magento/PageCache/view/adminhtml/page_cache_validation.phtml
+++ b/app/code/Magento/PageCache/view/adminhtml/page_cache_validation.phtml
@@ -1,5 +1,5 @@
-<?php
-/**
+<?php
+/**
  * Magento
  *
  * NOTICE OF LICENSE
@@ -16,33 +16,33 @@
  *
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-
-<?php /** @var \Magento\PageCache\Block\System\Config\Form\Field\Export $this */
-?>
-<script type="text/javascript">
-    //<![CDATA[
-    (function ($) {
-        var fieldset = $('#system_full_page_cache_varnish'),
-            fields = fieldset.find(':input:not(button)');
-        if (fieldset.is(':visible') == false) {
-            fieldset.show();
-            fields.show();
-        }
-        fields.each(function (e) {
-            $(this).data('previous-value', $(this).val());
-        });
-        fieldset.on('change', function (e) {
-            var invalidFields = fields.filter(function () {
-                return ($(this).val().length == 0 || ($(this).val() != $(this).data('previous-value')));
-            });
-            $('#system_full_page_cache_varnish_export_button').prop('disabled', (invalidFields.length > 0));
-        });
-    })(jQuery);
-    //]]>
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+
+<?php /** @var \Magento\PageCache\Block\System\Config\Form\Field\Export $this */
+?>
+<script type="text/javascript">
+    //<![CDATA[
+    (function ($) {
+        var fieldset = $('#system_full_page_cache_varnish'),
+            fields = fieldset.find(':input:not(button)');
+        if (fieldset.is(':visible') == false) {
+            fieldset.show();
+            fields.show();
+        }
+        fields.each(function (e) {
+            $(this).data('previous-value', $(this).val());
+        });
+        fieldset.on('change', function (e) {
+            var invalidFields = fields.filter(function () {
+                return ($(this).val().length == 0 || ($(this).val() != $(this).data('previous-value')));
+            });
+            $('#system_full_page_cache_varnish_export_button').prop('disabled', (invalidFields.length > 0));
+        });
+    })(jQuery);
+    //]]>
 </script>
\ No newline at end of file
diff --git a/app/code/Magento/Payment/Helper/Data.php b/app/code/Magento/Payment/Helper/Data.php
index 752f6451b1a..a261b151667 100644
--- a/app/code/Magento/Payment/Helper/Data.php
+++ b/app/code/Magento/Payment/Helper/Data.php
@@ -237,6 +237,24 @@ class Data extends \Magento\App\Helper\AbstractHelper
         return $paymentBlockHtml;
     }
 
+    /**
+     * Retrieve available billing agreement methods
+     *
+     * @param mixed $store
+     * @param \Magento\Sales\Model\Quote $quote
+     * @return array
+     */
+    public function getBillingAgreementMethods($store = null, $quote = null)
+    {
+        $result = array();
+        foreach ($this->getStoreMethods($store, $quote) as $method) {
+            if ($method->canManageBillingAgreements()) {
+                $result[] = $method;
+            }
+        }
+        return $result;
+    }
+
     /**
      * Get payment methods that implement recurring profilez management
      *
diff --git a/app/code/Magento/Payment/Model/Config/Source/Allmethods.php b/app/code/Magento/Payment/Model/Config/Source/Allmethods.php
index 2f2e64f815e..501bd62b123 100644
--- a/app/code/Magento/Payment/Model/Config/Source/Allmethods.php
+++ b/app/code/Magento/Payment/Model/Config/Source/Allmethods.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Payment\Model\Config\Source;
 
-class Allmethods implements \Magento\Core\Model\Option\ArrayInterface
+class Allmethods implements \Magento\Option\ArrayInterface
 {
     /**
      * Payment data
diff --git a/app/code/Magento/Payment/Model/Config/Source/Allspecificcountries.php b/app/code/Magento/Payment/Model/Config/Source/Allspecificcountries.php
index 5cdb1435dd9..e431af27928 100644
--- a/app/code/Magento/Payment/Model/Config/Source/Allspecificcountries.php
+++ b/app/code/Magento/Payment/Model/Config/Source/Allspecificcountries.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Payment\Model\Config\Source;
 
-class Allspecificcountries implements \Magento\Core\Model\Option\ArrayInterface
+class Allspecificcountries implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Payment/Model/Config/Source/Cctype.php b/app/code/Magento/Payment/Model/Config/Source/Cctype.php
index b40c33ab58b..e39845fc3da 100644
--- a/app/code/Magento/Payment/Model/Config/Source/Cctype.php
+++ b/app/code/Magento/Payment/Model/Config/Source/Cctype.php
@@ -23,7 +23,7 @@
  */
 namespace Magento\Payment\Model\Config\Source;
 
-class Cctype implements \Magento\Core\Model\Option\ArrayInterface
+class Cctype implements \Magento\Option\ArrayInterface
 {
     /**
      * Payment config model
diff --git a/app/code/Magento/Payment/Model/Info.php b/app/code/Magento/Payment/Model/Info.php
index 248b7f5122c..e32334b5087 100644
--- a/app/code/Magento/Payment/Model/Info.php
+++ b/app/code/Magento/Payment/Model/Info.php
@@ -50,8 +50,8 @@ class Info extends \Magento\Core\Model\AbstractModel
     protected $_encryptor;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Encryption\EncryptorInterface $encryptor
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -59,8 +59,8 @@ class Info extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Encryption\EncryptorInterface $encryptor,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Payment/Model/Method/AbstractMethod.php b/app/code/Magento/Payment/Model/Method/AbstractMethod.php
index b62232252eb..73b16b98802 100644
--- a/app/code/Magento/Payment/Model/Method/AbstractMethod.php
+++ b/app/code/Magento/Payment/Model/Method/AbstractMethod.php
@@ -50,8 +50,7 @@ abstract class AbstractMethod extends \Magento\Object
     const CHECK_USE_CHECKOUT          = 4;
     const CHECK_USE_INTERNAL          = 16;
     const CHECK_ORDER_TOTAL_MIN_MAX   = 32;
-    const CHECK_RECURRING_PROFILES    = 64;
-    const CHECK_ZERO_TOTAL            = 128;
+    const CHECK_ZERO_TOTAL            = 64;
 
     /**
      * @var string
@@ -204,7 +203,7 @@ abstract class AbstractMethod extends \Magento\Object
     /**
      * Log adapter factory
      *
-     * @var \Magento\Core\Model\Log\AdapterFactory
+     * @var \Magento\Logger\AdapterFactory
      */
     protected $_logAdapterFactory;
 
@@ -214,14 +213,14 @@ abstract class AbstractMethod extends \Magento\Object
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         array $data = array()
     ) {
         parent::__construct($data);
@@ -407,17 +406,6 @@ abstract class AbstractMethod extends \Magento\Object
         return true;
     }
 
-    /**
-     * Whether can manage recurring profiles
-     *
-     * @return bool
-     */
-    public function canManageRecurringProfiles()
-    {
-        return $this->_canManageRecurringProfiles
-               && ($this instanceof \Magento\Payment\Model\Recurring\Profile\MethodInterface);
-    }
-
     /**
      * Retrieve payment method code
      *
@@ -743,9 +731,6 @@ abstract class AbstractMethod extends \Magento\Object
             'quote'           => $quote,
         ));
 
-        if ($checkResult->isAvailable && $quote) {
-            $checkResult->isAvailable = $this->isApplicableToQuote($quote, self::CHECK_RECURRING_PROFILES);
-        }
         return $checkResult->isAvailable;
     }
 
@@ -787,16 +772,10 @@ abstract class AbstractMethod extends \Magento\Object
                 return false;
             }
         }
-        if ($checksBitMask & self::CHECK_RECURRING_PROFILES) {
-            if (!$this->canManageRecurringProfiles() && $quote->hasRecurringItems()) {
-                return false;
-            }
-        }
+
         if ($checksBitMask & self::CHECK_ZERO_TOTAL) {
             $total = $quote->getBaseSubtotal() + $quote->getShippingAddress()->getBaseShippingAmount();
-            if ($total < 0.0001 && $this->getCode() != 'free'
-                && !($this->canManageRecurringProfiles() && $quote->hasRecurringItems())
-            ) {
+            if ($total < 0.0001 && $this->getCode() != 'free') {
                 return false;
             }
         }
diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php
index a5879aab1a2..89e220d11c9 100644
--- a/app/code/Magento/Payment/Model/Method/Cc.php
+++ b/app/code/Magento/Payment/Model/Method/Cc.php
@@ -72,7 +72,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Logger $logger
      * @param \Magento\Module\ModuleListInterface $moduleList
      * @param \Magento\Core\Model\LocaleInterface $locale
@@ -83,7 +83,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Logger $logger,
         \Magento\Module\ModuleListInterface $moduleList,
         \Magento\Core\Model\LocaleInterface $locale,
diff --git a/app/code/Magento/Payment/Model/Method/Free.php b/app/code/Magento/Payment/Model/Method/Free.php
index 5d7d192ec94..c1c69af2a9b 100644
--- a/app/code/Magento/Payment/Model/Method/Free.php
+++ b/app/code/Magento/Payment/Model/Method/Free.php
@@ -64,7 +64,7 @@ class Free extends \Magento\Payment\Model\Method\AbstractMethod
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param array $data
      */
@@ -72,7 +72,7 @@ class Free extends \Magento\Payment\Model\Method\AbstractMethod
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Payment/Model/Source/Cctype.php b/app/code/Magento/Payment/Model/Source/Cctype.php
index 1ef747d47d0..98761ffa6e0 100644
--- a/app/code/Magento/Payment/Model/Source/Cctype.php
+++ b/app/code/Magento/Payment/Model/Source/Cctype.php
@@ -26,7 +26,7 @@ namespace Magento\Payment\Model\Source;
 /**
  * Payment CC Types Source Model
  */
-class Cctype implements \Magento\Core\Model\Option\ArrayInterface
+class Cctype implements \Magento\Option\ArrayInterface
 {
     /**
      * Allowed CC types
diff --git a/app/code/Magento/Payment/Model/Source/Invoice.php b/app/code/Magento/Payment/Model/Source/Invoice.php
index c0b8856366a..510067e752e 100644
--- a/app/code/Magento/Payment/Model/Source/Invoice.php
+++ b/app/code/Magento/Payment/Model/Source/Invoice.php
@@ -30,7 +30,7 @@ namespace Magento\Payment\Model\Source;
  *
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-class Invoice implements \Magento\Core\Model\Option\ArrayInterface
+class Invoice implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Payment/etc/payment.xsd b/app/code/Magento/Payment/etc/payment.xsd
index e509452511a..d42eded6b56 100644
--- a/app/code/Magento/Payment/etc/payment.xsd
+++ b/app/code/Magento/Payment/etc/payment.xsd
@@ -108,6 +108,7 @@
         <xs:all>
             <xs:element name="allow_multiple_address" type="xs:integer" minOccurs="0" />
             <xs:element name="allow_multiple_with_3dsecure" type="xs:integer" minOccurs="0" />
+            <xs:element name="support_recurring_payment" type="xs:integer" minOccurs="0" />
         </xs:all>
         <xs:attribute name="name" type="xs:ID" use="required" />
     </xs:complexType>
diff --git a/app/code/Magento/Payment/etc/payment_file.xsd b/app/code/Magento/Payment/etc/payment_file.xsd
index 16387cb919f..96ef0ab2645 100644
--- a/app/code/Magento/Payment/etc/payment_file.xsd
+++ b/app/code/Magento/Payment/etc/payment_file.xsd
@@ -108,6 +108,7 @@
         <xs:all>
             <xs:element name="allow_multiple_address" type="xs:integer" minOccurs="0" />
             <xs:element name="allow_multiple_with_3dsecure" type="xs:integer" minOccurs="0" />
+            <xs:element name="support_recurring_payment" type="xs:integer" minOccurs="0" />
         </xs:all>
         <xs:attribute name="name" type="xs:ID" use="required" />
     </xs:complexType>
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement.php b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement.php
index dc3bd621092..50d80e8e1cf 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement.php
@@ -21,17 +21,17 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\Billing;
 
 /**
  * Adminhtml billing agreement grid container
  */
-namespace Magento\Paypal\Block\Adminhtml\Billing;
-
 class Agreement extends \Magento\Backend\Block\Widget\Grid\Container
 {
     /**
      * Initialize billing agreements grid container
      *
+     * @return void
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/Grid.php b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/Grid.php
index b7f3db356c1..a308753a1b8 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/Grid.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/Grid.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\Billing\Agreement;
 
 /**
  * Adminhtml billing agreements grid
  */
-namespace Magento\Paypal\Block\Adminhtml\Billing\Agreement;
-
 class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
 {
     /**
@@ -68,6 +67,8 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
 
     /**
      * Set grid params
+     *
+     * @return void
      */
     protected function _construct()
     {
@@ -103,7 +104,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Prepare collection for grid
      *
-     * @return \Magento\Backend\Block\Widget\Grid\Extended
+     * @return $this
      */
     protected function _prepareCollection()
     {
@@ -117,7 +118,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Add columns to grid
      *
-     * @return \Magento\Backend\Block\Widget\Grid\Extended
+     * @return $this
      */
     protected function _prepareColumns()
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View.php b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View.php
index ce8b172558d..ba5eef96bcc 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View.php
@@ -21,29 +21,28 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\Billing\Agreement;
 
 /**
  * Adminhtml billing agreement view
  */
-namespace Magento\Paypal\Block\Adminhtml\Billing\Agreement;
-
 class View extends \Magento\Backend\Block\Widget\Form\Container
 {
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
@@ -53,6 +52,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Initialize view container
      *
+     * @return void
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Form.php b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Form.php
index 46754f0d85b..1fa557a2712 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Form.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Form.php
@@ -21,13 +21,15 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\Billing\Agreement\View;
 
 /**
  * Adminhtml billing agreement view plane
  */
-namespace Magento\Paypal\Block\Adminhtml\Billing\Agreement\View;
-
 class Form extends \Magento\Backend\Block\Template
 {
+    /**
+     * @var string
+     */
     protected $_template = 'billing/agreement/view/form.phtml';
 }
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php
index c1e4c827313..a9c0b1cc8f0 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php
@@ -21,36 +21,42 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\Billing\Agreement\View\Tab;
 
 /**
  * Adminhtml billing agreement info tab
  */
-namespace Magento\Paypal\Block\Adminhtml\Billing\Agreement\View\Tab;
-
 class Info extends \Magento\Backend\Block\Template
     implements \Magento\Backend\Block\Widget\Tab\TabInterface
 {
+    /**
+     * @var string
+     */
     protected $_template = 'billing/agreement/view/tab/info.phtml';
 
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
-    /** @var \Magento\Customer\Service\V1\CustomerServiceInterface */
+    /**
+     * Customer service
+     *
+     * @var \Magento\Customer\Service\V1\CustomerServiceInterface
+     */
     protected $_customerService;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Customer\Service\V1\CustomerServiceInterface $customerService
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Customer\Service\V1\CustomerServiceInterface $customerService,
         array $data = array()
     ) {
@@ -60,9 +66,7 @@ class Info extends \Magento\Backend\Block\Template
     }
 
     /**
-     * Return Tab label
-     *
-     * @return string
+     * {@inheritdoc}
      */
     public function getTabLabel()
     {
@@ -70,9 +74,7 @@ class Info extends \Magento\Backend\Block\Template
     }
 
     /**
-     * Return Tab title
-     *
-     * @return string
+     * {@inheritdoc}
      */
     public function getTabTitle()
     {
@@ -80,9 +82,7 @@ class Info extends \Magento\Backend\Block\Template
     }
 
     /**
-     * Can show tab in tabs
-     *
-     * @return boolean
+     * {@inheritdoc}
      */
     public function canShowTab()
     {
@@ -90,9 +90,7 @@ class Info extends \Magento\Backend\Block\Template
     }
 
     /**
-     * Tab is hidden
-     *
-     * @return boolean
+     * {@inheritdoc}
      */
     public function isHidden()
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/Orders.php b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/Orders.php
index 7911cfeff52..c34e47fbcd5 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/Orders.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/Orders.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\Billing\Agreement\View\Tab;
 
 /**
  * Adminhtml billing agreement related orders tab
  */
-namespace Magento\Paypal\Block\Adminhtml\Billing\Agreement\View\Tab;
-
 class Orders extends \Magento\View\Element\Text\ListText
     implements \Magento\Backend\Block\Widget\Tab\TabInterface
 {
@@ -34,6 +33,7 @@ class Orders extends \Magento\View\Element\Text\ListText
     /**
      * Initialize grid params
      *
+     * @return void
      */
     protected function _construct()
     {
@@ -42,9 +42,7 @@ class Orders extends \Magento\View\Element\Text\ListText
     }
 
     /**
-     * Return Tab label
-     *
-     * @return string
+     * {@inheritdoc}
      */
     public function getTabLabel()
     {
@@ -52,9 +50,7 @@ class Orders extends \Magento\View\Element\Text\ListText
     }
 
     /**
-     * Return Tab title
-     *
-     * @return string
+     * {@inheritdoc}
      */
     public function getTabTitle()
     {
@@ -62,9 +58,7 @@ class Orders extends \Magento\View\Element\Text\ListText
     }
 
     /**
-     * Can show tab in tabs
-     *
-     * @return boolean
+     * {@inheritdoc}
      */
     public function canShowTab()
     {
@@ -72,9 +66,7 @@ class Orders extends \Magento\View\Element\Text\ListText
     }
 
     /**
-     * Tab is hidden
-     *
-     * @return boolean
+     * {@inheritdoc}
      */
     public function isHidden()
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tabs.php b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tabs.php
index 15be5c97f67..e9813c9f816 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tabs.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tabs.php
@@ -32,6 +32,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
     /**
      * Initialize tab
      *
+     * @return void
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Customer/Edit/Tab/Agreement.php b/app/code/Magento/Paypal/Block/Adminhtml/Customer/Edit/Tab/Agreement.php
index cd7fa4af34a..340a5346317 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/Customer/Edit/Tab/Agreement.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/Customer/Edit/Tab/Agreement.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\Customer\Edit\Tab;
 
 /**
  * Adminhtml customer billing agreement tab
  */
-namespace Magento\Paypal\Block\Adminhtml\Customer\Edit\Tab;
-
 class Agreement
     extends \Magento\Paypal\Block\Adminhtml\Billing\Agreement\Grid
     implements \Magento\Backend\Block\Widget\Tab\TabInterface
@@ -41,7 +40,7 @@ class Agreement
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -51,7 +50,7 @@ class Agreement
      * @param \Magento\Paypal\Helper\Data $helper
      * @param \Magento\Paypal\Model\Resource\Billing\Agreement\CollectionFactory $agreementFactory
      * @param \Magento\Paypal\Model\Billing\Agreement $agreementModel
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -60,7 +59,7 @@ class Agreement
         \Magento\Paypal\Helper\Data $helper,
         \Magento\Paypal\Model\Resource\Billing\Agreement\CollectionFactory $agreementFactory,
         \Magento\Paypal\Model\Billing\Agreement $agreementModel,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
@@ -77,6 +76,7 @@ class Agreement
     /**
      * Disable filters and paging
      *
+     * @return void
      */
     protected function _construct()
     {
@@ -85,9 +85,7 @@ class Agreement
     }
 
     /**
-     * Return Tab label
-     *
-     * @return string
+     * {@inheritdoc}
      */
     public function getTabLabel()
     {
@@ -95,9 +93,7 @@ class Agreement
     }
 
     /**
-     * Return Tab title
-     *
-     * @return string
+     * {@inheritdoc}
      */
     public function getTabTitle()
     {
@@ -105,9 +101,7 @@ class Agreement
     }
 
     /**
-     * Can show tab in tabs
-     *
-     * @return boolean
+     * {@inheritdoc}
      */
     public function canShowTab()
     {
@@ -116,15 +110,18 @@ class Agreement
     }
 
     /**
-     * Tab is hidden
-     *
-     * @return boolean
+     * {@inheritdoc}
      */
     public function isHidden()
     {
         return false;
     }
 
+    /**
+     * Get grid url
+     *
+     * @return string
+     */
     public function getGridUrl()
     {
         return $this->getUrl('paypal/billing_agreement/customerGrid', array('_current' => true));
@@ -143,7 +140,7 @@ class Agreement
     /**
      * Prepare collection for grid
      *
-     * @return \Magento\Paypal\Block\Adminhtml\Customer\Edit\Tab\Agreement
+     * @return $this
      */
     protected function _prepareCollection()
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details.php b/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details.php
index 6ee56c7c4a5..afe7594ef5a 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\Settlement;
 
 /**
  * Settlement reports transaction details
@@ -31,13 +32,13 @@
  * @package     Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Block\Adminhtml\Settlement;
-
 class Details extends \Magento\Backend\Block\Widget\Form\Container
 {
     /**
      * Block construction
      * Initialize titles, buttons
+     *
+     * @return void
      */
     protected function _construct()
     {
@@ -51,7 +52,8 @@ class Details extends \Magento\Backend\Block\Widget\Form\Container
 
     /**
      * Initialize form
-     * @return \Magento\Paypal\Block\Adminhtml\Settlement\Details
+     *
+     * @return $this
      */
     protected function _prepareLayout()
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details/Form.php b/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details/Form.php
index 96a1c88accd..7f350911fa9 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details/Form.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details/Form.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\Settlement\Details;
 
 /**
  * Settlement reports transaction details
  */
-namespace Magento\Paypal\Block\Adminhtml\Settlement\Details;
-
 class Form extends \Magento\Backend\Block\Widget\Form\Generic
 {
     /**
@@ -38,14 +37,14 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Paypal\Model\Report\Settlement $settlement
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Paypal\Model\Report\Settlement $settlement,
         array $data = array()
@@ -57,7 +56,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
     /**
      * Prepare read-only data and group it by fieldsets
      *
-     * @return \Magento\Paypal\Block\Adminhtml\Settlement\Details\Form
+     * @return $this
      */
     protected function _prepareForm()
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Report.php b/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Report.php
index 542168d144d..19903cb705b 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Report.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Report.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\Settlement;
 
 /**
  * Adminhtml paypal settlement reports grid block
@@ -31,12 +32,12 @@
  * @package     Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Block\Adminhtml\Settlement;
-
 class Report extends \Magento\Backend\Block\Widget\Grid\Container
 {
     /**
      * Prepare grid container, add additional buttons
+     *
+     * @return void
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/ApiWizard.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/ApiWizard.php
index bceab1726f7..b2b3735a09e 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/ApiWizard.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/ApiWizard.php
@@ -23,16 +23,17 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\System\Config;
 
 /**
  * Custom renderer for PayPal API credentials wizard popup
  */
-namespace Magento\Paypal\Block\Adminhtml\System\Config;
-
 class ApiWizard extends \Magento\Backend\Block\System\Config\Form\Field
 {
     /**
      * Set template to itself
+     *
+     * @return $this
      */
     protected function _prepareLayout()
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php
index e0b4eb1dcda..d7a0c3b4a5d 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php
@@ -23,12 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\System\Config\Fieldset;
+
+use Magento\Data\Form\Element\AbstractElement;
 
 /**
  * Fieldset renderer which expanded by default
  */
-namespace Magento\Paypal\Block\Adminhtml\System\Config\Fieldset;
-
 class Expanded
     extends \Magento\Backend\Block\System\Config\Form\Fieldset
 {
@@ -50,8 +51,8 @@ class Expanded
     /**
      * Return collapse state
      *
-     * @param \Magento\Data\Form\Element\AbstractElement $element
-     * @return bool
+     * @param AbstractElement $element
+     * @return string|true
      */
     protected function _isCollapseState($element)
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php
index 028de2201df..1b2efae6b2b 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php
@@ -23,18 +23,19 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Paypal\Block\Adminhtml\System\Config\Fieldset;
 
 /**
  * Renderer for PayPal banner in System Configuration
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Block\Adminhtml\System\Config\Fieldset;
-
 class Hint
     extends \Magento\Backend\Block\Template
     implements \Magento\Data\Form\Element\Renderer\RendererInterface
 {
+    /**
+     * @var string
+     */
     protected $_template = 'Magento_Paypal::system/config/fieldset/hint.phtml';
 
     /**
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php
index b7aaecb80fd..e113b721101 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Adminhtml\System\Config\Fieldset;
 
 /**
  * Fieldset renderer for PayPal solution
  */
-namespace Magento\Paypal\Block\Adminhtml\System\Config\Fieldset;
-
 class Payment
     extends \Magento\Backend\Block\System\Config\Form\Fieldset
 {
@@ -147,7 +146,7 @@ class Payment
      * Get collapsed state on-load
      *
      * @param \Magento\Data\Form\Element\AbstractElement $element
-     * @return bool
+     * @return false
      */
     protected function _isCollapseState($element)
     {
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Store.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Store.php
index 2e94c2a9123..a93bc8e3b14 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Store.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Store.php
@@ -23,14 +23,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Paypal\Block\Adminhtml\System\Config\Fieldset;
 
 /**
  * Renderer for service JavaScript code that disables corresponding paypal methods on page load
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Block\Adminhtml\System\Config\Fieldset;
-
 class Store
     extends \Magento\Backend\Block\Template
     implements \Magento\Data\Form\Element\Renderer\RendererInterface
diff --git a/app/code/Magento/Paypal/Block/Billing/Agreement/View.php b/app/code/Magento/Paypal/Block/Billing/Agreement/View.php
index f20d35f3311..411963879ea 100644
--- a/app/code/Magento/Paypal/Block/Billing/Agreement/View.php
+++ b/app/code/Magento/Paypal/Block/Billing/Agreement/View.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Billing\Agreement;
 
 /**
  * Customer account billing agreement view block
  */
-namespace Magento\Paypal\Block\Billing\Agreement;
-
 class View extends \Magento\View\Element\Template
 {
     /**
@@ -53,7 +52,7 @@ class View extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -84,7 +83,7 @@ class View extends \Magento\View\Element\Template
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Model\Resource\Order\CollectionFactory $orderCollectionFactory
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Sales\Model\Order\Config $orderConfig
@@ -94,7 +93,7 @@ class View extends \Magento\View\Element\Template
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Sales\Model\Resource\Order\CollectionFactory $orderCollectionFactory,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Sales\Model\Order\Config $orderConfig,
@@ -176,7 +175,7 @@ class View extends \Magento\View\Element\Template
     /**
      * Set pager
      *
-     * @return \Magento\View\Element\AbstractBlock
+     * @return $this
      */
     protected function _prepareLayout()
     {
diff --git a/app/code/Magento/Paypal/Block/Billing/Agreements.php b/app/code/Magento/Paypal/Block/Billing/Agreements.php
index 6499e65e1db..0219986c4e5 100644
--- a/app/code/Magento/Paypal/Block/Billing/Agreements.php
+++ b/app/code/Magento/Paypal/Block/Billing/Agreements.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Billing;
 
 /**
  * Customer account billing agreements block
  */
-namespace Magento\Paypal\Block\Billing;
-
 class Agreements extends \Magento\View\Element\Template
 {
     /**
@@ -82,7 +81,7 @@ class Agreements extends \Magento\View\Element\Template
     /**
      * Set Billing Agreement instance
      *
-     * @return \Magento\View\Element\AbstractBlock
+     * @return $this
      */
     protected function _prepareLayout()
     {
@@ -115,7 +114,7 @@ class Agreements extends \Magento\View\Element\Template
      *
      * @param \Magento\Object|\Magento\Paypal\Model\Billing\Agreement $item
      * @param string $key
-     * @return mixed
+     * @return string
      */
     public function getItemValue(\Magento\Paypal\Model\Billing\Agreement $item, $key)
     {
diff --git a/app/code/Magento/Paypal/Block/Checkout/Onepage/Success/BillingAgreement.php b/app/code/Magento/Paypal/Block/Checkout/Onepage/Success/BillingAgreement.php
index 0ddb101ff76..8d56313eed8 100644
--- a/app/code/Magento/Paypal/Block/Checkout/Onepage/Success/BillingAgreement.php
+++ b/app/code/Magento/Paypal/Block/Checkout/Onepage/Success/BillingAgreement.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Checkout\Onepage\Success;
 
 /**
  * Billing agreement information on Order success page
  */
-namespace Magento\Paypal\Block\Checkout\Onepage\Success;
-
 class BillingAgreement extends \Magento\View\Element\Template
 {
     /**
diff --git a/app/code/Magento/Paypal/Block/Express/Form.php b/app/code/Magento/Paypal/Block/Express/Form.php
index b3c22444243..1ae0f7cf99b 100644
--- a/app/code/Magento/Paypal/Block/Express/Form.php
+++ b/app/code/Magento/Paypal/Block/Express/Form.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Express;
 
 /**
  * PayPal Standard payment "form"
  */
-namespace Magento\Paypal\Block\Express;
-
 class Form extends \Magento\Paypal\Block\Standard\Form
 {
     /**
@@ -72,6 +71,8 @@ class Form extends \Magento\Paypal\Block\Standard\Form
 
     /**
      * Set template and redirect message
+     *
+     * @return null
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Paypal/Block/Express/Review.php b/app/code/Magento/Paypal/Block/Express/Review.php
index 236a8ab7f13..9e35187d135 100644
--- a/app/code/Magento/Paypal/Block/Express/Review.php
+++ b/app/code/Magento/Paypal/Block/Express/Review.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Express;
 
 /**
  * Paypal Express Onepage checkout block
@@ -31,8 +32,6 @@
  * @package    Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Block\Express;
-
 class Review extends \Magento\View\Element\Template
 {
     /**
@@ -77,7 +76,7 @@ class Review extends \Magento\View\Element\Template
      * Quote object setter
      *
      * @param \Magento\Sales\Model\Quote $quote
-     * @return \Magento\Paypal\Block\Express\Review
+     * @return $this
      */
     public function setQuote(\Magento\Sales\Model\Quote $quote)
     {
@@ -98,7 +97,7 @@ class Review extends \Magento\View\Element\Template
     /**
      * Return quote shipping address
      *
-     * @return \Magento\Sales\Model\Quote\Address
+     * @return false|\Magento\Sales\Model\Quote\Address
      */
     public function getShippingAddress()
     {
@@ -188,6 +187,9 @@ class Review extends \Magento\View\Element\Template
 
     /**
      * Set controller path
+     *
+     * @param string $prefix
+     * @return void
      */
     public function setControllerPath($prefix)
     {
@@ -199,8 +201,7 @@ class Review extends \Magento\View\Element\Template
      *
      * @param float $price
      * @param bool $isInclTax
-     *
-     * @return bool
+     * @return string
      */
     protected function _getShippingPrice($price, $isInclTax)
     {
@@ -227,7 +228,7 @@ class Review extends \Magento\View\Element\Template
     /**
      * Retrieve payment method and assign additional template values
      *
-     * @return \Magento\Paypal\Block\Express\Review
+     * @return $this
      */
     protected function _beforeToHtml()
     {
diff --git a/app/code/Magento/Paypal/Block/Express/Review/Details.php b/app/code/Magento/Paypal/Block/Express/Review/Details.php
index b5d6c84e9d6..b398c75f722 100644
--- a/app/code/Magento/Paypal/Block/Express/Review/Details.php
+++ b/app/code/Magento/Paypal/Block/Express/Review/Details.php
@@ -23,6 +23,9 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Express\Review;
+
+use Magento\Sales\Model\Order\Address;
 
 /**
  * Paypal Express Onepage checkout block
@@ -31,16 +34,17 @@
  * @package    Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Block\Express\Review;
-
 class Details extends \Magento\Checkout\Block\Cart\Totals
 {
+    /**
+     * @var Address
+     */
     protected $_address;
 
     /**
      * Return review shipping address
      *
-     * @return \Magento\Sales\Model\Order\Address
+     * @return Address
      */
     public function getAddress()
     {
diff --git a/app/code/Magento/Paypal/Block/Express/Shortcut.php b/app/code/Magento/Paypal/Block/Express/Shortcut.php
index 57070b764b6..b914787ad4f 100644
--- a/app/code/Magento/Paypal/Block/Express/Shortcut.php
+++ b/app/code/Magento/Paypal/Block/Express/Shortcut.php
@@ -23,14 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
-/**
- * Paypal express checkout shortcut link
- */
 namespace Magento\Paypal\Block\Express;
 
 use Magento\Catalog\Block as CatalogBlock;
 
+/**
+ * Paypal express checkout shortcut link
+ */
 class Shortcut extends \Magento\View\Element\Template implements CatalogBlock\ShortcutInterface
 {
     /**
@@ -64,7 +63,7 @@ class Shortcut extends \Magento\View\Element\Template implements CatalogBlock\Sh
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
@@ -116,20 +115,20 @@ class Shortcut extends \Magento\View\Element\Template implements CatalogBlock\Sh
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Paypal\Helper\Data $paypalData
      * @param \Magento\Payment\Helper\Data $paymentData
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Paypal\Model\ConfigFactory $paypalConfigFactory
-     * @param \Magento\Checkout\Model\Session $checkoutSession
      * @param \Magento\Paypal\Model\Express\Checkout\Factory $checkoutFactory
      * @param \Magento\Math\Random $mathRandom
      * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig
+     * @param \Magento\Checkout\Model\Session $checkoutSession
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Paypal\Helper\Data $paypalData,
         \Magento\Payment\Helper\Data $paymentData,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Paypal\Model\ConfigFactory $paypalConfigFactory,
         \Magento\Paypal\Model\Express\Checkout\Factory $checkoutFactory,
diff --git a/app/code/Magento/Paypal/Block/Hosted/Pro/Form.php b/app/code/Magento/Paypal/Block/Hosted/Pro/Form.php
index dac39e3c92c..d462ae99e7b 100644
--- a/app/code/Magento/Paypal/Block/Hosted/Pro/Form.php
+++ b/app/code/Magento/Paypal/Block/Hosted/Pro/Form.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Hosted\Pro;
 
 /**
  * Hosted Pro link form
@@ -31,9 +32,10 @@
  * @package    Magento_Paypal
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Block\Hosted\Pro;
-
 class Form extends \Magento\Payment\Block\Form
 {
+    /**
+     * @var string
+     */
     protected $_template = 'hss/info.phtml';
 }
diff --git a/app/code/Magento/Paypal/Block/Hosted/Pro/Iframe.php b/app/code/Magento/Paypal/Block/Hosted/Pro/Iframe.php
index fce9ab89906..7d0b48ead00 100644
--- a/app/code/Magento/Paypal/Block/Hosted/Pro/Iframe.php
+++ b/app/code/Magento/Paypal/Block/Hosted/Pro/Iframe.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Hosted\Pro;
 
 /**
  * Hosted Pro iframe block
@@ -31,14 +32,13 @@
  * @package    Magento_Paypal
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Block\Hosted\Pro;
-
 class Iframe extends \Magento\Paypal\Block\Iframe
 {
     /**
      * Internal constructor
      * Set payment method code
      *
+     * @return void
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Paypal/Block/Iframe.php b/app/code/Magento/Paypal/Block/Iframe.php
index 4dda948abb7..9ab18e413b2 100644
--- a/app/code/Magento/Paypal/Block/Iframe.php
+++ b/app/code/Magento/Paypal/Block/Iframe.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block;
 
 /**
  * HSS iframe block
  */
-namespace Magento\Paypal\Block;
-
 class Iframe extends \Magento\Payment\Block\Form
 {
     /**
@@ -102,6 +101,8 @@ class Iframe extends \Magento\Payment\Block\Form
 
     /**
      * Internal constructor
+     *
+     * @return void
      */
     protected function _construct()
     {
@@ -128,7 +129,7 @@ class Iframe extends \Magento\Payment\Block\Form
     /**
      * Get current block instance
      *
-     * @return \Magento\Paypal\Block\Iframe
+     * @return \Magento\Payment\Block\Form
      * @throws \Magento\Core\Exception
      */
     protected function _getBlock()
diff --git a/app/code/Magento/Paypal/Block/Payflow/Advanced/Form.php b/app/code/Magento/Paypal/Block/Payflow/Advanced/Form.php
index fd8c82a3c17..c8b009e7efa 100644
--- a/app/code/Magento/Paypal/Block/Payflow/Advanced/Form.php
+++ b/app/code/Magento/Paypal/Block/Payflow/Advanced/Form.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Payflow\Advanced;
 
 /**
  * Payflow Advanced iframe block
@@ -31,10 +32,11 @@
  * @package    Magento_Paypal
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Block\Payflow\Advanced;
-
 class Form extends \Magento\Paypal\Block\Payflow\Link\Form
 {
+    /**
+     * @var string
+     */
     protected $_template = 'payflowadvanced/info.phtml';
 
     /**
diff --git a/app/code/Magento/Paypal/Block/Payflow/Advanced/Iframe.php b/app/code/Magento/Paypal/Block/Payflow/Advanced/Iframe.php
index 73d52d4b8e9..297f8cfef5d 100644
--- a/app/code/Magento/Paypal/Block/Payflow/Advanced/Iframe.php
+++ b/app/code/Magento/Paypal/Block/Payflow/Advanced/Iframe.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Payflow\Advanced;
 
 /**
  * Payflow Advanced iframe block
@@ -31,12 +32,12 @@
  * @package    Magento_Paypal
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Block\Payflow\Advanced;
-
 class Iframe extends \Magento\Paypal\Block\Payflow\Link\Iframe
 {
     /**
      * Set payment method code
+     *
+     * @return void
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Paypal/Block/Payflow/Link/Form.php b/app/code/Magento/Paypal/Block/Payflow/Link/Form.php
index 616347ae9fe..4cbd4e011e4 100644
--- a/app/code/Magento/Paypal/Block/Payflow/Link/Form.php
+++ b/app/code/Magento/Paypal/Block/Payflow/Link/Form.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Payflow\Link;
 
 /**
  * Payflow link iframe block
@@ -31,10 +32,11 @@
  * @package    Magento_Paypal
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Block\Payflow\Link;
-
 class Form extends \Magento\Payment\Block\Form
 {
+    /**
+     * @var string
+     */
     protected $_template = 'payflowlink/info.phtml';
 
     /**
diff --git a/app/code/Magento/Paypal/Block/Payflow/Link/Iframe.php b/app/code/Magento/Paypal/Block/Payflow/Link/Iframe.php
index a741cbc6c35..7081200d646 100644
--- a/app/code/Magento/Paypal/Block/Payflow/Link/Iframe.php
+++ b/app/code/Magento/Paypal/Block/Payflow/Link/Iframe.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Payflow\Link;
 
 /**
  * Payflow link iframe block
  */
-namespace Magento\Paypal\Block\Payflow\Link;
-
 class Iframe extends \Magento\Paypal\Block\Iframe
 {
     /**
@@ -60,6 +59,8 @@ class Iframe extends \Magento\Paypal\Block\Iframe
 
     /**
      * Set payment method code
+     *
+     * @return void
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Paypal/Block/Payment/Form/Billing/Agreement.php b/app/code/Magento/Paypal/Block/Payment/Form/Billing/Agreement.php
index ad2caa847ca..2e767158723 100644
--- a/app/code/Magento/Paypal/Block/Payment/Form/Billing/Agreement.php
+++ b/app/code/Magento/Paypal/Block/Payment/Form/Billing/Agreement.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Payment\Form\Billing;
 
 /**
  * Paypal Billing Agreement form block
  */
-namespace Magento\Paypal\Block\Payment\Form\Billing;
-
 class Agreement extends \Magento\Payment\Block\Form
 {
     /**
@@ -54,6 +53,9 @@ class Agreement extends \Magento\Payment\Block\Form
         $this->_isScopePrivate = true;
     }
 
+    /**
+     * @return void
+     */
     protected function _construct()
     {
         parent::_construct();
@@ -71,12 +73,13 @@ class Agreement extends \Magento\Payment\Block\Form
     public function getBillingAgreements()
     {
         $data = array();
+        /** @var \Magento\Sales\Model\Quote $quote */
         $quote = $this->getParentBlock()->getQuote();
-        if (!$quote || !$quote->getCustomer()) {
+        if (!$quote || !$quote->getCustomerId()) {
             return $data;
         }
         $collection = $this->_agreementFactory->create()->getAvailableCustomerBillingAgreements(
-            $quote->getCustomer()->getId()
+            $quote->getCustomerId()
         );
 
         foreach ($collection as $item) {
diff --git a/app/code/Magento/Paypal/Block/Payment/Info.php b/app/code/Magento/Paypal/Block/Payment/Info.php
index 888c0722e41..c1eaf7aa423 100644
--- a/app/code/Magento/Paypal/Block/Payment/Info.php
+++ b/app/code/Magento/Paypal/Block/Payment/Info.php
@@ -23,13 +23,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Payment;
 
 /**
  * PayPal common payment info block
  * Uses default templates
  */
-namespace Magento\Paypal\Block\Payment;
-
 class Info extends \Magento\Payment\Block\Info\Cc
 {
     /**
@@ -68,7 +67,7 @@ class Info extends \Magento\Payment\Block\Info\Cc
     /**
      * Prepare PayPal-specific payment information
      *
-     * @param \Magento\Object|array $transport
+     * @param \Magento\Object|array|null $transport
      * @return \Magento\Object
      */
     protected function _prepareSpecificInformation($transport = null)
diff --git a/app/code/Magento/Paypal/Block/Payment/Info/Billing/Agreement.php b/app/code/Magento/Paypal/Block/Payment/Info/Billing/Agreement.php
index 3fb2538d7c4..1e7831893f2 100644
--- a/app/code/Magento/Paypal/Block/Payment/Info/Billing/Agreement.php
+++ b/app/code/Magento/Paypal/Block/Payment/Info/Billing/Agreement.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Payment\Info\Billing;
 
 /**
  * Billing Agreement info block
  */
-namespace Magento\Paypal\Block\Payment\Info\Billing;
-
 class Agreement extends \Magento\Payment\Block\Info
 {
     /**
diff --git a/app/code/Magento/Paypal/Block/Standard/Form.php b/app/code/Magento/Paypal/Block/Standard/Form.php
index 0305824b869..d40bf40ef34 100644
--- a/app/code/Magento/Paypal/Block/Standard/Form.php
+++ b/app/code/Magento/Paypal/Block/Standard/Form.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Block\Standard;
 
 /**
  * PayPal Standard payment "form"
  */
-namespace Magento\Paypal\Block\Standard;
-
 class Form extends \Magento\Payment\Block\Form
 {
     /**
@@ -65,6 +64,8 @@ class Form extends \Magento\Payment\Block\Form
 
     /**
      * Set template and redirect message
+     *
+     * @return null
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Paypal/Controller/Adminhtml/Billing/Agreement.php b/app/code/Magento/Paypal/Controller/Adminhtml/Billing/Agreement.php
index 8ee9d36e99a..262896a1bd1 100644
--- a/app/code/Magento/Paypal/Controller/Adminhtml/Billing/Agreement.php
+++ b/app/code/Magento/Paypal/Controller/Adminhtml/Billing/Agreement.php
@@ -21,28 +21,27 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Controller\Adminhtml\Billing;
 
 /**
  * Adminhtml billing agreement controller
  */
-namespace Magento\Paypal\Controller\Adminhtml\Billing;
-
 class Agreement extends \Magento\Backend\App\Action
 {
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
@@ -51,6 +50,7 @@ class Agreement extends \Magento\Backend\App\Action
     /**
      * Billing agreements
      *
+     * @return void
      */
     public function indexAction()
     {
@@ -64,6 +64,7 @@ class Agreement extends \Magento\Backend\App\Action
     /**
      * Ajax action for billing agreements
      *
+     * @return void
      */
     public function gridAction()
     {
@@ -74,6 +75,7 @@ class Agreement extends \Magento\Backend\App\Action
     /**
      * View billing agreement action
      *
+     * @return void
      */
     public function viewAction()
     {
@@ -96,6 +98,7 @@ class Agreement extends \Magento\Backend\App\Action
     /**
      * Related orders ajax action
      *
+     * @return void
      */
     public function ordersGridAction()
     {
@@ -107,6 +110,7 @@ class Agreement extends \Magento\Backend\App\Action
     /**
      * Customer billing agreements ajax action
      *
+     * @return void
      */
     public function customerGridAction()
     {
@@ -118,6 +122,7 @@ class Agreement extends \Magento\Backend\App\Action
     /**
      * Cancel billing agreement action
      *
+     * @return void
      */
     public function cancelAction()
     {
@@ -142,6 +147,8 @@ class Agreement extends \Magento\Backend\App\Action
 
     /**
      * Delete billing agreement action
+     *
+     * @return void
      */
     public function deleteAction()
     {
@@ -167,7 +174,7 @@ class Agreement extends \Magento\Backend\App\Action
     /**
      * Initialize billing agreement by ID specified in request
      *
-     * @return \Magento\Paypal\Model\Billing\Agreement | false
+     * @return \Magento\Paypal\Model\Billing\Agreement|false
      */
     protected function _initBillingAgreement()
     {
@@ -186,7 +193,7 @@ class Agreement extends \Magento\Backend\App\Action
     /**
      * Initialize customer by ID specified in request
      *
-     * @return \Magento\Paypal\Controller\Adminhtml\Billing\Agreement
+     * @return $this
      */
     protected function _initCustomer()
     {
diff --git a/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php b/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php
index 82366058aa3..194d556f004 100644
--- a/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php
+++ b/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php
@@ -23,18 +23,17 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Controller\Adminhtml\Paypal;
 
 /**
  * PayPal Settlement Reports Controller
  */
-namespace Magento\Paypal\Controller\Adminhtml\Paypal;
-
 class Reports extends \Magento\Backend\App\Action
 {
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -55,14 +54,14 @@ class Reports extends \Magento\Backend\App\Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Paypal\Model\Report\Settlement\RowFactory $rowFactory
      * @param \Magento\Paypal\Model\Report\SettlementFactory $settlementFactory
      * @param \Magento\Logger $logger
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Paypal\Model\Report\Settlement\RowFactory $rowFactory,
         \Magento\Paypal\Model\Report\SettlementFactory $settlementFactory,
         \Magento\Logger $logger
@@ -76,6 +75,8 @@ class Reports extends \Magento\Backend\App\Action
 
     /**
      * Grid action
+     *
+     * @return void
      */
     public function indexAction()
     {
@@ -85,6 +86,8 @@ class Reports extends \Magento\Backend\App\Action
 
     /**
      * Ajax callback for grid actions
+     *
+     * @return void
      */
     public function gridAction()
     {
@@ -94,6 +97,8 @@ class Reports extends \Magento\Backend\App\Action
 
     /**
      * View transaction details action
+     *
+     * @return void
      */
     public function detailsAction()
     {
@@ -116,6 +121,7 @@ class Reports extends \Magento\Backend\App\Action
     /**
      * Forced fetch reports action
      *
+     * @return void
      * @throws \Magento\Core\Exception
      */
     public function fetchAction()
@@ -153,7 +159,8 @@ class Reports extends \Magento\Backend\App\Action
 
     /**
      * Initialize titles, navigation
-     * @return \Magento\Paypal\Controller\Adminhtml\Paypal\Reports
+     *
+     * @return $this
      */
     protected function _initAction()
     {
@@ -168,6 +175,7 @@ class Reports extends \Magento\Backend\App\Action
 
     /**
      * ACL check
+     *
      * @return bool
      */
     protected function _isAllowed()
diff --git a/app/code/Magento/Paypal/Controller/Billing/Agreement.php b/app/code/Magento/Paypal/Controller/Billing/Agreement.php
index 3f5c76023cf..56e8e275f3b 100644
--- a/app/code/Magento/Paypal/Controller/Billing/Agreement.php
+++ b/app/code/Magento/Paypal/Controller/Billing/Agreement.php
@@ -21,20 +21,19 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
-/**
- * Billing agreements controller
- */
 namespace Magento\Paypal\Controller\Billing;
 
 use Magento\App\RequestInterface;
 
+/**
+ * Billing agreements controller
+ */
 class Agreement extends \Magento\App\Action\Action
 {
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -45,12 +44,12 @@ class Agreement extends \Magento\App\Action\Action
 
     /**
      * @param \Magento\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\App\Action\Title $title
      */
     public function __construct(
         \Magento\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\App\Action\Title $title
     ) {
         $this->_coreRegistry = $coreRegistry;
@@ -61,6 +60,7 @@ class Agreement extends \Magento\App\Action\Action
     /**
      * View billing agreements
      *
+     * @return void
      */
     public function indexAction()
     {
@@ -90,6 +90,7 @@ class Agreement extends \Magento\App\Action\Action
     /**
      * View billing agreement
      *
+     * @return void
      */
     public function viewAction()
     {
@@ -110,6 +111,7 @@ class Agreement extends \Magento\App\Action\Action
     /**
      * Wizard start action
      *
+     * @return \Zend_Controller_Response_Abstract
      */
     public function startWizardAction()
     {
@@ -139,6 +141,7 @@ class Agreement extends \Magento\App\Action\Action
     /**
      * Wizard return action
      *
+     * @return void
      */
     public function returnWizardAction()
     {
@@ -171,6 +174,7 @@ class Agreement extends \Magento\App\Action\Action
     /**
      * Wizard cancel action
      *
+     * @return void
      */
     public function cancelWizardAction()
     {
@@ -181,6 +185,7 @@ class Agreement extends \Magento\App\Action\Action
      * Cancel action
      * Set billing agreement status to 'Canceled'
      *
+     * @return void
      */
     public function cancelAction()
     {
@@ -207,7 +212,7 @@ class Agreement extends \Magento\App\Action\Action
     /**
      * Init billing agreement model from request
      *
-     * @return \Magento\Paypal\Model\Billing\Agreement|bool
+     * @return \Magento\Paypal\Model\Billing\Agreement|false
      */
     protected function _initAgreement()
     {
diff --git a/app/code/Magento/Paypal/Controller/Express.php b/app/code/Magento/Paypal/Controller/Express.php
index 93b36b0b8c7..deffdffc937 100644
--- a/app/code/Magento/Paypal/Controller/Express.php
+++ b/app/code/Magento/Paypal/Controller/Express.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Controller;
 
 /**
  * Express Checkout Controller
  */
-namespace Magento\Paypal\Controller;
-
 class Express extends \Magento\Paypal\Controller\Express\AbstractExpress
 {
     /**
@@ -100,6 +99,8 @@ class Express extends \Magento\Paypal\Controller\Express\AbstractExpress
 
     /**
      * Redirect to login page
+     *
+     * @return void
      */
     public function redirectLogin()
     {
diff --git a/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php b/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php
index 1c72c05f8a3..867ef9aa716 100644
--- a/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php
+++ b/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php
@@ -23,7 +23,6 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Paypal\Controller\Express;
 
 /**
@@ -135,6 +134,8 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
 
     /**
      * Start Express Checkout by requesting initial token and dispatching customer to PayPal
+     *
+     * @return void
      */
     public function startAction()
     {
@@ -188,6 +189,8 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
 
     /**
      * Return shipping options items for shipping address from request
+     *
+     * @return void
      */
     public function shippingOptionsCallbackAction()
     {
@@ -204,6 +207,8 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
 
     /**
      * Cancel Express Checkout
+     *
+     * @return void
      */
     public function cancelAction()
     {
@@ -236,6 +241,8 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
 
     /**
      * Return from PayPal and dispatch customer to order review page
+     *
+     * @return void
      */
     public function returnAction()
     {
@@ -255,6 +262,8 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
 
     /**
      * Review order after returning from PayPal
+     *
+     * @return void
      */
     public function reviewAction()
     {
@@ -284,6 +293,8 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
 
     /**
      * Dispatch customer back to PayPal for editing payment information
+     *
+     * @return void
      */
     public function editAction()
     {
@@ -297,6 +308,8 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
 
     /**
      * Update shipping method (combined action for ajax and regular request)
+     *
+     * @return void
      */
     public function saveShippingMethodAction()
     {
@@ -327,6 +340,8 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
 
     /**
      * Update Order (combined action for ajax and regular request)
+     *
+     * @return void
      */
     public function updateShippingMethodsAction()
     {
@@ -351,6 +366,8 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
 
     /**
      * Update Order (combined action for ajax and regular request)
+     *
+     * @return void
      */
     public function updateOrderAction()
     {
@@ -382,6 +399,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
     /**
      * Submit the order
      *
+     * @return void
      * @throws \Magento\Core\Exception
      */
     public function placeOrderAction()
@@ -414,15 +432,9 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
                     ->setLastRealOrderId($order->getIncrementId());
             }
 
-            // recurring profiles may be created along with the order or without it
-            $profiles = $this->_checkout->getRecurringPaymentProfiles();
-            if ($profiles) {
-                $ids = array();
-                foreach ($profiles as $profile) {
-                    $ids[] = $profile->getId();
-                }
-                $this->_getCheckoutSession()->setLastRecurringProfileIds($ids);
-            }
+            $this->_eventManager->dispatch('paypal_express_place_order_success', [
+                'order' => $order, 'quote' => $this->_getQuote()
+            ]);
 
             // redirect if PayPal specified some URL (for example, to Giropay bank)
             $url = $this->_checkout->getRedirectUrl();
@@ -445,6 +457,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
     /**
      * Instantiate quote and checkout
      *
+     * @return void
      * @throws \Magento\Core\Exception
      */
     private function _initCheckout()
@@ -471,7 +484,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
      * Search for proper checkout token in request or session or (un)set specified one
      * Combined getter/setter
      *
-     * @param string $setToken
+     * @param string|null $setToken
      * @return \Magento\Paypal\Controller\Express|string
      * @throws \Magento\Core\Exception
      */
@@ -536,6 +549,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action
     /**
      * Redirect to login page
      *
+     * @return void
      */
     public function redirectLogin()
     {
diff --git a/app/code/Magento/Paypal/Controller/Hostedpro.php b/app/code/Magento/Paypal/Controller/Hostedpro.php
index e31a672da7b..b37bbb9b73a 100644
--- a/app/code/Magento/Paypal/Controller/Hostedpro.php
+++ b/app/code/Magento/Paypal/Controller/Hostedpro.php
@@ -21,6 +21,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Controller;
 
 /**
  * Hosted Pro Checkout Controller
@@ -29,12 +30,12 @@
  * @package    Magento_Paypal
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Controller;
-
 class Hostedpro extends \Magento\App\Action\Action
 {
     /**
      * When a customer return to website from gateway.
+     *
+     * @return void
      */
     public function returnAction()
     {
@@ -47,6 +48,8 @@ class Hostedpro extends \Magento\App\Action\Action
 
     /**
      * When a customer cancel payment from gateway.
+     *
+     * @return void
      */
     public function cancelAction()
     {
@@ -62,7 +65,7 @@ class Hostedpro extends \Magento\App\Action\Action
      * Cancel order, return quote to customer
      *
      * @param string $errorMsg
-     * @return mixed
+     * @return false|string
      */
     protected function _cancelPayment($errorMsg = '')
     {
diff --git a/app/code/Magento/Paypal/Controller/Ipn.php b/app/code/Magento/Paypal/Controller/Ipn.php
index 3d7e98735b2..a1e97038ca3 100644
--- a/app/code/Magento/Paypal/Controller/Ipn.php
+++ b/app/code/Magento/Paypal/Controller/Ipn.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Controller;
 
 /**
  * Unified IPN controller for all supported PayPal methods
  */
-namespace Magento\Paypal\Controller;
-
 class Ipn extends \Magento\App\Action\Action
 {
     /**
@@ -48,6 +47,7 @@ class Ipn extends \Magento\App\Action\Action
      * @param \Magento\App\Action\Context $context
      * @param \Magento\Paypal\Model\IpnFactory $ipnFactory
      * @param \Magento\HTTP\Adapter\CurlFactory $curlFactory
+     * @param \Magento\Logger $logger
      */
     public function __construct(
         \Magento\App\Action\Context $context,
@@ -63,6 +63,8 @@ class Ipn extends \Magento\App\Action\Action
 
     /**
      * Instantiate IPN model and pass IPN request to it
+     *
+     * @return void
      */
     public function indexAction()
     {
diff --git a/app/code/Magento/Paypal/Controller/Payflow.php b/app/code/Magento/Paypal/Controller/Payflow.php
index a2752e33ebd..95fef0c34cf 100644
--- a/app/code/Magento/Paypal/Controller/Payflow.php
+++ b/app/code/Magento/Paypal/Controller/Payflow.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Controller;
 
 /**
  * Payflow Checkout Controller
  */
-namespace Magento\Paypal\Controller;
-
 class Payflow extends \Magento\App\Action\Action
 {
     /**
@@ -60,6 +59,7 @@ class Payflow extends \Magento\App\Action\Action
      * @param \Magento\Sales\Model\OrderFactory $orderFactory
      * @param \Magento\Paypal\Model\PayflowlinkFactory $payflowlinkFactory
      * @param \Magento\Paypal\Helper\Checkout $checkoutHelper
+     * @param \Magento\Logger $logger
      */
     public function __construct(
         \Magento\App\Action\Context $context,
@@ -79,6 +79,8 @@ class Payflow extends \Magento\App\Action\Action
 
     /**
      * When a customer cancel payment from payflow gateway.
+     *
+     * @return void
      */
     public function cancelPaymentAction()
     {
@@ -91,6 +93,8 @@ class Payflow extends \Magento\App\Action\Action
 
     /**
      * When a customer return to website from payflow gateway.
+     *
+     * @return void
      */
     public function returnUrlAction()
     {
@@ -121,6 +125,8 @@ class Payflow extends \Magento\App\Action\Action
 
     /**
      * Submit transaction to Payflow getaway into iframe
+     *
+     * @return void
      */
     public function formAction()
     {
@@ -129,6 +135,8 @@ class Payflow extends \Magento\App\Action\Action
 
     /**
      * Get response from PayPal by silent post method
+     *
+     * @return void
      */
     public function silentPostAction()
     {
@@ -148,7 +156,7 @@ class Payflow extends \Magento\App\Action\Action
      * Cancel order, return quote to customer
      *
      * @param string $errorMsg
-     * @return mixed
+     * @return false|string
      */
     protected function _cancelPayment($errorMsg = '')
     {
diff --git a/app/code/Magento/Paypal/Controller/Payflowadvanced.php b/app/code/Magento/Paypal/Controller/Payflowadvanced.php
index 25efe7be681..4bdc62a481d 100644
--- a/app/code/Magento/Paypal/Controller/Payflowadvanced.php
+++ b/app/code/Magento/Paypal/Controller/Payflowadvanced.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Controller;
 
 /**
  * Payflow Advanced Checkout Controller
  */
-namespace Magento\Paypal\Controller;
-
 class Payflowadvanced extends \Magento\Paypal\Controller\Express\AbstractExpress
 {
     /**
@@ -97,6 +96,8 @@ class Payflowadvanced extends \Magento\Paypal\Controller\Express\AbstractExpress
 
     /**
      * When a customer cancel payment from payflow gateway.
+     *
+     * @return void
      */
     public function cancelPaymentAction()
     {
@@ -109,6 +110,8 @@ class Payflowadvanced extends \Magento\Paypal\Controller\Express\AbstractExpress
 
     /**
      * When a customer return to website from payflow gateway.
+     *
+     * @return void
      */
     public function returnUrlAction()
     {
@@ -139,6 +142,8 @@ class Payflowadvanced extends \Magento\Paypal\Controller\Express\AbstractExpress
 
     /**
      * Submit transaction to Payflow getaway into iframe
+     *
+     * @return void
      */
     public function formAction()
     {
@@ -149,6 +154,8 @@ class Payflowadvanced extends \Magento\Paypal\Controller\Express\AbstractExpress
 
     /**
      * Get response from PayPal by silent post method
+     *
+     * @return void
      */
     public function silentPostAction()
     {
@@ -168,7 +175,7 @@ class Payflowadvanced extends \Magento\Paypal\Controller\Express\AbstractExpress
      * Cancel order, return quote to customer
      *
      * @param string $errorMsg
-     * @return bool|string
+     * @return false|string
      */
     protected function _cancelPayment($errorMsg = '')
     {
diff --git a/app/code/Magento/Paypal/Controller/Standard.php b/app/code/Magento/Paypal/Controller/Standard.php
index aa9fe21e278..a7433d36844 100644
--- a/app/code/Magento/Paypal/Controller/Standard.php
+++ b/app/code/Magento/Paypal/Controller/Standard.php
@@ -21,6 +21,9 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Controller;
+
+use Magento\Sales\Model\Order;
 
 /**
  * Paypal Standard Checkout Controller
@@ -29,19 +32,19 @@
  * @package    Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Controller;
-
 class Standard extends \Magento\App\Action\Action
 {
     /**
      * Order instance
+     *
+     * @var Order
      */
     protected $_order;
 
     /**
-     *  Get order
+     * Get order
      *
-     *  @return	\Magento\Sales\Model\Order
+     * @return Order
      */
     public function getOrder()
     {
@@ -50,11 +53,13 @@ class Standard extends \Magento\App\Action\Action
 
     /**
      * Send expire header to ajax response
+     *
+     * @return void
      */
     protected function _expireAjax()
     {
         if (!$this->_objectManager->get('Magento\Checkout\Model\Session')->getQuote()->hasItems()) {
-            $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
+            $this->getResponse()->setHeader('HTTP/1.1', '403 Session Expired');
             exit;
         }
     }
@@ -71,6 +76,8 @@ class Standard extends \Magento\App\Action\Action
 
     /**
      * When a customer chooses Paypal on Checkout/Payment page
+     *
+     * @return void
      */
     public function redirectAction()
     {
@@ -83,6 +90,8 @@ class Standard extends \Magento\App\Action\Action
 
     /**
      * When a customer cancel payment from paypal.
+     *
+     * @return void
      */
     public function cancelAction()
     {
@@ -107,10 +116,12 @@ class Standard extends \Magento\App\Action\Action
     }
 
     /**
-     * when paypal returns
+     * When paypal returns
      * The order information at this point is in POST
      * variables.  However, you don't want to "process" the order until you
      * get validation from the IPN.
+     *
+     * @return void
      */
     public function successAction()
     {
diff --git a/app/code/Magento/Paypal/Helper/Checkout.php b/app/code/Magento/Paypal/Helper/Checkout.php
index 02b64f3ef98..dea834f620e 100644
--- a/app/code/Magento/Paypal/Helper/Checkout.php
+++ b/app/code/Magento/Paypal/Helper/Checkout.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Helper;
 
 /**
  * Checkout workflow helper
  */
-namespace Magento\Paypal\Helper;
-
 class Checkout
 {
     /**
diff --git a/app/code/Magento/Paypal/Helper/Data.php b/app/code/Magento/Paypal/Helper/Data.php
index cbc29ce28e3..57404b969fd 100644
--- a/app/code/Magento/Paypal/Helper/Data.php
+++ b/app/code/Magento/Paypal/Helper/Data.php
@@ -21,12 +21,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Helper;
+
+use Magento\Paypal\Model\Billing\Agreement\MethodInterface;
 
 /**
  * Paypal Data helper
  */
-namespace Magento\Paypal\Helper;
-
 class Data extends \Magento\App\Helper\AbstractHelper
 {
     /**
@@ -94,9 +95,9 @@ class Data extends \Magento\App\Helper\AbstractHelper
     /**
      * Retrieve available billing agreement methods
      *
-     * @param mixed $store
-     * @param \Magento\Sales\Model\Quote $quote
-     * @return array
+     * @param null|string|bool|int|\Magento\Core\Model\Store $store
+     * @param \Magento\Sales\Model\Quote|null $quote
+     * @return MethodInterface[]
      */
     public function getBillingAgreementMethods($store = null, $quote = null)
     {
@@ -138,7 +139,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
      */
     public function canManageBillingAgreements($methodInstance)
     {
-        return ($methodInstance instanceof \Magento\Paypal\Model\Billing\Agreement\MethodInterface);
+        return ($methodInstance instanceof MethodInterface);
     }
 
     /**
diff --git a/app/code/Magento/Paypal/Helper/Hss.php b/app/code/Magento/Paypal/Helper/Hss.php
index 841cb35d311..eee61a6b443 100644
--- a/app/code/Magento/Paypal/Helper/Hss.php
+++ b/app/code/Magento/Paypal/Helper/Hss.php
@@ -21,18 +21,17 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Helper;
 
 /**
  * Hosted Sole Solution helper
  */
-namespace Magento\Paypal\Helper;
-
 class Hss extends \Magento\App\Helper\AbstractHelper
 {
     /**
      * Hosted Sole Solution methods
      *
-     * @var array
+     * @var string[]
      */
     protected $_hssMethods = array(
         \Magento\Paypal\Model\Config::METHOD_HOSTEDPRO,
@@ -93,7 +92,7 @@ class Hss extends \Magento\App\Helper\AbstractHelper
     /**
      * Get methods
      *
-     * @return array
+     * @return string[]
      */
     public function getHssMethods()
     {
diff --git a/app/code/Magento/Paypal/Model/Api/AbstractApi.php b/app/code/Magento/Paypal/Model/Api/AbstractApi.php
index 5202b400cdc..3fe5c60b787 100644
--- a/app/code/Magento/Paypal/Model/Api/AbstractApi.php
+++ b/app/code/Magento/Paypal/Model/Api/AbstractApi.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Api;
 
 /**
  * Abstract class for Paypal API wrappers
  */
-namespace Magento\Paypal\Model\Api;
-
 abstract class AbstractApi extends \Magento\Object
 {
     /**
@@ -64,7 +63,15 @@ abstract class AbstractApi extends \Magento\Object
      * @var array
      */
     protected $_lineItemExportItemsFormat = array();
+
+    /**
+     * @var array
+     */
     protected $_lineItemExportItemsFilters = array();
+
+    /**
+     * @var array
+     */
     protected $_lineItemTotalExportMap = array();
 
     /**
@@ -118,7 +125,7 @@ abstract class AbstractApi extends \Magento\Object
     protected $_regionFactory;
 
     /**
-     * @var \Magento\Core\Model\Log\AdapterFactory
+     * @var \Magento\Logger\AdapterFactory
      */
     protected $_logAdapterFactory;
 
@@ -132,7 +139,7 @@ abstract class AbstractApi extends \Magento\Object
      * @param \Magento\Logger $logger
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Directory\Model\RegionFactory $regionFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param array $data
      */
     public function __construct(
@@ -140,7 +147,7 @@ abstract class AbstractApi extends \Magento\Object
         \Magento\Logger $logger,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Directory\Model\RegionFactory $regionFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         array $data = array()
     ) {
         $this->_customerAddress = $customerAddress;
@@ -293,6 +300,8 @@ abstract class AbstractApi extends \Magento\Object
 
     /**
      * PayPal merchant email getter
+     *
+     * @return string
      */
     public function getBusinessAccount()
     {
@@ -316,7 +325,7 @@ abstract class AbstractApi extends \Magento\Object
      *
      * @param array|\Magento\Object $from
      * @param array $publicMap
-     * @return \Magento\Paypal\Model\Api\AbstractApi
+     * @return $this
      */
     public function export($from, array $publicMap = array())
     {
@@ -328,7 +337,7 @@ abstract class AbstractApi extends \Magento\Object
      * Set PayPal cart instance
      *
      * @param \Magento\Paypal\Model\Cart $cart
-     * @return \Magento\Paypal\Model\Api\AbstractApi
+     * @return $this
      */
     public function setPaypalCart(\Magento\Paypal\Model\Cart $cart)
     {
@@ -340,7 +349,7 @@ abstract class AbstractApi extends \Magento\Object
      * Config instance setter
      *
      * @param \Magento\Paypal\Model\Config $config
-     * @return \Magento\Paypal\Model\Api\AbstractApi
+     * @return $this
      */
     public function setConfigObject(\Magento\Paypal\Model\Config $config)
     {
@@ -360,6 +369,8 @@ abstract class AbstractApi extends \Magento\Object
 
     /**
      * Always take into account
+     *
+     * @return int
      */
     public function getFraudManagementFiltersEnabled()
     {
@@ -370,7 +381,7 @@ abstract class AbstractApi extends \Magento\Object
      * Set recurring profiles
      *
      * @param array $items
-     * @return \Magento\Paypal\Model\Api\AbstractApi
+     * @return $this
      */
     public function addRecurringPaymentProfiles(array $items)
     {
@@ -412,6 +423,7 @@ abstract class AbstractApi extends \Magento\Object
      *
      * @param array $privateResponseMap
      * @param array $response
+     * @return void
      */
     protected function _importFromResponse(array $privateResponseMap, array $response)
     {
@@ -435,7 +447,7 @@ abstract class AbstractApi extends \Magento\Object
      *
      * @param array &$request
      * @param int $i
-     * @return true|bool
+     * @return true|null
      */
     protected function _exportLineItems(array &$request, $i = 0)
     {
@@ -509,6 +521,7 @@ abstract class AbstractApi extends \Magento\Object
 
     /**
      * Filter amounts in API calls
+     *
      * @param float|string $value
      * @return string
      */
@@ -543,7 +556,7 @@ abstract class AbstractApi extends \Magento\Object
      * Unified getter that looks in data or falls back to config
      *
      * @param string $key
-     * @param mixed $default
+     * @param mixed|null $default
      * @return mixed
      */
     protected function _getDataOrConfig($key, $default = null)
@@ -554,7 +567,6 @@ abstract class AbstractApi extends \Magento\Object
         return $this->_config->$key ? $this->_config->$key : $default;
     }
 
-
     /**
      * region_id workaround: PayPal requires state code, try to find one in the address
      *
diff --git a/app/code/Magento/Paypal/Model/Api/Nvp.php b/app/code/Magento/Paypal/Model/Api/Nvp.php
index d9f8a7fd317..fc37bfa8a29 100644
--- a/app/code/Magento/Paypal/Model/Api/Nvp.php
+++ b/app/code/Magento/Paypal/Model/Api/Nvp.php
@@ -23,15 +23,14 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Api;
+
+use Magento\Payment\Model\Cart;
 
 /**
  * NVP API wrappers model
  * @TODO: move some parts to abstract, don't hesitate to throw exceptions on api calls
  */
-namespace Magento\Paypal\Model\Api;
-
-use Magento\Payment\Model\Cart;
-
 class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 {
     /**
@@ -54,11 +53,17 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     const PENDING_TRANSACTION_DENY = 'Deny';
 
     /**
-     * Capture types (make authorization close or remain open)
+     * Capture type (make authorization close or remain open)
      *
      * @var string
      */
     protected $_captureTypeComplete = 'Complete';
+
+    /**
+     * Capture type (make authorization close or remain open)
+     *
+     * @var string
+     */
     protected $_captureTypeNotcomplete = 'NotComplete';
 
     /**
@@ -193,7 +198,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     );
 
     /**
-     * Filter callbacks for preparing internal amounts to NVP request
+     * Filter callback for preparing internal amounts to NVP request
      *
      * @var array
      */
@@ -205,7 +210,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
         'TAXAMT'      => '_filterAmount',
         'INITAMT'     => '_filterAmount',
         'CREDITCARDTYPE' => '_filterCcType',
-//        'PROFILESTARTDATE' => '_filterToPaypalDate',
+        //        'PROFILESTARTDATE' => '_filterToPaypalDate',
         'AUTOBILLAMT' => '_filterBillFailedLater',
         'BILLINGPERIOD' => '_filterPeriodUnit',
         'TRIALBILLINGPERIOD' => '_filterPeriodUnit',
@@ -214,6 +219,11 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
         'NOSHIPPING' => '_filterInt',
     );
 
+    /**
+     * Filter callback for preparing internal amounts to NVP request
+     *
+     * @var array
+     */
     protected $_importFromRequestFilters = array(
         'REDIRECTREQUIRED'  => '_filterToBool',
         'SUCCESSPAGEREDIRECTREQUESTED'  => '_filterToBool',
@@ -223,14 +233,14 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     /**
      * Request map for each API call
      *
-     * @var array
+     * @var string[]
      */
     protected $_eachCallRequest = array('VERSION', 'USER', 'PWD', 'SIGNATURE', 'BUTTONSOURCE',);
 
     /**
-     * SetExpressCheckout request/response map
+     * SetExpressCheckout request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_setExpressCheckoutRequest = array(
         'PAYMENTACTION', 'AMT', 'CURRENCYCODE', 'RETURNURL', 'CANCELURL', 'INVNUM', 'SOLUTIONTYPE', 'NOSHIPPING',
@@ -238,31 +248,44 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
         'PAGESTYLE', 'HDRIMG', 'HDRBORDERCOLOR', 'HDRBACKCOLOR', 'PAYFLOWCOLOR', 'LOCALECODE',
         'BILLINGTYPE', 'SUBJECT', 'ITEMAMT', 'SHIPPINGAMT', 'TAXAMT', 'REQBILLINGADDRESS',
     );
+
+    /**
+     * SetExpressCheckout response map
+     *
+     * @var string[]
+     */
     protected $_setExpressCheckoutResponse = array('TOKEN');
 
     /**
-     * GetExpressCheckoutDetails request/response map
-     * @var array
+     * GetExpressCheckoutDetails request map
+     *
+     * @var string[]
      */
     protected $_getExpressCheckoutDetailsRequest = array('TOKEN', 'SUBJECT',);
 
     /**
-     * DoExpressCheckoutPayment request/response map
+     * DoExpressCheckoutPayment request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_doExpressCheckoutPaymentRequest = array(
         'TOKEN', 'PAYERID', 'PAYMENTACTION', 'AMT', 'CURRENCYCODE', 'IPADDRESS', 'BUTTONSOURCE', 'NOTIFYURL',
         'RETURNFMFDETAILS', 'SUBJECT', 'ITEMAMT', 'SHIPPINGAMT', 'TAXAMT',
     );
+
+    /**
+     * DoExpressCheckoutPayment response map
+     *
+     * @var string[]
+     */
     protected $_doExpressCheckoutPaymentResponse = array(
         'TRANSACTIONID', 'AMT', 'PAYMENTSTATUS', 'PENDINGREASON', 'REDIRECTREQUIRED'
     );
 
     /**
-     * DoDirectPayment request/response map
+     * DoDirectPayment request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_doDirectPaymentRequest = array(
         'PAYMENTACTION', 'IPADDRESS', 'RETURNFMFDETAILS',
@@ -270,82 +293,124 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
         'CREDITCARDTYPE', 'ACCT', 'EXPDATE', 'CVV2', 'STARTDATE', 'ISSUENUMBER',
         'AUTHSTATUS3DS', 'MPIVENDOR3DS', 'CAVV', 'ECI3DS', 'XID',
     );
+
+    /**
+     * DoDirectPayment response map
+     *
+     * @var string[]
+     */
     protected $_doDirectPaymentResponse = array(
         'TRANSACTIONID', 'AMT', 'AVSCODE', 'CVV2MATCH', 'VPAS', 'ECISUBMITTED3DS'
     );
 
     /**
-     * DoReauthorization request/response map
+     * DoReauthorization request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_doReauthorizationRequest = array('AUTHORIZATIONID', 'AMT', 'CURRENCYCODE');
+
+    /**
+     * DoReauthorization response map
+     *
+     * @var string[]
+     */
     protected $_doReauthorizationResponse = array(
         'AUTHORIZATIONID', 'PAYMENTSTATUS', 'PENDINGREASON', 'PROTECTIONELIGIBILITY'
     );
 
     /**
-     * DoCapture request/response map
+     * DoCapture request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_doCaptureRequest = array('AUTHORIZATIONID', 'COMPLETETYPE', 'AMT', 'CURRENCYCODE', 'NOTE', 'INVNUM',);
+
+    /**
+     * DoCapture response map
+     *
+     * @var string[]
+     */
     protected $_doCaptureResponse = array('TRANSACTIONID', 'CURRENCYCODE', 'AMT', 'PAYMENTSTATUS', 'PENDINGREASON',);
 
 
     /**
-     * DoAuthorization request/response map
+     * DoAuthorization request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_doAuthorizationRequest = array('TRANSACTIONID', 'AMT', 'CURRENCYCODE');
+
+    /**
+     * DoAuthorization response map
+     *
+     * @var string[]
+     */
     protected $_doAuthorizationResponse = array('TRANSACTIONID', 'AMT');
 
     /**
      * DoVoid request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_doVoidRequest = array('AUTHORIZATIONID', 'NOTE',);
 
     /**
      * GetTransactionDetailsRequest
      *
-     * @var array
+     * @var string[]
      */
     protected $_getTransactionDetailsRequest = array('TRANSACTIONID');
+
+    /**
+     * GetTransactionDetailsResponse
+     *
+     * @var string[]
+     */
     protected $_getTransactionDetailsResponse = array(
         'PAYERID', 'FIRSTNAME', 'LASTNAME', 'TRANSACTIONID', 'PARENTTRANSACTIONID', 'CURRENCYCODE', 'AMT',
         'PAYMENTSTATUS', 'PENDINGREASON',
     );
 
     /**
-     * RefundTransaction request/response map
+     * RefundTransaction request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_refundTransactionRequest = array('TRANSACTIONID', 'REFUNDTYPE', 'CURRENCYCODE', 'NOTE',);
+
+    /**
+     * RefundTransaction response map
+     *
+     * @var string[]
+     */
     protected $_refundTransactionResponse = array('REFUNDTRANSACTIONID', 'GROSSREFUNDAMT',);
 
     /**
-     * ManagePendingTransactionStatus request/response map
+     * ManagePendingTransactionStatus request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_managePendingTransactionStatusRequest = array('TRANSACTIONID', 'ACTION');
+
+    /**
+     * ManagePendingTransactionStatus response map
+     *
+     * @var string[]
+     */
     protected $_managePendingTransactionStatusResponse = array('TRANSACTIONID', 'STATUS');
 
     /**
      * GetPalDetails response map
      *
-     * @var array
+     * @var string[]
      */
     protected $_getPalDetailsResponse = array('PAL');
 
     /**
      * CreateRecurringPaymentsProfile request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_createRecurringPaymentsProfileRequest = array(
         'TOKEN', 'SUBSCRIBERNAME', 'PROFILESTARTDATE', 'PROFILEREFERENCE', 'DESC', 'MAXFAILEDPAYMENTS', 'AUTOBILLAMT',
@@ -356,7 +421,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     /**
      * CreateRecurringPaymentsProfile response map
      *
-     * @var array
+     * @var string[]
      */
     protected $_createRecurringPaymentsProfileResponse = array(
         'PROFILEID', 'PROFILESTATUS'
@@ -365,26 +430,27 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     /**
      * Request/response for ManageRecurringPaymentsProfileStatus map
      *
-     * @var array
+     * @var string[]
      */
     protected $_manageRecurringPaymentsProfileStatusRequest = array('PROFILEID', 'ACTION');
 
     /**
      * Request for GetRecurringPaymentsProfileDetails
      *
-     * @var array
+     * @var string[]
      */
     protected $_getRecurringPaymentsProfileDetailsRequest = array('PROFILEID');
 
     /**
      * Response for GetRecurringPaymentsProfileDetails
      *
-     * @var array
+     * @var string[]
      */
     protected $_getRecurringPaymentsProfileDetailsResponse = array('STATUS', /* TODO: lot of other stuff */);
 
     /**
      * Map for billing address import/export
+     *
      * @var array
      */
     protected $_billingAddressMap = array (
@@ -444,7 +510,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * Payment information response specifically to be collected after some requests
-     * @var array
+     * @var string[]
      */
     protected $_paymentInformationResponse = array(
         'PAYERID', 'PAYERSTATUS', 'CORRELATIONID', 'ADDRESSID', 'ADDRESSSTATUS',
@@ -460,6 +526,11 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
         Cart::AMOUNT_TAX      => 'TAXAMT',
         Cart::AMOUNT_SHIPPING => 'SHIPPINGAMT',
     );
+
+    /**
+     * Line items export mapping settings
+     * @var array
+     */
     protected $_lineItemExportItemsFormat = array(
         'id'     => 'L_NUMBER%d',
         'name'   => 'L_NAME%d',
@@ -480,54 +551,87 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     );
 
     /**
-     * init Billing Agreement request/response map
-     * @var array
+     * init Billing Agreement request map
+     *
+     * @var string[]
      */
     protected $_customerBillingAgreementRequest = array('RETURNURL', 'CANCELURL', 'BILLINGTYPE');
+
+    /**
+     * init Billing Agreement response map
+     *
+     * @var string[]
+     */
     protected $_customerBillingAgreementResponse = array('TOKEN');
 
     /**
-     * Billing Agreement details request/response map
-     * @var array
+     * Billing Agreement details request map
+     *
+     * @var string[]
      */
     protected $_billingAgreementCustomerDetailsRequest = array('TOKEN');
+
+    /**
+     * Billing Agreement details response map
+     *
+     * @var string[]
+     */
     protected $_billingAgreementCustomerDetailsResponse = array('EMAIL', 'PAYERID', 'PAYERSTATUS', 'SHIPTOCOUNTRYCODE',
         'PAYERBUSINESS'
     );
 
     /**
-     * Create Billing Agreement request/response map
-     * @var array
+     * Create Billing Agreement request map
+     *
+     * @var string[]
      */
     protected $_createBillingAgreementRequest = array('TOKEN');
+
+    /**
+     * Create Billing Agreement response map
+     *
+     * @var string[]
+     */
     protected $_createBillingAgreementResponse = array('BILLINGAGREEMENTID');
 
     /**
-     * Update Billing Agreement request/response map
+     * Update Billing Agreement request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_updateBillingAgreementRequest = array(
         'REFERENCEID', 'BILLINGAGREEMENTDESCRIPTION', 'BILLINGAGREEMENTSTATUS', 'BILLINGAGREEMENTCUSTOM'
     );
+
+    /**
+     * Update Billing Agreement response map
+     *
+     * @var string[]
+     */
     protected $_updateBillingAgreementResponse = array(
         'REFERENCEID', 'BILLINGAGREEMENTDESCRIPTION', 'BILLINGAGREEMENTSTATUS', 'BILLINGAGREEMENTCUSTOM'
     );
 
     /**
-     * Do Reference Transaction request/response map
+     * Do Reference Transaction request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_doReferenceTransactionRequest = array('REFERENCEID', 'PAYMENTACTION', 'AMT', 'ITEMAMT', 'SHIPPINGAMT',
         'TAXAMT', 'INVNUM', 'NOTIFYURL', 'CURRENCYCODE'
     );
+
+    /**
+     * Do Reference Transaction response map
+     *
+     * @var string[]
+     */
     protected $_doReferenceTransactionResponse = array('BILLINGAGREEMENTID', 'TRANSACTIONID');
 
     /**
      * Fields that should be replaced in debug with '***'
      *
-     * @var array
+     * @var string[]
      */
     protected $_debugReplacePrivateDataKeys = array(
         'ACCT', 'EXPDATE', 'CVV2', 'CARDISSUE', 'CARDSTART', 'CREDITCARDTYPE', 'USER', 'PWD', 'SIGNATURE'
@@ -581,7 +685,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
      * @param \Magento\Logger $logger
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Directory\Model\RegionFactory $regionFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Directory\Model\CountryFactory $countryFactory
      * @param array $data
      */
@@ -590,7 +694,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
         \Magento\Logger $logger,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Directory\Model\RegionFactory $regionFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Directory\Model\CountryFactory $countryFactory,
         array $data = array()
     ) {
@@ -633,8 +737,11 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * SetExpressCheckout call
-     * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout
+     *
      * TODO: put together style and giropay settings
+     *
+     * @return void
+     * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout
      */
     public function callSetExpressCheckout()
     {
@@ -668,6 +775,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * GetExpressCheckoutDetails call
+     *
+     * @return void
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetExpressCheckoutDetails
      */
     function callGetExpressCheckoutDetails()
@@ -681,6 +790,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * DoExpressCheckout call
+     *
+     * @return void
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoExpressCheckoutPayment
      */
     public function callDoExpressCheckoutPayment()
@@ -702,6 +813,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * Process a credit card payment
+     *
+     * @return void
      */
     public function callDoDirectPayment()
     {
@@ -716,6 +829,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * Do Reference Transaction call
+     *
+     * @return void
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoReferenceTransaction
      */
     public function callDoReferenceTransaction()
@@ -738,6 +853,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * Made additional request to paypal to get autharization id
+     *
+     * @return void
      */
     public function callDoReauthorization()
     {
@@ -748,6 +865,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * DoCapture call
+     *
+     * @return void
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoCapture
      */
     public function callDoCapture()
@@ -762,8 +881,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     /**
      * DoAuthorization call
      *
+     * @return $this
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoAuthorization
-     * @return \Magento\Paypal\Model\Api\Nvp
      */
     public function callDoAuthorization()
     {
@@ -778,6 +897,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * DoVoid call
+     *
+     * @return void
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoVoid
      */
     public function callDoVoid()
@@ -788,6 +909,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * GetTransactionDetails
+     *
+     * @return void
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetTransactionDetails
      */
     public function callGetTransactionDetails()
@@ -799,6 +922,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * RefundTransaction call
+     *
+     * @return void
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_RefundTransaction
      */
     public function callRefundTransaction()
@@ -813,6 +938,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * ManagePendingTransactionStatus
+     *
+     * @return void
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_ManagePendingTransactionStatus
      */
     public function callManagePendingTransactionStatus()
@@ -826,7 +953,9 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     }
 
     /**
-     * getPalDetails call
+     * GetPalDetails call
+     *
+     * @return void
      * @link https://www.x.com/docs/DOC-1300
      * @link https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECButtonIntegration
      */
@@ -839,6 +968,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     /**
      * Set Customer BillingA greement call
      *
+     * @return void
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetCustomerBillingAgreement
      */
     public function callSetCustomerBillingAgreement()
@@ -851,6 +981,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     /**
      * Get Billing Agreement Customer Details call
      *
+     * @return void
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetBillingAgreementCustomerDetails
      */
     public function callGetBillingAgreementCustomerDetails()
@@ -863,6 +994,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     /**
      * Create Billing Agreement call
      *
+     * @return void
      */
     public function callCreateBillingAgreement()
     {
@@ -874,6 +1006,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     /**
      * Billing Agreement Update call
      *
+     * @return void
      */
     public function callUpdateBillingAgreement()
     {
@@ -891,6 +1024,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * CreateRecurringPaymentsProfile call
+     *
+     * @return void
      */
     public function callCreateRecurringPaymentsProfile()
     {
@@ -903,6 +1038,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     /**
      * ManageRecurringPaymentsProfileStatus call
      *
+     * @return void
      * @throws \Magento\Core\Exception
      */
     public function callManageRecurringPaymentsProfileStatus()
@@ -928,6 +1064,9 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * GetRecurringPaymentsProfileDetails call
+     *
+     * @param \Magento\Object $result
+     * @return void
      */
     public function callGetRecurringPaymentsProfileDetails(\Magento\Object $result)
     {
@@ -994,7 +1133,6 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
      * Additional response processing.
      *
      * @param  array $response
-     *
      * @return array
      */
     protected function _postProcessResponse($response)
@@ -1087,7 +1225,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
      * Setter for 'raw response needed' flag
      *
      * @param bool $flag
-     * @return \Magento\Paypal\Model\Api\Nvp
+     * @return $this
      */
     public function setRawResponseNeeded($flag)
     {
@@ -1099,6 +1237,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
      * Handle logical errors
      *
      * @param array $response
+     * @return void
      * @throws \Magento\Core\Exception
      */
     protected function _handleCallErrors($response)
@@ -1130,7 +1269,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     /**
      * Catch success calls and collect warnings
      *
-     * @param array
+     * @param array $response
      * @return bool success flag
      */
     protected function _isCallSuccessful($response)
@@ -1196,7 +1335,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
             //decoding the respose
             $nvpArray[urldecode($keyval)] = urldecode( $valval);
             $nvpstr = substr($nvpstr, $valuepos + 1, strlen($nvpstr));
-         }
+        }
         return $nvpArray;
     }
 
@@ -1218,7 +1357,9 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * Create billing and shipping addresses basing on response data
+     *
      * @param array $data
+     * @return void
      */
     protected function _exportAddressses($data)
     {
@@ -1253,7 +1394,8 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
     /**
      * Adopt specified address object to be compatible with Magento
      *
-     * @param \Magento\Object $address
+     * @param \Magento\Object
+     * @return void
      */
     protected function _applyStreetAndRegionWorkarounds(\Magento\Object $address)
     {
@@ -1281,6 +1423,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
      * Puerto Rico should be as state of USA and not as a country
      *
      * @param array $request
+     * @return void
      */
     protected function _applyCountryWorkarounds(&$request)
     {
@@ -1342,7 +1485,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
      * Filter for true/false values (converts to boolean)
      *
      * @param mixed $value
-     * @return mixed
+     * @return bool|mixed
      */
     protected function _filterToBool($value)
     {
@@ -1501,6 +1644,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
      *
      * @param string $value
      * @param \Magento\Object $result
+     * @return void
      */
     protected function _analyzeRecurringProfileStatus($value, \Magento\Object $result)
     {
@@ -1562,6 +1706,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi
      * Check the EC request against unilateral payments mode and remove the SUBJECT if needed
      *
      * @param &array $requestFields
+     * @return void
      */
     protected function _prepareExpressCheckoutCallRequest(&$requestFields)
     {
diff --git a/app/code/Magento/Paypal/Model/Api/PayflowNvp.php b/app/code/Magento/Paypal/Model/Api/PayflowNvp.php
index 739fbf0d42c..a7de05470d2 100644
--- a/app/code/Magento/Paypal/Model/Api/PayflowNvp.php
+++ b/app/code/Magento/Paypal/Model/Api/PayflowNvp.php
@@ -21,14 +21,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
-/**
- * NVP API wrappers model
- */
 namespace Magento\Paypal\Model\Api;
 
 use Magento\Payment\Model\Cart;
 
+/**
+ * NVP API wrappers model
+ */
 class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
 {
     /**#@+
@@ -63,12 +62,19 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
     const RESPONSE_CODE_FRAUD = 126;
     /**#@-*/
 
-    /**#@+
-     * Capture types (make authorization close or remain open)
+    /**
+     * Capture type (make authorization close or remain open)
+     *
+     * @var string
      */
     protected $_captureTypeComplete = 'Y';
+
+    /**
+     * Capture type (make authorization close or remain open)
+     *
+     * @var string
+     */
     protected $_captureTypeNotcomplete = 'N';
-    /**#@-*/
 
     /**
      * Global public interface map
@@ -142,17 +148,17 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
     /**
      * Fields that should be replaced in debug with '***'
      *
-     * @var array
+     * @var string[]
      */
     protected $_debugReplacePrivateDataKeys = array(
         'ACCT', 'EXPDATE', 'CVV2',
         'PARTNER', 'USER', 'VENDOR', 'PWD',
     );
 
-    /**#@+
-     * DoDirectPayment request/response map
+    /**
+     * DoDirectPayment request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_doDirectPaymentRequest = array(
         'ACCT', 'EXPDATE', 'CVV2', 'CURRENCY', 'EMAIL', 'TENDER', 'NOTIFYURL',
@@ -161,87 +167,117 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
         'AUTHSTATUS3DS', 'MPIVENDOR3DS', 'CAVV', 'ECI', 'XID',//cardinal centinel params
         'TAXAMT', 'FREIGHTAMT'
     );
+
+    /**
+     * DoDirectPayment response map
+     *
+     * @var string[]
+     */
     protected $_doDirectPaymentResponse = array(
         'PNREF', 'PAYMENTINFO_0_TRANSACTIONID', 'CORRELATIONID', 'CVV2MATCH', 'AVSADDR', 'AVSZIP', 'PENDINGREASON'
     );
-    /**#@-*/
 
-    /**#@+
-     * DoCapture request/response map
+    /**
+     * DoCapture request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_doCaptureRequest = array('ORIGID', 'CAPTURECOMPLETE', 'AMT', 'TENDER', 'NOTE', 'INVNUM');
+
+    /**
+     * DoCapture response map
+     *
+     * @var string[]
+     */
     protected $_doCaptureResponse = array('PNREF', 'TRANSACTIONID');
-    /**#@-*/
 
     /**
      * DoVoid request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_doVoidRequest = array('ORIGID', 'NOTE', 'TENDER');
 
     /**
      * Request map for each API call
      *
-     * @var array
+     * @var string[]
      */
     protected $_eachCallRequest = array('PARTNER', 'USER', 'VENDOR', 'PWD', 'BUTTONSOURCE');
 
-    /**#@+
-     * RefundTransaction request/response map
+    /**
+     * RefundTransaction request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_refundTransactionRequest = array('ORIGID', 'TENDER');
+
+    /**
+     * RefundTransaction response map
+     *
+     * @var string[]
+     */
     protected $_refundTransactionResponse = array('PNREF', 'REFUNDTRANSACTIONID');
-    /**#@-*/
 
-    /**#@+
-     * SetExpressCheckout request/response map
+    /**
+     * SetExpressCheckout request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_setExpressCheckoutRequest = array(
         'TENDER', 'AMT', 'CURRENCY', 'RETURNURL', 'CANCELURL', 'INVNUM',
         'PAGESTYLE', 'HDRIMG', 'HDRBORDERCOLOR', 'HDRBACKCOLOR', 'PAYFLOWCOLOR', 'LOCALECODE',
     );
+
+    /**
+     * SetExpressCheckout response map
+     *
+     * @var string[]
+     */
     protected $_setExpressCheckoutResponse = array('REPMSG', 'TOKEN');
-    /**#@-*/
 
     /**
      * GetExpressCheckoutDetails request/response map
      *
-     * @var array
+     * @var string[]
      */
     protected $_getExpressCheckoutDetailsRequest = array('TENDER', 'TOKEN');
 
-    /**#@+
-     * DoExpressCheckoutPayment request/response map
+    /**
+     * DoExpressCheckoutPayment request map
      *
-     * @var array
+     * @var string[]
      */
     protected $_doExpressCheckoutPaymentRequest = array(
         'TENDER', 'TOKEN', 'PAYERID', 'AMT', 'CURRENCY', 'CUSTIP', 'BUTTONSOURCE', 'NOTIFYURL',
     );
+
+    /**
+     * DoExpressCheckoutPayment response map
+     *
+     * @var string[]
+     */
     protected $_doExpressCheckoutPaymentResponse = array(
         'PNREF', 'PAYMENTINFO_0_TRANSACTIONID', 'REPMSG', 'AMT', 'PENDINGREASON',
         'CVV2MATCH', 'AVSADDR', 'AVSZIP', 'CORRELATIONID'
     );
-    /**#@-*/
 
-    /**#@+
+    /**
      * GetTransactionDetailsRequest
      *
-     * @var array
+     * @var string[]
      */
     protected $_getTransactionDetailsRequest = array('ORIGID', 'TENDER');
+
+    /**
+     * GetTransactionDetailsResponse
+     *
+     * @var string[]
+     */
     protected $_getTransactionDetailsResponse = array(
         'PAYERID', 'FIRSTNAME', 'LASTNAME', 'TRANSACTIONID',
         'PARENTTRANSACTIONID', 'CURRENCYCODE', 'AMT', 'PAYMENTSTATUS'
     );
-    /**#@-*/
 
     /**
      * Map for shipping address import/export (extends billing address mapper)
@@ -291,7 +327,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
         'country_id' => 'COUNTRY',
     );
 
-    /**#@+
+    /**
      * Line items export mapping settings
      *
      * @var array
@@ -301,23 +337,32 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
         Cart::AMOUNT_SHIPPING    => 'FREIGHTAMT',
     );
 
+    /**
+     * Line items export request totals format
+     *
+     * @var array
+     */
     protected $_lineItemsExportRequestTotalsFormat = array(
         'amount'                 => 'PAYMENTREQUEST_%d_ITEMAMT',
         Cart::AMOUNT_TAX         => 'TAXAMT',
         Cart::AMOUNT_SHIPPING    => 'FREIGHTAMT',
     );
 
+    /**
+     * Line items export items format
+     *
+     * @var array
+     */
     protected $_lineItemExportItemsFormat = array(
         'name'   => 'L_PAYMENTREQUEST_%d_NAME%d',
         'qty'    => 'L_PAYMENTREQUEST_%d_QTY%d',
         'amount' => 'L_PAYMENTREQUEST_%d_AMT%d',
     );
-    /**#@-*/
 
     /**
      * Payment information response specifically to be collected after some requests
      *
-     * @var array
+     * @var string[]
      */
     protected $_paymentInformationResponse = array(
         'PAYERID', 'CORRELATIONID', 'ADDRESSID', 'ADDRESSSTATUS',
@@ -343,7 +388,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
      * @param \Magento\Logger $logger
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Directory\Model\RegionFactory $regionFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Directory\Model\CountryFactory $countryFactory
      * @param \Magento\Math\Random $mathRandom
      * @param array $data
@@ -353,7 +398,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
         \Magento\Logger $logger,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Directory\Model\RegionFactory $regionFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Directory\Model\CountryFactory $countryFactory,
         \Magento\Math\Random $mathRandom,
         array $data = array()
@@ -465,8 +510,8 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
     /**
      * Return Payflow Edition
      *
-     * @param string
-     * @return string | null
+     * @param string $methodName
+     * @return string|null
      */
     protected function _getPayflowActionName($methodName)
     {
@@ -509,7 +554,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
     /**
      * Catch success calls and collect warnings
      *
-     * @param array
+     * @param array $response
      * @return bool success flag
      */
     protected function _isCallSuccessful($response)
@@ -529,6 +574,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
      * Handle logical errors
      *
      * @param array $response
+     * @return void
      * @throws \Magento\Core\Exception
      */
     protected function _handleCallErrors($response)
@@ -567,7 +613,9 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
     }
 
     /**
-     * "GetTransactionDetails" method does not exists in Payflow
+     * GetTransactionDetails method does not exists in Payflow
+     *
+     * @return void
      */
     public function callGetTransactionDetails()
     {
@@ -578,6 +626,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
      *
      * @param array $from
      * @param array $collectedWarnings
+     * @return void
      */
     protected function _importFraudFiltersResult(array $from, array $collectedWarnings)
     {
@@ -592,7 +641,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
      * (PayFlow edition doesn't support Unilateral payments)
      *
      * @param string $methodName Current method name
-     * @return array
+     * @return string[]
      */
     protected function _prepareEachCallRequest($methodName)
     {
@@ -616,6 +665,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
      * Puerto Rico should be as state of USA and not as a country
      *
      * @param array $request
+     * @return void
      */
     protected function _applyCountryWorkarounds(&$request)
     {
@@ -629,7 +679,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
      * Retrieve headers for request.
      * This is a hack to make Payflow work with negative values for items like discount has.
      *
-     * @return array
+     * @return string[]
      */
     protected function _getHeaderListForRequest()
     {
@@ -641,7 +691,6 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
      * Hack to cut off length from API type response params.
      *
      * @param  array $response
-     *
      * @return array
      */
     protected function _postProcessResponse($response)
@@ -670,7 +719,6 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
      *
      * @param array &$request
      * @param int $i
-     *
      * @return bool|null
      */
     protected function _exportLineItems(array &$request, $i = 0)
@@ -682,13 +730,11 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp
      * NVP doesn't support passing discount total as a separate amount - add it as a line item.
      * This is a hack for proper line items display for order at PP EC side using Payflow through API.
      *
-     * @link https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout
-     *
      * @param array &$request
      * @param int $requestNum
      * @param int $itemNum
-     *
      * @return bool|null
+     * @link https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout
      */
     protected function _preparePaymentRequestLineItems(array &$request, $requestNum = 0, $itemNum = 0)
     {
diff --git a/app/code/Magento/Paypal/Model/Api/Standard.php b/app/code/Magento/Paypal/Model/Api/Standard.php
index 4e7cea4487e..cbb73fec709 100644
--- a/app/code/Magento/Paypal/Model/Api/Standard.php
+++ b/app/code/Magento/Paypal/Model/Api/Standard.php
@@ -23,18 +23,18 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
-/**
- * PayPal Standard checkout request API
- */
 namespace Magento\Paypal\Model\Api;
 
 use Magento\Payment\Model\Cart;
 
+/**
+ * PayPal Standard checkout request API
+ */
 class Standard extends \Magento\Paypal\Model\Api\AbstractApi
 {
     /**
-     * Global interface map and export filters
+     * Global interface map
+     *
      * @var array
      */
     protected $_globalMap = array(
@@ -60,9 +60,15 @@ class Standard extends \Magento\Paypal\Model\Api\AbstractApi
         'cpp_headerback_color'   => 'hdrbackcolor',
         'cpp_headerborder_color' => 'hdrbordercolor',
         'cpp_payflow_color'      => 'payflowcolor',
-//        'cs' => '', // TODO
+        // 'cs' => '', // TODO
         'lc'                     => 'locale',
     );
+
+    /**
+     * Export filters
+     *
+     * @var array
+     */
     protected $_exportToRequestFilters = array(
         'amount'   => '_filterAmount',
         'shipping' => '_filterAmount',
@@ -72,7 +78,8 @@ class Standard extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * Interface for common and "aggregated order" specific fields
-     * @var array
+     *
+     * @var string[]
      */
     protected $_commonRequestFields = array(
         'business', 'invoice', 'currency_code', 'paymentaction', 'return', 'cancel_return', 'notify_url', 'bn',
@@ -83,7 +90,7 @@ class Standard extends \Magento\Paypal\Model\Api\AbstractApi
     /**
      * Fields that should be replaced in debug with '***'
      *
-     * @var array
+     * @var string[]
      */
     protected $_debugReplacePrivateDataKeys = array('business');
 
@@ -118,6 +125,7 @@ class Standard extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * Address export to request map
+     *
      * @var array
      */
     protected $_addressMap = array(
@@ -136,6 +144,8 @@ class Standard extends \Magento\Paypal\Model\Api\AbstractApi
      * Generate PayPal Standard checkout request fields
      * Depending on whether there are cart line items set, will aggregate everything or display items specifically
      * Shipping amount in cart line items is implemented as a separate "fake" line item
+     *
+     * @return array
      */
     public function getStandardCheckoutRequest()
     {
@@ -169,6 +179,7 @@ class Standard extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * Merchant account email getter
+     *
      * @return string
      */
     public function getBusinessAccount()
@@ -178,6 +189,7 @@ class Standard extends \Magento\Paypal\Model\Api\AbstractApi
 
     /**
      * Payment action getter
+     *
      * @return string
      */
     public function getPaymentAction()
@@ -209,6 +221,7 @@ class Standard extends \Magento\Paypal\Model\Api\AbstractApi
      * Import address object, if set, to the request
      *
      * @param array $request
+     * @return void
      */
     protected function _importAddress(&$request)
     {
@@ -245,6 +258,7 @@ class Standard extends \Magento\Paypal\Model\Api\AbstractApi
      * Puerto Rico should be as state of USA and not as a country
      *
      * @param array $request
+     * @return void
      */
     protected function _applyCountryWorkarounds(&$request)
     {
diff --git a/app/code/Magento/Paypal/Model/Billing/AbstractAgreement.php b/app/code/Magento/Paypal/Model/Billing/AbstractAgreement.php
index ad8f0d14336..06afe734e67 100644
--- a/app/code/Magento/Paypal/Model/Billing/AbstractAgreement.php
+++ b/app/code/Magento/Paypal/Model/Billing/AbstractAgreement.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Billing;
 
 /**
  * Billing Agreement abstaract class
  */
-namespace Magento\Paypal\Model\Billing;
-
 abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel
 {
     /**
@@ -45,25 +44,21 @@ abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel
 
     /**
      * Init billing agreement
-     *
      */
     abstract public function initToken();
 
     /**
      * Verify billing agreement details
-     *
      */
     abstract public function verifyToken();
 
     /**
      * Create billing agreement
-     *
      */
     abstract public function place();
 
     /**
      * Cancel billing agreement
-     *
      */
     abstract public function cancel();
 
@@ -75,16 +70,16 @@ abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel
     protected $_paymentData = null;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Paypal/Model/Billing/Agreement.php b/app/code/Magento/Paypal/Model/Billing/Agreement.php
index e8c1ef949ff..8940d7bd247 100644
--- a/app/code/Magento/Paypal/Model/Billing/Agreement.php
+++ b/app/code/Magento/Paypal/Model/Billing/Agreement.php
@@ -21,9 +21,10 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Paypal\Model\Billing;
 
+use Magento\Sales\Model\Order\Payment;
+
 /**
  * Billing Agreement abstract model
  *
@@ -69,8 +70,8 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement
     protected $_dateFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Paypal\Model\Resource\Billing\Agreement\CollectionFactory $billingAgreementFactory
      * @param \Magento\Core\Model\DateFactory $dateFactory
@@ -79,8 +80,8 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Paypal\Model\Resource\Billing\Agreement\CollectionFactory $billingAgreementFactory,
         \Magento\Core\Model\DateFactory $dateFactory,
@@ -95,6 +96,8 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement
 
     /**
      * Init model
+     *
+     * @return void
      */
     protected function _construct()
     {
@@ -163,7 +166,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement
      * Get billing agreement details
      * Data from response is inside this object
      *
-     * @return \Magento\Paypal\Model\Billing\Agreement
+     * @return $this
      */
     public function verifyToken()
     {
@@ -175,7 +178,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement
     /**
      * Create billing agreement
      *
-     * @return \Magento\Paypal\Model\Billing\Agreement
+     * @return $this
      */
     public function place()
     {
@@ -196,7 +199,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement
     /**
      * Cancel billing agreement
      *
-     * @return \Magento\Paypal\Model\Billing\Agreement
+     * @return $this
      */
     public function cancel()
     {
@@ -252,10 +255,10 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement
      *  [billing_agreement_id]  => string
      *  [method_code]           => string
      *
-     * @param \Magento\Sales\Model\Order\Payment $payment
-     * @return \Magento\Paypal\Model\Billing\Agreement
+     * @param Payment $payment
+     * @return $this
      */
-    public function importOrderPayment(\Magento\Sales\Model\Order\Payment $payment)
+    public function importOrderPayment(Payment $payment)
     {
         $baData = $payment->getBillingAgreementData();
 
@@ -302,7 +305,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement
      * Add order relation to current billing agreement
      *
      * @param int|\Magento\Sales\Model\Order $orderId
-     * @return \Magento\Paypal\Model\Billing\Agreement
+     * @return $this
      */
     public function addOrderRelation($orderId)
     {
@@ -312,6 +315,8 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement
 
     /**
      * Save related orders
+     *
+     * @return void
      */
     protected function _saveOrderRelations()
     {
diff --git a/app/code/Magento/Paypal/Model/Billing/Agreement/MethodInterface.php b/app/code/Magento/Paypal/Model/Billing/Agreement/MethodInterface.php
index 496ad405c1c..78203707c42 100644
--- a/app/code/Magento/Paypal/Model/Billing/Agreement/MethodInterface.php
+++ b/app/code/Magento/Paypal/Model/Billing/Agreement/MethodInterface.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Billing\Agreement;
 
 /**
  * Interface for payment methods that support billing agreements management
  */
-namespace Magento\Paypal\Model\Billing\Agreement;
-
 interface MethodInterface
 {
     /**
diff --git a/app/code/Magento/Paypal/Model/Billing/Agreement/OrdersUpdater.php b/app/code/Magento/Paypal/Model/Billing/Agreement/OrdersUpdater.php
index 05777db75dc..b31a6ba523d 100644
--- a/app/code/Magento/Paypal/Model/Billing/Agreement/OrdersUpdater.php
+++ b/app/code/Magento/Paypal/Model/Billing/Agreement/OrdersUpdater.php
@@ -21,16 +21,15 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Billing\Agreement;
 
 /**
  * Orders grid massaction items updater
  */
-namespace Magento\Paypal\Model\Billing\Agreement;
-
 class OrdersUpdater implements \Magento\View\Layout\Argument\UpdaterInterface
 {
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registryManager;
 
@@ -40,21 +39,21 @@ class OrdersUpdater implements \Magento\View\Layout\Argument\UpdaterInterface
     protected $_agreementResource;
 
     /**
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Paypal\Model\Resource\Billing\Agreement $agreementResource
      * @param array $data
      * @throws \InvalidArgumentException
      */
     public function __construct(
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Paypal\Model\Resource\Billing\Agreement $agreementResource,
         array $data = array()
     ) {
         $this->_registryManager = isset($data['registry']) ? $data['registry'] : $coreRegistry;
         $this->_agreementResource = $agreementResource;
 
-        if (false === ($this->_registryManager instanceof \Magento\Core\Model\Registry)) {
-            throw new \InvalidArgumentException('registry object has to be an instance of \Magento\Core\Model\Registry');
+        if (false === ($this->_registryManager instanceof \Magento\Registry)) {
+            throw new \InvalidArgumentException('registry object has to be an instance of \Magento\Registry');
         }
     }
 
@@ -62,7 +61,6 @@ class OrdersUpdater implements \Magento\View\Layout\Argument\UpdaterInterface
      * Add billing agreement filter
      *
      * @param mixed $argument
-     * @throws \DomainException
      * @return mixed
      * @throws \DomainException
      */
diff --git a/app/code/Magento/Paypal/Model/Cart.php b/app/code/Magento/Paypal/Model/Cart.php
index fd7cae4ad44..098e6c475b9 100644
--- a/app/code/Magento/Paypal/Model/Cart.php
+++ b/app/code/Magento/Paypal/Model/Cart.php
@@ -23,13 +23,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model;
 
 /**
  * PayPal-specific model for shopping cart items and totals
  * The main idea is to accommodate all possible totals into PayPal-compatible 4 totals and line items
  */
-namespace Magento\Paypal\Model;
-
 class Cart extends \Magento\Payment\Model\Cart
 {
     /**
@@ -67,6 +66,8 @@ class Cart extends \Magento\Payment\Model\Cart
 
     /**
      * Calculate subtotal from custom items
+     *
+     * @return void
      */
     protected function _calculateCustomItemsSubtotal()
     {
@@ -78,6 +79,8 @@ class Cart extends \Magento\Payment\Model\Cart
 
     /**
      * Check the line items and totals according to PayPal business logic limitations
+     *
+     * @return void
      */
     protected function _validate()
     {
@@ -124,6 +127,8 @@ class Cart extends \Magento\Payment\Model\Cart
 
     /**
      * Import items from sales model with workarounds for PayPal
+     *
+     * @return void
      */
     protected function _importItemsFromSalesModel()
     {
@@ -184,6 +189,7 @@ class Cart extends \Magento\Payment\Model\Cart
      * - go to PayPal
      *
      * @param \Magento\Payment\Model\Cart\SalesModel\SalesModelInterface $salesEntity
+     * @return void
      */
     protected function _applyHiddenTaxWorkaround(\Magento\Payment\Model\Cart\SalesModel\SalesModelInterface $salesEntity)
     {
diff --git a/app/code/Magento/Paypal/Model/Cert.php b/app/code/Magento/Paypal/Model/Cert.php
index af12fbe703f..ab4edd8acc5 100644
--- a/app/code/Magento/Paypal/Model/Cert.php
+++ b/app/code/Magento/Paypal/Model/Cert.php
@@ -23,14 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
-/**
- * PayPal specific model for certificate based authentication
- */
 namespace Magento\Paypal\Model;
 
 use Magento\Filesystem\Directory\WriteInterface;
 
+/**
+ * PayPal specific model for certificate based authentication
+ */
 class Cert extends \Magento\Core\Model\AbstractModel
 {
     /**
@@ -49,8 +48,8 @@ class Cert extends \Magento\Core\Model\AbstractModel
     protected $encryptor;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\App\Filesystem $filesystem
      * @param \Magento\Encryption\EncryptorInterface $encryptor
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -58,8 +57,8 @@ class Cert extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\App\Filesystem $filesystem,
         \Magento\Encryption\EncryptorInterface $encryptor,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
@@ -73,6 +72,8 @@ class Cert extends \Magento\Core\Model\AbstractModel
 
     /**
      * Initialize resource model
+     *
+     * @return void
      */
     protected function _construct()
     {
@@ -84,7 +85,7 @@ class Cert extends \Magento\Core\Model\AbstractModel
      *
      * @param int $websiteId
      * @param bool $strictLoad
-     * @return \Magento\Paypal\Model\Cert
+     * @return $this
      */
     public function loadByWebsite($websiteId, $strictLoad = true)
     {
@@ -118,6 +119,7 @@ class Cert extends \Magento\Core\Model\AbstractModel
      * Create physical certificate file based on DB data
      *
      * @param string $file
+     * @return void
      */
     protected function _createCertFile($file)
     {
@@ -144,7 +146,7 @@ class Cert extends \Magento\Core\Model\AbstractModel
     /**
      * Delete assigned certificate file after delete object
      *
-     * @return \Magento\Paypal\Model\Cert
+     * @return $this
      */
     protected function _afterDelete()
     {
diff --git a/app/code/Magento/Paypal/Model/Config.php b/app/code/Magento/Paypal/Model/Config.php
index dacf58046d6..3947d8af57f 100644
--- a/app/code/Magento/Paypal/Model/Config.php
+++ b/app/code/Magento/Paypal/Model/Config.php
@@ -23,13 +23,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model;
 
 /**
  * Config model that is aware of all \Magento\Paypal payment methods
  * Works with PayPal-specific system configuration
  */
-namespace Magento\Paypal\Model;
-
 class Config
 {
     /**
@@ -197,7 +196,7 @@ class Config
     /**
      * Currency codes supported by PayPal methods
      *
-     * @var array
+     * @var string[]
      */
     protected $_supportedCurrencyCodes = array('AUD', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'JPY', 'MXN',
         'NOK', 'NZD', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'USD', 'TWD', 'THB');
@@ -205,7 +204,7 @@ class Config
     /**
      * Merchant country supported by PayPal
      *
-     * @var array
+     * @var string[]
      */
     protected $_supportedCountryCodes = array(
         'AE','AR','AT','AU','BE','BG','BR','CA','CH','CL','CR','CY','CZ','DE','DK','DO','EC','EE','ES','FI','FR','GB',
@@ -215,7 +214,7 @@ class Config
     /**
      * Buyer country supported by PayPal
      *
-     * @var array
+     * @var string[]
      */
     protected $_supportedBuyerCountryCodes = array(
         'AF ', 'AX ', 'AL ', 'DZ ', 'AS ', 'AD ', 'AO ', 'AI ', 'AQ ', 'AG ', 'AR ', 'AM ', 'AW ', 'AU ', 'AT ', 'AZ ',
@@ -239,7 +238,7 @@ class Config
     /**
      * Locale codes supported by misc images (marks, shortcuts etc)
      *
-     * @var array
+     * @var string[]
      * @link https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECButtonIntegration#id089QD0O0TX4__id08AH904I0YK
      */
     protected $_supportedImageLocales = array('de_DE', 'en_AU', 'en_GB', 'en_US', 'es_ES', 'es_XC', 'fr_FR',
@@ -310,7 +309,7 @@ class Config
      * Method code setter
      *
      * @param string|\Magento\Payment\Model\Method\AbstractMethod $method
-     * @return \Magento\Paypal\Model\Config
+     * @return $this
      */
     public function setMethod($method)
     {
@@ -336,7 +335,7 @@ class Config
      * Store ID setter
      *
      * @param int $storeId
-     * @return \Magento\Paypal\Model\Config
+     * @return $this
      */
     public function setStoreId($storeId)
     {
@@ -455,8 +454,7 @@ class Config
         if ($key == 'payment_action'
             && $value != self::PAYMENT_ACTION_SALE
             && $this->_methodCode == self::METHOD_WPP_EXPRESS
-            && $this->shouldUseUnilateralPayments())
-        {
+            && $this->shouldUseUnilateralPayments()) {
             return self::PAYMENT_ACTION_SALE;
         }
         return $value;
@@ -465,7 +463,7 @@ class Config
     /**
      * Return merchant country codes supported by PayPal
      *
-     * @return array
+     * @return string[]
      */
     public function getSupportedMerchantCountryCodes()
     {
@@ -475,7 +473,7 @@ class Config
     /**
      * Return buyer country codes supported by PayPal
      *
-     * @return array
+     * @return string[]
      */
     public function getSupportedBuyerCountryCodes()
     {
@@ -518,7 +516,7 @@ class Config
     /**
      * Return list of allowed methods for specified country iso code
      *
-     * @param string $countryCode 2-letters iso code
+     * @param string|null $countryCode 2-letters iso code
      * @return array
      */
     public function getCountryMethods($countryCode = null)
@@ -664,7 +662,7 @@ class Config
         ));
     }
 
-     /**
+    /**
      * PayPal web URL generic getter
      *
      * @param array $params
@@ -693,8 +691,8 @@ class Config
      * PayPal will ignore "pal", if there is no total amount specified
      *
      * @param string $localeCode
-     * @param float $orderTotal
-     * @param string $pal encrypted summary about merchant
+     * @param float|null $orderTotal
+     * @param string|null $pal encrypted summary about merchant
      * @return string
      * @see Paypal_Model_Api_Nvp::callGetPalDetails()
      */
@@ -716,9 +714,9 @@ class Config
      * $staticSize is applicable for static images only
      *
      * @param string $localeCode
-     * @param float $orderTotal
-     * @param string $pal
-     * @param string $staticSize
+     * @param float|null $orderTotal
+     * @param string|null $pal
+     * @param string|null $staticSize
      * @return string
      */
     public function getPaymentMarkImageUrl($localeCode, $orderTotal = null, $pal = null, $staticSize = null)
@@ -747,7 +745,7 @@ class Config
      * Get "What Is PayPal" localized URL
      * Supposed to be used with "mark" as popup window
      *
-     * @param \Magento\Core\Model\LocaleInterface $locale
+     * @param \Magento\Core\Model\LocaleInterface|null $locale
      * @return string
      */
     public function getPaymentMarkWhatIsPaypalUrl(\Magento\Core\Model\LocaleInterface $locale = null)
@@ -871,7 +869,7 @@ class Config
     /**
      * BN code getter
      *
-     * @param string $countryCode ISO 3166-1
+     * @param string|null $countryCode ISO 3166-1
      * @return string
      */
     public function getBuildNotationCode($countryCode = null)
@@ -1127,6 +1125,7 @@ class Config
      * Export page style current settings to specified object
      *
      * @param \Magento\Object $to
+     * @return void
      */
     public function exportExpressCheckoutStyleSettings(\Magento\Object $to)
     {
@@ -1168,7 +1167,7 @@ class Config
     /**
      * Check whether specified locale code is supported. Fallback to en_US
      *
-     * @param string $localeCode
+     * @param string|null $localeCode
      * @return string
      */
     protected function _getSupportedLocaleCode($localeCode = null)
@@ -1235,7 +1234,7 @@ class Config
     /**
      * Check wheter specified country code is supported by build notation codes for specific countries
      *
-     * @param $code
+     * @param string $code
      * @return string|null
      */
     private function _matchBnCountryCode($code)
diff --git a/app/code/Magento/Paypal/Model/Config/Factory.php b/app/code/Magento/Paypal/Model/Config/Factory.php
index db957e6e582..77968a84d28 100644
--- a/app/code/Magento/Paypal/Model/Config/Factory.php
+++ b/app/code/Magento/Paypal/Model/Config/Factory.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Config;
 
 /**
  * Factory class for payment config
  */
-namespace Magento\Paypal\Model\Config;
-
 class Factory
 {
     /**
diff --git a/app/code/Magento/Paypal/Model/Direct.php b/app/code/Magento/Paypal/Model/Direct.php
index 1871b9e74a1..865ab76d76e 100644
--- a/app/code/Magento/Paypal/Model/Direct.php
+++ b/app/code/Magento/Paypal/Model/Direct.php
@@ -23,12 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model;
+
+use Magento\Sales\Model\Order\Payment;
 
 /**
  * PayPal Direct Module
  */
-namespace Magento\Paypal\Model;
-
 class Direct extends \Magento\Payment\Model\Method\Cc
 {
     /**
@@ -41,22 +42,87 @@ class Direct extends \Magento\Payment\Model\Method\Cc
      */
     protected $_infoBlockType = 'Magento\Paypal\Block\Payment\Info';
 
-    /**#@+
-     * Availability options
+    /**
+     * Availability option
+     *
+     * @var bool
      */
     protected $_isGateway               = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canAuthorize            = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canCapture              = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canCapturePartial       = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canRefund               = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canRefundInvoicePartial = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canVoid                 = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canUseInternal          = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canUseCheckout          = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canSaveCc = false;
+
+    /**
+     * @var bool
+     */
     protected $_canFetchTransactionInfo = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canReviewPayment        = true;
-    /**#@-*/
 
     /**
      * Website Payments Pro instance
@@ -101,7 +167,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Logger $logger
      * @param \Magento\Module\ModuleListInterface $moduleList
      * @param \Magento\Core\Model\LocaleInterface $locale
@@ -112,14 +178,14 @@ class Direct extends \Magento\Payment\Model\Method\Cc
      * @param \Magento\App\RequestInterface $requestHttp
      * @param \Magento\Paypal\Model\CartFactory $cartFactory
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Logger $logger,
         \Magento\Module\ModuleListInterface $moduleList,
         \Magento\Core\Model\LocaleInterface $locale,
@@ -216,7 +282,8 @@ class Direct extends \Magento\Payment\Model\Method\Cc
 
     /**
      * Check whether payment method can be used
-     * @param \Magento\Sales\Model\Quote
+     *
+     * @param \Magento\Sales\Model\Quote|null $quote
      * @return bool
      */
     public function isAvailable($quote = null)
@@ -231,8 +298,8 @@ class Direct extends \Magento\Payment\Model\Method\Cc
      * Custom getter for payment configuration
      *
      * @param string $field
-     * @param int $storeId
-     * @return mixed
+     * @param int|null $storeId
+     * @return null|string
      */
     public function getConfigData($field, $storeId = null)
     {
@@ -251,9 +318,9 @@ class Direct extends \Magento\Payment\Model\Method\Cc
     /**
      * Authorize payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Direct
+     * @return $this
      */
     public function authorize(\Magento\Object $payment, $amount)
     {
@@ -263,8 +330,8 @@ class Direct extends \Magento\Payment\Model\Method\Cc
     /**
      * Void payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
-     * @return \Magento\Paypal\Model\Direct
+     * @param \Magento\Object|Payment $payment
+     * @return $this
      */
     public function void(\Magento\Object $payment)
     {
@@ -275,9 +342,9 @@ class Direct extends \Magento\Payment\Model\Method\Cc
     /**
      * Capture payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Direct
+     * @return $this
      */
     public function capture(\Magento\Object $payment, $amount)
     {
@@ -290,9 +357,9 @@ class Direct extends \Magento\Payment\Model\Method\Cc
     /**
      * Refund capture
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Direct
+     * @return $this
      */
     public function refund(\Magento\Object $payment, $amount)
     {
@@ -303,8 +370,8 @@ class Direct extends \Magento\Payment\Model\Method\Cc
     /**
      * Cancel payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
-     * @return \Magento\Paypal\Model\Direct
+     * @param \Magento\Object|Payment $payment
+     * @return $this
      */
     public function cancel(\Magento\Object $payment)
     {
@@ -316,7 +383,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc
     /**
      * Whether payment can be reviewed
      *
-     * @param \Magento\Payment\Model\Info|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Payment\Model\Info|Payment $payment
      * @return bool
      */
     public function canReviewPayment(\Magento\Payment\Model\Info $payment)
@@ -327,7 +394,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc
     /**
      * Attempt to accept a pending payment
      *
-     * @param \Magento\Payment\Model\Info|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Payment\Model\Info|Payment $payment
      * @return bool
      */
     public function acceptPayment(\Magento\Payment\Model\Info $payment)
@@ -339,7 +406,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc
     /**
      * Attempt to deny a pending payment
      *
-     * @param \Magento\Payment\Model\Info|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Payment\Model\Info|Payment $payment
      * @return bool
      */
     public function denyPayment(\Magento\Payment\Model\Info $payment)
@@ -377,11 +444,11 @@ class Direct extends \Magento\Payment\Model\Method\Cc
     /**
      * Place an order with authorization or capture action
      *
-     * @param \Magento\Sales\Model\Order\Payment $payment
+     * @param Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Direct
+     * @return $this
      */
-    protected function _placeOrder(\Magento\Sales\Model\Order\Payment $payment, $amount)
+    protected function _placeOrder(Payment $payment, $amount)
     {
         $order = $payment->getOrder();
         $api = $this->_pro->getApi()
@@ -454,8 +521,9 @@ class Direct extends \Magento\Payment\Model\Method\Cc
     /**
      * Import direct payment results to payment
      *
-     * @param \Magento\Paypal\Model\Api\Nvp
-     * @param \Magento\Sales\Model\Order\Payment
+     * @param \Magento\Paypal\Model\Api\Nvp $api
+     * @param Payment $payment
+     * @return void
      */
     protected function _importResultToPayment($api, $payment)
     {
@@ -466,8 +534,8 @@ class Direct extends \Magento\Payment\Model\Method\Cc
     /**
      * Check void availability
      *
-     * @param   \Magento\Object $payment
-     * @return  bool
+     * @param \Magento\Object $payment
+     * @return bool
      */
     public function canVoid(\Magento\Object $payment)
     {
diff --git a/app/code/Magento/Paypal/Model/Express.php b/app/code/Magento/Paypal/Model/Express.php
index 10f460e45bf..f4ca80fd5e1 100644
--- a/app/code/Magento/Paypal/Model/Express.php
+++ b/app/code/Magento/Paypal/Model/Express.php
@@ -23,12 +23,17 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model;
+
+use Magento\Paypal\Model\Api\Nvp;
+use Magento\RecurringProfile\Model\RecurringProfile;
+use Magento\Sales\Model\Order\Payment;
+use Magento\Sales\Model\Order\Payment\Transaction;
+use Magento\Sales\Model\Quote;
 
 /**
  * PayPal Express Module
  */
-namespace Magento\Paypal\Model;
-
 class Express extends \Magento\Payment\Model\Method\AbstractMethod
     implements \Magento\Payment\Model\Recurring\Profile\MethodInterface
 {
@@ -55,19 +60,87 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     protected $_proType = 'Magento\Paypal\Model\Pro';
 
     /**
-     * Availability options
+     * Availability option
+     *
+     * @var bool
      */
     protected $_isGateway                   = false;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canOrder                    = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canAuthorize                = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canCapture                  = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canCapturePartial           = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canRefund                   = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canRefundInvoicePartial     = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canVoid                     = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canUseInternal              = false;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canUseCheckout              = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canFetchTransactionInfo     = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canReviewPayment            = true;
 
     /**
@@ -79,6 +152,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
 
     /**
      * Payment additional information key for payment action
+     *
      * @var string
      */
     protected $_isOrderPaymentActionKey = 'is_order_action';
@@ -114,7 +188,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\UrlInterface $urlBuilder
@@ -125,7 +199,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\UrlInterface $urlBuilder,
@@ -170,20 +244,20 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
         return $this;
     }
 
-   /**
-    * Can be used in regular checkout
-    *
-    * @return bool
-    */
-   public function canUseCheckout()
-   {
-       if ($this->_coreStoreConfig->getConfigFlag('payment/hosted_pro/active')
-           && !$this->_coreStoreConfig->getConfigFlag('payment/hosted_pro/display_ec')
-       ) {
-           return false;
-       }
-       return parent::canUseCheckout();
-   }
+    /**
+     * Can be used in regular checkout
+     *
+     * @return bool
+     */
+    public function canUseCheckout()
+    {
+        if ($this->_coreStoreConfig->getConfigFlag('payment/hosted_pro/active')
+            && !$this->_coreStoreConfig->getConfigFlag('payment/hosted_pro/display_ec')
+        ) {
+            return false;
+        }
+        return parent::canUseCheckout();
+    }
 
     /**
      * Whether method is available for specified currency
@@ -209,7 +283,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
 
     /**
      * Check whether payment method can be used
-     * @param \Magento\Sales\Model\Quote
+     * @param Quote|null $quote
      * @return bool
      */
     public function isAvailable($quote = null)
@@ -224,7 +298,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
      * Custom getter for payment configuration
      *
      * @param string $field
-     * @param int $storeId
+     * @param int|null $storeId
      * @return mixed
      */
     public function getConfigData($field, $storeId = null)
@@ -235,9 +309,9 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Order payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Express
+     * @return $this
      */
     public function order(\Magento\Object $payment, $amount)
     {
@@ -265,7 +339,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
             $message = __('Ordered amount of %1', $formattedPrice);
         }
 
-        $payment->addTransaction(\Magento\Sales\Model\Order\Payment\Transaction::TYPE_ORDER, null, false, $message);
+        $payment->addTransaction(Transaction::TYPE_ORDER, null, false, $message);
 
         $this->_pro->importPaymentInfo($api, $payment);
 
@@ -287,7 +361,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
         $payment->setTransactionId($api->getTransactionId());
         $payment->setParentTransactionId($orderTransactionId);
 
-        $payment->addTransaction(\Magento\Sales\Model\Order\Payment\Transaction::TYPE_AUTH, null, false,
+        $payment->addTransaction(Transaction::TYPE_AUTH, null, false,
             $message
         );
 
@@ -300,9 +374,9 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Authorize payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Express
+     * @return $this
      */
     public function authorize(\Magento\Object $payment, $amount)
     {
@@ -312,8 +386,8 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Void payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
-     * @return \Magento\Paypal\Model\Express
+     * @param \Magento\Object|Payment $payment
+     * @return $this
      */
     public function void(\Magento\Object $payment)
     {
@@ -322,7 +396,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
             && !$payment->getVoidOnlyAuthorization()
         ) {
             $orderTransaction = $payment->lookupTransaction(
-                false, \Magento\Sales\Model\Order\Payment\Transaction::TYPE_ORDER
+                false, Transaction::TYPE_ORDER
             );
             if ($orderTransaction) {
                 $payment->setParentTransactionId($orderTransaction->getTxnId());
@@ -336,10 +410,10 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Capture payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
      * @throws \Magento\Core\Exception
-     * @return \Magento\Paypal\Model\Express
+     * @return $this
      */
     public function capture(\Magento\Object $payment, $amount)
     {
@@ -397,7 +471,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
                 }
 
                 $transaction = $payment->addTransaction(
-                    \Magento\Sales\Model\Order\Payment\Transaction::TYPE_AUTH,
+                    Transaction::TYPE_AUTH,
                     null,
                     true,
                     $message
@@ -409,7 +483,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
             //close order transaction if needed
             if ($payment->getShouldCloseParentTransaction()) {
                 $orderTransaction = $payment->lookupTransaction(
-                    false, \Magento\Sales\Model\Order\Payment\Transaction::TYPE_ORDER
+                    false, Transaction::TYPE_ORDER
                 );
 
                 if ($orderTransaction) {
@@ -433,9 +507,9 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Refund capture
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Express
+     * @return $this
      */
     public function refund(\Magento\Object $payment, $amount)
     {
@@ -446,8 +520,8 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Cancel payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
-     * @return \Magento\Paypal\Model\Express
+     * @param \Magento\Object|Payment $payment
+     * @return $this
      */
     public function cancel(\Magento\Object $payment)
     {
@@ -459,7 +533,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Whether payment can be reviewed
      *
-     * @param \Magento\Payment\Model\Info|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Payment\Model\Info|Payment $payment
      * @return bool
      */
     public function canReviewPayment(\Magento\Payment\Model\Info $payment)
@@ -470,7 +544,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Attempt to accept a pending payment
      *
-     * @param \Magento\Payment\Model\Info|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Payment\Model\Info|Payment $payment
      * @return bool
      */
     public function acceptPayment(\Magento\Payment\Model\Info $payment)
@@ -482,7 +556,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Attempt to deny a pending payment
      *
-     * @param \Magento\Payment\Model\Info|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Payment\Model\Info|Payment $payment
      * @return bool
      */
     public function denyPayment(\Magento\Payment\Model\Info $payment)
@@ -495,7 +569,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
      * Checkout redirect URL getter for onepage checkout (hardcode)
      *
      * @see \Magento\Checkout\Controller\Onepage::savePaymentAction()
-     * @see \Magento\Sales\Model\Quote\Payment::getCheckoutRedirectUrl()
+     * @see Quote\Payment::getCheckoutRedirectUrl()
      * @return string
      */
     public function getCheckoutRedirectUrl()
@@ -518,9 +592,10 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Validate RP data
      *
-     * @param \Magento\RecurringProfile\Model\RecurringProfile $profile
+     * @param RecurringProfile $profile
+     * @return null
      */
-    public function validateRecurringProfile(\Magento\RecurringProfile\Model\RecurringProfile $profile)
+    public function validateRecurringProfile(RecurringProfile $profile)
     {
         return $this->_pro->validateRecurringProfile($profile);
     }
@@ -528,10 +603,11 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Submit RP to the gateway
      *
-     * @param \Magento\RecurringProfile\Model\RecurringProfile $profile
+     * @param RecurringProfile $profile
      * @param \Magento\Payment\Model\Info $paymentInfo
+     * @return void
      */
-    public function submitRecurringProfile(\Magento\RecurringProfile\Model\RecurringProfile $profile,
+    public function submitRecurringProfile(RecurringProfile $profile,
         \Magento\Payment\Model\Info $paymentInfo
     ) {
         $token = $paymentInfo->getAdditionalInformation(
@@ -546,6 +622,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
      *
      * @param string $referenceId
      * @param \Magento\Object $result
+     * @return null
      */
     public function getRecurringProfileDetails($referenceId, \Magento\Object $result)
     {
@@ -554,6 +631,8 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
 
     /**
      * Whether can get recurring profile details
+     *
+     * @return true
      */
     public function canGetRecurringProfileDetails()
     {
@@ -563,9 +642,10 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Update RP data
      *
-     * @param \Magento\RecurringProfile\Model\RecurringProfile $profile
+     * @param RecurringProfile $profile
+     * @return null
      */
-    public function updateRecurringProfile(\Magento\RecurringProfile\Model\RecurringProfile $profile)
+    public function updateRecurringProfile(RecurringProfile $profile)
     {
         return $this->_pro->updateRecurringProfile($profile);
     }
@@ -573,9 +653,10 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Manage status
      *
-     * @param \Magento\RecurringProfile\Model\RecurringProfile $profile
+     * @param RecurringProfile $profile
+     * @return null
      */
-    public function updateRecurringProfileStatus(\Magento\RecurringProfile\Model\RecurringProfile $profile)
+    public function updateRecurringProfileStatus(RecurringProfile $profile)
     {
         return $this->_pro->updateRecurringProfileStatus($profile);
     }
@@ -583,8 +664,8 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Assign data to info model instance
      *
-     * @param   mixed $data
-     * @return  \Magento\Payment\Model\Info
+     * @param array|\Magento\Object $data
+     * @return \Magento\Payment\Model\Info
      */
     public function assignData($data)
     {
@@ -592,8 +673,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
         $key = \Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT;
         if (is_array($data)) {
             $this->getInfoInstance()->setAdditionalInformation($key, isset($data[$key]) ? $data[$key] : null);
-        }
-        elseif ($data instanceof \Magento\Object) {
+        } elseif ($data instanceof \Magento\Object) {
             $this->getInfoInstance()->setAdditionalInformation($key, $data->getData($key));
         }
         return $result;
@@ -602,11 +682,11 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Place an order with authorization or capture action
      *
-     * @param \Magento\Sales\Model\Order\Payment $payment
+     * @param Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Express
+     * @return $this
      */
-    protected function _placeOrder(\Magento\Sales\Model\Order\Payment $payment, $amount)
+    protected function _placeOrder(Payment $payment, $amount)
     {
         $order = $payment->getOrder();
 
@@ -643,8 +723,9 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Import payment info to payment
      *
-     * @param \Magento\Paypal\Model\Api\Nvp
-     * @param \Magento\Sales\Model\Order\Payment
+     * @param Nvp $api
+     * @param Payment $payment
+     * @return void
      */
     protected function _importToPayment($api, $payment)
     {
@@ -665,8 +746,8 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Check void availability
      *
-     * @param   \Magento\Object $payment
-     * @return  bool
+     * @param \Magento\Object $payment
+     * @return bool
      */
     public function canVoid(\Magento\Object $payment)
     {
@@ -678,7 +759,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
         $info = $this->getInfoInstance();
         if ($info->getAdditionalInformation($this->_isOrderPaymentActionKey)) {
             $orderTransaction = $info->lookupTransaction(
-                false, \Magento\Sales\Model\Order\Payment\Transaction::TYPE_ORDER);
+                false, Transaction::TYPE_ORDER);
             if ($orderTransaction) {
                 $info->setParentTransactionId($orderTransaction->getTxnId());
             }
@@ -699,7 +780,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
 
         if ($payment->getAdditionalInformation($this->_isOrderPaymentActionKey)) {
             $orderTransaction = $payment->lookupTransaction(false,
-                \Magento\Sales\Model\Order\Payment\Transaction::TYPE_ORDER);
+                Transaction::TYPE_ORDER);
             if ($orderTransaction->getIsClosed()) {
                 return false;
             }
@@ -742,11 +823,11 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Check transaction for expiration in PST
      *
-     * @param \Magento\Sales\Model\Order\Payment\Transaction $transaction
+     * @param Transaction $transaction
      * @param int $period
-     * @return boolean
+     * @return bool
      */
-    protected function _isTransactionExpired(\Magento\Sales\Model\Order\Payment\Transaction $transaction, $period)
+    protected function _isTransactionExpired(Transaction $transaction, $period)
     {
         $period = intval($period);
         if (0 == $period) {
diff --git a/app/code/Magento/Paypal/Model/Express/Checkout.php b/app/code/Magento/Paypal/Model/Express/Checkout.php
index 485d103380f..6f4090499c3 100644
--- a/app/code/Magento/Paypal/Model/Express/Checkout.php
+++ b/app/code/Magento/Paypal/Model/Express/Checkout.php
@@ -23,13 +23,15 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Express;
+
+use Magento\Sales\Model\Quote\Address;
+use Magento\Customer\Model\Customer;
 
 /**
  * Wrapper that performs Paypal Express and Checkout communication
  * Use current Paypal Express method instance
  */
-namespace Magento\Paypal\Model\Express;
-
 class Checkout
 {
     /**
@@ -83,12 +85,24 @@ class Checkout
     protected $_methodType = \Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS;
 
     /**
-     * State helper variables
+     * State helper variable
      *
      * @var string
      */
     protected $_redirectUrl = '';
+
+    /**
+     * State helper variable
+     *
+     * @var string
+     */
     protected $_pendingPaymentMessage = '';
+
+    /**
+     * State helper variable
+     *
+     * @var string
+     */
     protected $_checkoutRedirectUrl = '';
 
     /**
@@ -195,7 +209,7 @@ class Checkout
     protected $_cartFactory;
 
     /**
-     * @var \Magento\Core\Model\Log\AdapterFactory
+     * @var \Magento\Logger\AdapterFactory
      */
     protected $_logFactory;
 
@@ -229,6 +243,11 @@ class Checkout
      */
     protected $_checkoutSession;
 
+    /**
+     * @var \Magento\RecurringProfile\Model\Quote
+     */
+    protected $_quoteImporter;
+
     /**
      * Set config, session and quote instances
      *
@@ -243,13 +262,14 @@ class Checkout
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\UrlInterface $coreUrl
      * @param \Magento\Paypal\Model\CartFactory $cartFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logFactory
+     * @param \Magento\Logger\AdapterFactory $logFactory
      * @param \Magento\Checkout\Model\Type\OnepageFactory $onepageFactory
      * @param \Magento\Sales\Model\Service\QuoteFactory $serviceQuoteFactory
      * @param \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory
      * @param \Magento\Paypal\Model\Api\Type\Factory $apiTypeFactory
      * @param \Magento\Object\Copy $objectCopyService
      * @param \Magento\Checkout\Model\Session $checkoutSession
+     * @param \Magento\RecurringProfile\Model\QuoteImporter $quoteImporter
      * @param array $params
      * @throws \Exception
      */
@@ -265,13 +285,14 @@ class Checkout
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\UrlInterface $coreUrl,
         \Magento\Paypal\Model\CartFactory $cartFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logFactory,
+        \Magento\Logger\AdapterFactory $logFactory,
         \Magento\Checkout\Model\Type\OnepageFactory $onepageFactory,
         \Magento\Sales\Model\Service\QuoteFactory $serviceQuoteFactory,
         \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory,
         \Magento\Paypal\Model\Api\Type\Factory $apiTypeFactory,
         \Magento\Object\Copy $objectCopyService,
         \Magento\Checkout\Model\Session $checkoutSession,
+        \Magento\RecurringProfile\Model\QuoteImporter $quoteImporter,
         $params = array()
     ) {
         $this->_customerData = $customerData;
@@ -292,6 +313,7 @@ class Checkout
         $this->_apiTypeFactory = $apiTypeFactory;
         $this->_objectCopyService = $objectCopyService;
         $this->_checkoutSession = $checkoutSession;
+        $this->_quoteImporter = $quoteImporter;
 
         if (isset($params['config']) && $params['config'] instanceof \Magento\Paypal\Model\Config) {
             $this->_config = $params['config'];
@@ -330,7 +352,7 @@ class Checkout
                     $this->_configCacheType->save($pal, $cacheId);
                 } catch (\Exception $e) {
                     $this->_configCacheType->save(self::PAL_CACHE_ID, $cacheId);
-                   $this->_logger->logException($e);
+                    $this->_logger->logException($e);
                 }
             }
         }
@@ -348,7 +370,7 @@ class Checkout
      * @param string $successUrl - payment success result
      * @param string $cancelUrl  - payment cancellation result
      * @param string $pendingUrl - pending payment result
-     * @return \Magento\Paypal\Model\Express\Checkout
+     * @return $this
      */
     public function prepareGiropayUrls($successUrl, $cancelUrl, $pendingUrl)
     {
@@ -360,7 +382,7 @@ class Checkout
      * Set create billing agreement flag
      *
      * @param bool $flag
-     * @return \Magento\Paypal\Model\Express\Checkout
+     * @return $this
      */
     public function setIsBillingAgreementRequested($flag)
     {
@@ -371,8 +393,8 @@ class Checkout
     /**
      * Setter for customer
      *
-     * @param \Magento\Customer\Model\Customer $customer
-     * @return \Magento\Paypal\Model\Express\Checkout
+     * @param Customer $customer
+     * @return $this
      */
     public function setCustomer($customer)
     {
@@ -384,10 +406,10 @@ class Checkout
     /**
      * Setter for customer with billing and shipping address changing ability
      *
-     * @param  \Magento\Customer\Model\Customer   $customer
-     * @param  \Magento\Sales\Model\Quote\Address $billingAddress
-     * @param  \Magento\Sales\Model\Quote\Address $shippingAddress
-     * @return \Magento\Paypal\Model\Express\Checkout
+     * @param Customer $customer
+     * @param Address|null $billingAddress
+     * @param Address|null $shippingAddress
+     * @return $this
      */
     public function setCustomerWithAddressChange($customer, $billingAddress = null, $shippingAddress = null)
     {
@@ -480,7 +502,7 @@ class Checkout
         }
 
         // add recurring payment profiles information
-        $profiles = $this->_quote->prepareRecurringPaymentProfiles();
+        $profiles = $this->_quoteImporter->prepareRecurringPaymentProfiles($this->_quote);
         if ($profiles) {
             foreach ($profiles as $profile) {
                 $profile->setMethodCode(\Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS);
@@ -510,6 +532,7 @@ class Checkout
      * export shipping address in case address absence
      *
      * @param string $token
+     * @return void
      */
     public function returnFromPaypal($token)
     {
@@ -571,7 +594,8 @@ class Checkout
     /**
      * Check whether order review has enough data to initialize
      *
-     * @param $token
+     * @param string|null $token
+     * @return void
      * @throws \Magento\Core\Exception
      */
     public function prepareOrderReview($token = null)
@@ -632,7 +656,9 @@ class Checkout
 
     /**
      * Set shipping method to quote, if needed
+     *
      * @param string $methodCode
+     * @return void
      */
     public function updateShippingMethod($methodCode)
     {
@@ -649,6 +675,7 @@ class Checkout
      * Update order data
      *
      * @param array $data
+     * @return void
      */
     public function updateOrder($data)
     {
@@ -677,11 +704,12 @@ class Checkout
     }
 
     /**
-     * Place the order and recurring payment profiles when customer returned from paypal
+     * Place the order when customer returned from paypal
      * Until this moment all quote data must be valid
      *
      * @param string $token
-     * @param string $shippingMethodCode
+     * @param string|null $shippingMethodCode
+     * @return void
      */
     public function place($token, $shippingMethodCode = null)
     {
@@ -718,9 +746,6 @@ class Checkout
             }
         }
 
-        $this->_recurringPaymentProfiles = $service->getRecurringPaymentProfiles();
-        // TODO: send recurring profile emails
-
         $order = $service->getOrder();
         if (!$order) {
             return;
@@ -752,6 +777,8 @@ class Checkout
 
     /**
      * Make sure addresses will be saved without validation errors
+     *
+     * @return void
      */
     private function _ignoreAddressValidation()
     {
@@ -774,16 +801,6 @@ class Checkout
         return $this->_redirectUrl;
     }
 
-    /**
-     * Return recurring payment profiles
-     *
-     * @return array
-     */
-    public function getRecurringPaymentProfiles()
-    {
-        return $this->_recurringPaymentProfiles;
-    }
-
     /**
      * Get created billing agreement
      *
@@ -827,8 +844,9 @@ class Checkout
     /**
      * Sets address data from exported address
      *
-     * @param \Magento\Sales\Model\Quote\Address $address
+     * @param Address $address
      * @param array $exportedAddress
+     * @return void
      */
     protected function _setExportedAddressData($address, $exportedAddress)
     {
@@ -836,8 +854,8 @@ class Checkout
             $oldData = $address->getDataUsingMethod($key);
             $isEmpty = null;
             if (is_array($oldData)) {
-                foreach($oldData as $val) {
-                    if(!empty($val)) {
+                foreach ($oldData as $val) {
+                    if (!empty($val)) {
                         $isEmpty = false;
                         break;
                     }
@@ -853,7 +871,7 @@ class Checkout
     /**
      * Set create billing agreement flag to api call
      *
-     * @return \Magento\Paypal\Model\Express\Checkout
+     * @return $this
      */
     protected function _setBillingAgreementRequest()
     {
@@ -893,13 +911,13 @@ class Checkout
      * Returns empty array if it was impossible to obtain any shipping rate
      * If there are shipping rates obtained, the method must return one of them as default.
      *
-     * @param \Magento\Sales\Model\Quote\Address $address
+     * @param Address $address
      * @param bool $mayReturnEmpty
      * @param bool $calculateTax
      * @return array|false
      */
     protected function _prepareShippingOptions(
-        \Magento\Sales\Model\Quote\Address $address,
+        Address $address,
         $mayReturnEmpty = false, $calculateTax = false
     ) {
         $options = array(); $i = 0; $iMin = false; $min = false;
@@ -973,7 +991,7 @@ class Checkout
      *
      * @param \Magento\Object $option1
      * @param \Magento\Object $option2
-     * @return integer
+     * @return int
      */
     protected static function cmpShippingOptions(\Magento\Object $option1, \Magento\Object $option2)
     {
@@ -989,11 +1007,11 @@ class Checkout
      * If in future the issue is fixed, we don't need to attempt to match it. It would be enough to set the method code
      * before collecting shipping rates
      *
-     * @param \Magento\Sales\Model\Quote\Address $address
+     * @param Address $address
      * @param string $selectedCode
      * @return string
      */
-    protected function _matchShippingMethodCode(\Magento\Sales\Model\Quote\Address $address, $selectedCode)
+    protected function _matchShippingMethodCode(Address $address, $selectedCode)
     {
         $options = $this->_prepareShippingOptions($address, false);
         foreach ($options as $option) {
@@ -1011,7 +1029,7 @@ class Checkout
     /**
      * Prepare quote for guest checkout order submit
      *
-     * @return \Magento\Paypal\Model\Express\Checkout
+     * @return $this
      */
     protected function _prepareGuestQuote()
     {
@@ -1027,7 +1045,7 @@ class Checkout
      * Prepare quote for customer registration and customer order submit
      * and restore magento customer data from quote
      *
-     * @return \Magento\Paypal\Model\Express\Checkout
+     * @return $this
      */
     protected function _prepareNewCustomerQuote()
     {
@@ -1036,7 +1054,7 @@ class Checkout
         $shipping   = $quote->isVirtual() ? null : $quote->getShippingAddress();
 
         $customer = $quote->getCustomer();
-        /** @var $customer \Magento\Customer\Model\Customer */
+        /** @var $customer Customer */
         $customerBilling = $billing->exportCustomerAddress();
         $customer->addAddress($customerBilling);
         $billing->setCustomerAddress($customerBilling);
@@ -1082,7 +1100,7 @@ class Checkout
     /**
      * Prepare quote for customer order submit
      *
-     * @return \Magento\Paypal\Model\Express\Checkout
+     * @return $this
      */
     protected function _prepareCustomerQuote()
     {
@@ -1119,7 +1137,7 @@ class Checkout
     /**
      * Involve new customer to system
      *
-     * @return \Magento\Paypal\Model\Express\Checkout
+     * @return $this
      */
     protected function _involveNewCustomer()
     {
diff --git a/app/code/Magento/Paypal/Model/Express/Checkout/Factory.php b/app/code/Magento/Paypal/Model/Express/Checkout/Factory.php
index f25aed95b5c..53d746e0d39 100644
--- a/app/code/Magento/Paypal/Model/Express/Checkout/Factory.php
+++ b/app/code/Magento/Paypal/Model/Express/Checkout/Factory.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Express\Checkout;
 
 /**
  * Factory class for \Magento\Paypal\Model\Express\Checkout
  */
-namespace Magento\Paypal\Model\Express\Checkout;
-
 class Factory
 {
     /**
diff --git a/app/code/Magento/Paypal/Model/Hostedpro.php b/app/code/Magento/Paypal/Model/Hostedpro.php
index ba34e09d5e6..3b80c9d6c08 100644
--- a/app/code/Magento/Paypal/Model/Hostedpro.php
+++ b/app/code/Magento/Paypal/Model/Hostedpro.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model;
 
 /**
  * Website Payments Pro Hosted Solution payment gateway model
  */
-namespace Magento\Paypal\Model;
-
 class Hostedpro extends \Magento\Paypal\Model\Direct
 {
     /**
@@ -63,13 +62,26 @@ class Hostedpro extends \Magento\Paypal\Model\Direct
      */
     protected $_infoBlockType = 'Magento\Paypal\Block\Hosted\Pro\Info';
 
-    /**#@+
-     * Availability options
+    /**
+     * Availability option
+     *
+     * @var bool
      */
     protected $_canUseInternal          = false;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canSaveCc               = false;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_isInitializeNeeded      = true;
-    /**#@-*/
 
     /**
      * @var \Magento\Paypal\Model\Hostedpro\RequestFactory
@@ -80,7 +92,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Logger $logger
      * @param \Magento\Module\ModuleListInterface $moduleList
      * @param \Magento\Core\Model\LocaleInterface $locale
@@ -92,14 +104,14 @@ class Hostedpro extends \Magento\Paypal\Model\Direct
      * @param \Magento\Paypal\Model\CartFactory $cartFactory
      * @param \Magento\Paypal\Model\Hostedpro\RequestFactory $hostedproRequestFactory
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Logger $logger,
         \Magento\Module\ModuleListInterface $moduleList,
         \Magento\Core\Model\LocaleInterface $locale,
@@ -135,7 +147,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct
      * Return available CC types for gateway based on merchant country.
      * We do not have to check the availability of card types.
      *
-     * @return bool
+     * @return true
      */
     public function getAllowedCcTypes()
     {
@@ -156,7 +168,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct
     /**
      * Do not validate payment form using server methods
      *
-     * @return  bool
+     * @return true
      */
     public function validate()
     {
@@ -168,7 +180,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct
      *
      * @param string $paymentAction
      * @param \Magento\Object $stateObject
-     * @return \Magento\Payment\Model\Method\AbstractMethod|void
+     * @return void
      */
     public function initialize($paymentAction, $stateObject)
     {
@@ -196,6 +208,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct
      * Sends API request to PayPal to get form URL, then sets this URL to $payment object.
      *
      * @param \Magento\Payment\Model\Info $payment
+     * @return void
      * @throws \Magento\Core\Exception
      */
     protected function _setPaymentFormUrl(\Magento\Payment\Model\Info $payment)
@@ -228,7 +241,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct
      * Returns form URL from request to PayPal.
      *
      * @param \Magento\Paypal\Model\Hostedpro\Request $request
-     * @return string | false
+     * @return string|false
      */
     protected function _sendFormUrlRequest(\Magento\Paypal\Model\Hostedpro\Request $request)
     {
@@ -259,7 +272,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct
     /**
      * Get return URL
      *
-     * @param int $storeId
+     * @param int|null $storeId
      * @return string
      */
     public function getReturnUrl($storeId = null)
@@ -270,7 +283,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct
     /**
      * Get notify (IPN) URL
      *
-     * @param int $storeId
+     * @param int|null $storeId
      * @return string
      */
     public function getNotifyUrl($storeId = null)
@@ -281,7 +294,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct
     /**
      * Get cancel URL
      *
-     * @param int $storeId
+     * @param int|null $storeId
      * @return string
      */
     public function getCancelUrl($storeId = null)
@@ -294,7 +307,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct
      *
      * @param string $path
      * @param int $storeId
-     * @param bool $secure
+     * @param bool|null $secure
      * @return string
      */
     protected function _getUrl($path, $storeId, $secure = null)
diff --git a/app/code/Magento/Paypal/Model/Hostedpro/Request.php b/app/code/Magento/Paypal/Model/Hostedpro/Request.php
index 17535f1c1eb..d7cc75f5d98 100644
--- a/app/code/Magento/Paypal/Model/Hostedpro/Request.php
+++ b/app/code/Magento/Paypal/Model/Hostedpro/Request.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Hostedpro;
 
 /**
  *  Website Payments Pro Hosted Solution request model to get token.
@@ -31,9 +32,6 @@
  * @package     Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-
-namespace Magento\Paypal\Model\Hostedpro;
-
 class Request extends \Magento\Object
 {
     /**
@@ -60,7 +58,7 @@ class Request extends \Magento\Object
     /**
      * Request Parameters which dont have to wrap as button vars
      *
-     * @var array
+     * @var string[]
      */
     protected $_notButtonVars = array (
         'METHOD', 'BUTTONCODE', 'BUTTONTYPE');
@@ -116,7 +114,7 @@ class Request extends \Magento\Object
      * Append payment data to request
      *
      * @param \Magento\Paypal\Model\Hostedpro $paymentMethod
-     * @return \Magento\Paypal\Model\Hostedpro\Request
+     * @return $this
      */
     public function setPaymentMethod($paymentMethod)
     {
@@ -131,7 +129,7 @@ class Request extends \Magento\Object
      * Append order data to request
      *
      * @param \Magento\Sales\Model\Order $order
-     * @return \Magento\Paypal\Model\Hostedpro\Request
+     * @return $this
      */
     public function setOrder($order)
     {
@@ -263,7 +261,7 @@ class Request extends \Magento\Object
      * Format price string
      *
      * @param mixed $string
-     * @return mixed
+     * @return string
      */
     protected function _formatPrice($string)
     {
diff --git a/app/code/Magento/Paypal/Model/Info.php b/app/code/Magento/Paypal/Model/Info.php
index 9bce1462a6f..155462d3c14 100644
--- a/app/code/Magento/Paypal/Model/Info.php
+++ b/app/code/Magento/Paypal/Model/Info.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model;
 
 /**
  * PayPal payment information model
@@ -31,8 +32,6 @@
  * Collects and provides access to PayPal-specific payment data
  * Provides business logic information about payment flow
  */
-namespace Magento\Paypal\Model;
-
 class Info
 {
     /**
@@ -147,7 +146,7 @@ class Info
     /**
      * Map of payment information available to customer
      *
-     * @var array
+     * @var string[]
      */
     protected $_paymentPublicMap = array(
         'paypal_payer_email',
@@ -203,6 +202,7 @@ class Info
      *
      * @param array|\Magento\Object|callback $from
      * @param \Magento\Payment\Model\Info $payment
+     * @return void
      */
     public function importToPayment($from, \Magento\Payment\Model\Info $payment)
     {
@@ -218,7 +218,7 @@ class Info
      *
      * @param \Magento\Payment\Model\Info $payment
      * @param array|\Magento\Object|callback $to
-     * @param array $map
+     * @param array|null $map
      * @return array|\Magento\Object
      */
     public function &exportFromPayment(\Magento\Payment\Model\Info $payment, $to, array $map = null)
@@ -347,7 +347,7 @@ class Info
     /**
      * Explain the refund or chargeback reason code
      *
-     * @param $code
+     * @param string $code
      * @return string
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables
      * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetTransactionDetails
@@ -411,6 +411,7 @@ class Info
      * @param array $keys
      * @param \Magento\Payment\Model\Info $payment
      * @param bool $labelValuesOnly
+     * @return array
      */
     protected function _getFullInfo(array $keys, \Magento\Payment\Model\Info $payment, $labelValuesOnly)
     {
@@ -444,6 +445,7 @@ class Info
      * Render info item labels
      *
      * @param string $key
+     * @return string
      */
     protected function _getLabel($key)
     {
@@ -532,9 +534,9 @@ class Info
     /**
      * Attempt to convert AVS check result code into label
      *
-     * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_AVSResponseCodes
      * @param string $value
      * @return string
+     * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_AVSResponseCodes
      */
     protected function _getAvsLabel($value)
     {
@@ -596,9 +598,9 @@ class Info
     /**
      * Attempt to convert CVV2 check result code into label
      *
-     * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_AVSResponseCodes
      * @param string $value
      * @return string
+     * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_AVSResponseCodes
      */
     protected function _getCvv2Label($value)
     {
@@ -635,9 +637,9 @@ class Info
     /**
      * Attempt to convert centinel VPAS result into label
      *
-     * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoDirectPayment
      * @param string $value
      * @return string
+     * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoDirectPayment
      */
     private function _getCentinelVpasLabel($value)
     {
@@ -669,9 +671,9 @@ class Info
     /**
      * Attempt to convert centinel ECI result into label
      *
-     * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoDirectPayment
      * @param string $value
      * @return string
+     * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoDirectPayment
      */
     private function _getCentinelEciLabel($value)
     {
diff --git a/app/code/Magento/Paypal/Model/Ipn.php b/app/code/Magento/Paypal/Model/Ipn.php
index 7b9e8ca4660..0879260a4f4 100644
--- a/app/code/Magento/Paypal/Model/Ipn.php
+++ b/app/code/Magento/Paypal/Model/Ipn.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model;
 
 /**
  * PayPal Instant Payment Notification processor model
  */
-namespace Magento\Paypal\Model;
-
 class Ipn
 {
     /**
@@ -37,7 +36,9 @@ class Ipn
     const DEFAULT_LOG_FILE = 'paypal_unknown_ipn.log';
 
     /**
-     * @param \Magento\Sales\Model\Order
+     * Sales order
+     *
+     * @var \Magento\Sales\Model\Order
      */
     protected $_order;
 
@@ -100,7 +101,7 @@ class Ipn
      * @param \Magento\Paypal\Model\ConfigFactory $configFactory
      * @param \Magento\RecurringProfile\Model\ProfileFactory $recurringProfileFactory
      * @param \Magento\Paypal\Model\Info $paypalInfo
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      */
     public function __construct(
         \Magento\Sales\Model\OrderFactory $orderFactory,
@@ -108,7 +109,7 @@ class Ipn
         \Magento\Paypal\Model\ConfigFactory $configFactory,
         \Magento\RecurringProfile\Model\ProfileFactory $recurringProfileFactory,
         \Magento\Paypal\Model\Info $paypalInfo,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+        \Magento\Logger\AdapterFactory $logAdapterFactory
     ) {
         $this->_orderFactory = $orderFactory;
         $this->_responseHttp = $responseHttp;
@@ -121,7 +122,7 @@ class Ipn
     /**
      * IPN request data getter
      *
-     * @param string $key
+     * @param string|null $key
      * @return array|string
      */
     public function getRequestData($key = null)
@@ -136,7 +137,8 @@ class Ipn
      * Get ipn data, send verification to PayPal, run corresponding handler
      *
      * @param array $request
-     * @param \Zend_Http_Client_Adapter_Interface $httpAdapter
+     * @param \Zend_Http_Client_Adapter_Interface|null $httpAdapter
+     * @return void
      * @throws \Exception
      */
     public function processIpnRequest(array $request, \Zend_Http_Client_Adapter_Interface $httpAdapter = null)
@@ -171,6 +173,7 @@ class Ipn
      * Post back to PayPal to check whether this request is a valid one
      *
      * @param \Zend_Http_Client_Adapter_Interface $httpAdapter
+     * @return void
      * @throws \Exception
      */
     protected function _postBack(\Zend_Http_Client_Adapter_Interface $httpAdapter)
@@ -200,7 +203,6 @@ class Ipn
     /**
      * Load and validate order, instantiate proper configuration
      *
-     *
      * @return \Magento\Sales\Model\Order
      * @throws \Exception
      */
@@ -262,6 +264,7 @@ class Ipn
      * Validate incoming request data, as PayPal recommends
      *
      * @throws \Exception
+     * @return void
      * @link https://cms.paypal.com/cgi-bin/marketingweb?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro
      */
     protected function _verifyOrder()
@@ -287,6 +290,8 @@ class Ipn
      * IPN workflow implementation
      * Everything should be added to order comments. In positive processing cases customer will get email notifications.
      * Admin will be notified on errors.
+     *
+     * @return void
      */
     protected function _processOrder()
     {
@@ -320,6 +325,8 @@ class Ipn
 
     /**
      * Process adjustment notification
+     *
+     * @return void
      */
     protected function _registerAdjustment()
     {
@@ -342,6 +349,8 @@ class Ipn
 
     /**
      * Process dispute notification
+     *
+     * @return void
      */
     protected function _registerDispute()
     {
@@ -367,6 +376,8 @@ class Ipn
 
     /**
      * Process payment reversal and cancelled reversal notification
+     *
+     * @return void
      */
     protected function _registerPaymentReversal()
     {
@@ -402,6 +413,8 @@ class Ipn
 
     /**
      * Process regular IPN notifications
+     *
+     * @return void
      */
     protected function _registerTransaction()
     {
@@ -460,6 +473,8 @@ class Ipn
 
     /**
      * Process notification from recurring profile payments
+     *
+     * @return void
      */
     protected function _processRecurringProfile()
     {
@@ -516,6 +531,8 @@ class Ipn
 
     /**
      * Process completed payment (either full or partial)
+     *
+     * @return void
      */
     protected function _registerPaymentCapture()
     {
@@ -545,6 +562,8 @@ class Ipn
 
     /**
      * Process denied payment notification
+     *
+     * @return void
      */
     protected function _registerPaymentDenial()
     {
@@ -559,6 +578,8 @@ class Ipn
 
     /**
      * Treat failed payment as order cancellation
+     *
+     * @return void
      */
     protected function _registerPaymentFailure()
     {
@@ -570,6 +591,8 @@ class Ipn
 
     /**
      * Process a refund
+     *
+     * @return void
      */
     protected function _registerPaymentRefund()
     {
@@ -598,6 +621,7 @@ class Ipn
     /**
      * Process payment pending notification
      *
+     * @return void
      * @throws \Exception
      */
     public function _registerPaymentPending()
@@ -629,6 +653,8 @@ class Ipn
 
     /**
      * Register authorized payment
+     *
+     * @return void
      */
     protected function _registerPaymentAuthorization()
     {
@@ -653,6 +679,8 @@ class Ipn
 
     /**
      * Process voided authorization
+     *
+     * @return void
      */
     protected function _registerPaymentVoid()
     {
@@ -671,6 +699,8 @@ class Ipn
 
     /**
      * The status "Processed" is used when all Masspayments are successful
+     *
+     * @return void
      */
     protected function _registerMasspaymentsSuccess()
     {
@@ -787,14 +817,16 @@ class Ipn
             case 'Voided':    return \Magento\Paypal\Model\Info::PAYMENTSTATUS_VOIDED;
         }
         return '';
-// documented in NVP, but not documented in IPN:
-//Magento_Paypal_Model_Info::PAYMENTSTATUS_NONE
-//Magento_Paypal_Model_Info::PAYMENTSTATUS_INPROGRESS
-//Magento_Paypal_Model_Info::PAYMENTSTATUS_REFUNDEDPART
+        // documented in NVP, but not documented in IPN:
+        //Magento_Paypal_Model_Info::PAYMENTSTATUS_NONE
+        //Magento_Paypal_Model_Info::PAYMENTSTATUS_INPROGRESS
+        //Magento_Paypal_Model_Info::PAYMENTSTATUS_REFUNDEDPART
     }
 
     /**
      * Log debug data to file
+     *
+     * @return void
      */
     protected function _debug()
     {
diff --git a/app/code/Magento/Paypal/Model/Method/Agreement.php b/app/code/Magento/Paypal/Model/Method/Agreement.php
index efb05fde881..6deaf7ea65f 100644
--- a/app/code/Magento/Paypal/Model/Method/Agreement.php
+++ b/app/code/Magento/Paypal/Model/Method/Agreement.php
@@ -23,12 +23,15 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Method;
+
+use Magento\Core\Model\Store;
+use Magento\Payment\Model\Info;
+use Magento\Sales\Model\Order\Payment;
 
 /**
  * Paypal Billing Agreement method
  */
-namespace Magento\Paypal\Model\Method;
-
 class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgreement
     implements \Magento\Paypal\Model\Billing\Agreement\MethodInterface
 {
@@ -40,17 +43,73 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
     protected $_code = \Magento\Paypal\Model\Config::METHOD_BILLING_AGREEMENT;
 
     /**
-     * Method instance settings
+     * Method instance setting
+     *
+     * @var bool
      */
     protected $_canAuthorize            = true;
+
+    /**
+     * Method instance setting
+     *
+     * @var bool
+     */
     protected $_canCapture              = true;
+
+    /**
+     * Method instance setting
+     *
+     * @var bool
+     */
     protected $_canCapturePartial       = true;
+
+    /**
+     * Method instance setting
+     *
+     * @var bool
+     */
     protected $_canRefund               = true;
+
+    /**
+     * Method instance setting
+     *
+     * @var bool
+     */
     protected $_canRefundInvoicePartial = true;
+
+    /**
+     * Method instance setting
+     *
+     * @var bool
+     */
     protected $_canVoid                 = true;
+
+    /**
+     * Method instance setting
+     *
+     * @var bool
+     */
     protected $_canUseCheckout          = false;
+
+    /**
+     * Method instance setting
+     *
+     * @var bool
+     */
     protected $_canUseInternal          = false;
+
+    /**
+     * Method instance setting
+     *
+     * @var bool
+     */
     protected $_canFetchTransactionInfo = true;
+
+    /**
+     * Method instance setting
+     *
+     * @var bool
+     */
     protected $_canReviewPayment        = true;
 
     /**
@@ -79,10 +138,10 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
+     * @param \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory
-     * @param \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory
      * @param \Magento\UrlInterface $urlBuilder
      * @param \Magento\Paypal\Model\CartFactory $cartFactory
      * @param array $data
@@ -93,7 +152,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory,
@@ -125,8 +184,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
      * Store setter
      * Also updates store ID in config object
      *
-     * @param \Magento\Core\Model\Store|int $store
-     * @return $this
+     * @param Store|int $store
      * @return $this
      */
     public function setStore($store)
@@ -143,7 +201,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
      * Init billing agreement
      *
      * @param \Magento\Paypal\Model\Billing\AbstractAgreement $agreement
-     * @return \Magento\Paypal\Model\Method\Agreement
+     * @return $this
      */
     public function initBillingAgreementToken(\Magento\Paypal\Model\Billing\AbstractAgreement $agreement)
     {
@@ -184,7 +242,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
      * Create billing agreement by token specified in request
      *
      * @param \Magento\Paypal\Model\Billing\AbstractAgreement $agreement
-     * @return \Magento\Paypal\Model\Method\Agreement
+     * @return $this
      */
     public function placeBillingAgreement(\Magento\Paypal\Model\Billing\AbstractAgreement $agreement)
     {
@@ -199,7 +257,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
      * Update billing agreement status
      *
      * @param \Magento\Paypal\Model\Billing\AbstractAgreement $agreement
-     * @return \Magento\Paypal\Model\Method\Agreement
+     * @return $this
      * @throws \Exception|\Magento\Core\Exception
      */
     public function updateBillingAgreementStatus(\Magento\Paypal\Model\Billing\AbstractAgreement $agreement)
@@ -225,7 +283,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
      *
      * @param \Magento\Object $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Method\Agreement
+     * @return $this
      */
     public function authorize(\Magento\Object $payment, $amount)
     {
@@ -235,8 +293,8 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
     /**
      * Void payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
-     * @return \Magento\Paypal\Model\Method\Agreement
+     * @param \Magento\Object|Payment $payment
+     * @return $this
      */
     public function void(\Magento\Object $payment)
     {
@@ -247,9 +305,9 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
     /**
      * Capture payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Method\Agreement
+     * @return $this
      */
     public function capture(\Magento\Object $payment, $amount)
     {
@@ -262,9 +320,9 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
     /**
      * Refund capture
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Method\Agreement
+     * @return $this
      */
     public function refund(\Magento\Object $payment, $amount)
     {
@@ -275,8 +333,8 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
     /**
      * Cancel payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
-     * @return \Magento\Paypal\Model\Method\Agreement
+     * @param \Magento\Object|Payment $payment
+     * @return $this
      */
     public function cancel(\Magento\Object $payment)
     {
@@ -287,10 +345,10 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
     /**
      * Whether payment can be reviewed
      *
-     * @param \Magento\Payment\Model\Info|\Magento\Sales\Model\Order\Payment $payment
+     * @param Info|Payment $payment
      * @return bool
      */
-    public function canReviewPayment(\Magento\Payment\Model\Info $payment)
+    public function canReviewPayment(Info $payment)
     {
         return parent::canReviewPayment($payment) && $this->_pro->canReviewPayment($payment);
     }
@@ -298,10 +356,10 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
     /**
      * Attempt to accept a pending payment
      *
-     * @param \Magento\Payment\Model\Info|\Magento\Sales\Model\Order\Payment $payment
+     * @param Info|Payment $payment
      * @return bool
      */
-    public function acceptPayment(\Magento\Payment\Model\Info $payment)
+    public function acceptPayment(Info $payment)
     {
         parent::acceptPayment($payment);
         return $this->_pro->reviewPayment($payment, \Magento\Paypal\Model\Pro::PAYMENT_REVIEW_ACCEPT);
@@ -310,10 +368,10 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
     /**
      * Attempt to deny a pending payment
      *
-     * @param \Magento\Payment\Model\Info|\Magento\Sales\Model\Order\Payment $payment
+     * @param Info|Payment $payment
      * @return bool
      */
-    public function denyPayment(\Magento\Payment\Model\Info $payment)
+    public function denyPayment(Info $payment)
     {
         parent::denyPayment($payment);
         return $this->_pro->reviewPayment($payment, \Magento\Paypal\Model\Pro::PAYMENT_REVIEW_DENY);
@@ -322,11 +380,11 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
     /**
      * Fetch transaction details info
      *
-     * @param \Magento\Payment\Model\Info $payment
+     * @param Info $payment
      * @param string $transactionId
      * @return array
      */
-    public function fetchTransactionInfo(\Magento\Payment\Model\Info $payment, $transactionId)
+    public function fetchTransactionInfo(Info $payment, $transactionId)
     {
         return $this->_pro->fetchTransactionInfo($payment, $transactionId);
     }
@@ -334,11 +392,11 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
     /**
      * Place an order with authorization or capture action
      *
-     * @param \Magento\Sales\Model\Order\Payment $payment
+     * @param Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Method\Agreement
+     * @return $this
      */
-    protected function _placeOrder(\Magento\Sales\Model\Order\Payment $payment, $amount)
+    protected function _placeOrder(Payment $payment, $amount)
     {
         $order = $payment->getOrder();
         /** @var \Magento\Paypal\Model\Billing\Agreement $billingAgreement */
@@ -398,5 +456,4 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr
     {
         return $this->_pro->getConfig()->getPaymentAction();
     }
-
 }
diff --git a/app/code/Magento/Paypal/Model/Method/ProTypeFactory.php b/app/code/Magento/Paypal/Model/Method/ProTypeFactory.php
index 49f96479b30..16621ed8185 100644
--- a/app/code/Magento/Paypal/Model/Method/ProTypeFactory.php
+++ b/app/code/Magento/Paypal/Model/Method/ProTypeFactory.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Method;
 
 /**
  * Factory class for payment method model
  */
-namespace Magento\Paypal\Model\Method;
-
 class ProTypeFactory
 {
     /**
@@ -53,7 +52,7 @@ class ProTypeFactory
      *
      * @param string $className
      * @param array $data
-     * @return object
+     * @return \Magento\Object
      */
     public function create($className, array $data = array())
     {
diff --git a/app/code/Magento/Paypal/Model/Observer.php b/app/code/Magento/Paypal/Model/Observer.php
index 260db1eb831..f26149c76ae 100644
--- a/app/code/Magento/Paypal/Model/Observer.php
+++ b/app/code/Magento/Paypal/Model/Observer.php
@@ -23,18 +23,19 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model;
+
+use Magento\Event\Observer as EventObserver;
 
 /**
  * PayPal module observer
  */
-namespace Magento\Paypal\Model;
-
 class Observer
 {
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -85,7 +86,7 @@ class Observer
     /**
      * @param \Magento\Core\Helper\Data $coreData
      * @param \Magento\Paypal\Helper\Hss $paypalHss
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Logger $logger
      * @param Report\SettlementFactory $settlementFactory
      * @param \Magento\App\ViewInterface $view
@@ -96,7 +97,7 @@ class Observer
     public function __construct(
         \Magento\Core\Helper\Data $coreData,
         \Magento\Paypal\Helper\Hss $paypalHss,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Logger $logger,
         \Magento\Paypal\Model\Report\SettlementFactory $settlementFactory,
         \Magento\App\ViewInterface $view,
@@ -117,7 +118,8 @@ class Observer
 
     /**
      * Goes to reports.paypal.com and fetches Settlement reports.
-     * @return \Magento\Paypal\Model\Observer
+     *
+     * @return void
      */
     public function fetchReports()
     {
@@ -142,7 +144,7 @@ class Observer
      * Clean unfinished transaction
      *
      * @deprecated since 1.6.2.0
-     * @return \Magento\Paypal\Model\Observer
+     * @return $this
      */
     public function cleanTransactions()
     {
@@ -152,10 +154,10 @@ class Observer
     /**
      * Save order into registry to use it in the overloaded controller.
      *
-     * @param \Magento\Event\Observer $observer
-     * @return \Magento\Paypal\Model\Observer
+     * @param EventObserver $observer
+     * @return $this
      */
-    public function saveOrderAfterSubmit(\Magento\Event\Observer $observer)
+    public function saveOrderAfterSubmit(EventObserver $observer)
     {
         /* @var $order \Magento\Sales\Model\Order */
         $order = $observer->getEvent()->getData('order');
@@ -167,10 +169,10 @@ class Observer
     /**
      * Set data for response of frontend saveOrder action
      *
-     * @param \Magento\Event\Observer $observer
-     * @return \Magento\Paypal\Model\Observer
+     * @param EventObserver $observer
+     * @return $this
      */
-    public function setResponseAfterSaveOrder(\Magento\Event\Observer $observer)
+    public function setResponseAfterSaveOrder(EventObserver $observer)
     {
         /* @var $order \Magento\Sales\Model\Order */
         $order = $this->_coreRegistry->registry('hss_order');
@@ -203,7 +205,8 @@ class Observer
     /**
      * Block admin ability to use customer billing agreements
      *
-     * @param \Magento\Event\Observer $observer
+     * @param EventObserver $observer
+     * @return void
      */
     public function restrictAdminBillingAgreementUsage($observer)
     {
@@ -217,9 +220,10 @@ class Observer
     }
 
     /**
-     * @param \Magento\Event\Observer $observer
+     * @param EventObserver $observer
+     * @return void
      */
-    public function addBillingAgreementToSession(\Magento\Event\Observer $observer)
+    public function addBillingAgreementToSession(EventObserver $observer)
     {
         /** @var \Magento\Sales\Model\Order\Payment $orderPayment */
         $orderPayment = $observer->getEvent()->getPayment();
@@ -247,9 +251,10 @@ class Observer
     /**
      * Add PayPal shortcut buttons
      *
-     * @param \Magento\Event\Observer $observer
+     * @param EventObserver $observer
+     * @return void
      */
-    public function addPaypalShortcuts(\Magento\Event\Observer $observer)
+    public function addPaypalShortcuts(EventObserver $observer)
     {
         /** @var \Magento\Catalog\Block\ShortcutButtons $shortcutButtons */
         $shortcutButtons = $observer->getEvent()->getContainer();
diff --git a/app/code/Magento/Paypal/Model/Payflow/Pro.php b/app/code/Magento/Paypal/Model/Payflow/Pro.php
index ae336bb38c2..1fc90a3d079 100644
--- a/app/code/Magento/Paypal/Model/Payflow/Pro.php
+++ b/app/code/Magento/Paypal/Model/Payflow/Pro.php
@@ -21,14 +21,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Payflow;
 
 /**
  * PayPal Website Payments Pro (Payflow Edition) implementation for payment method instances
  * This model was created because right now PayPal Direct and PayPal Express payment
  * (Payflow Edition) methods cannot have same abstract
  */
-namespace Magento\Paypal\Model\Payflow;
-
 class Pro extends \Magento\Paypal\Model\Pro
 {
     /**
@@ -55,6 +54,7 @@ class Pro extends \Magento\Paypal\Model\Pro
      *
      * @param \Magento\Object $payment
      * @param float $amount
+     * @return void
      */
     public function refund(\Magento\Object $payment, $amount)
     {
@@ -94,8 +94,9 @@ class Pro extends \Magento\Paypal\Model\Pro
     /**
      * Import capture results to payment
      *
-     * @param \Magento\Paypal\Model\Api\Nvp
-     * @param \Magento\Sales\Model\Order\Payment
+     * @param \Magento\Paypal\Model\Api\Nvp $api
+     * @param \Magento\Sales\Model\Order\Payment $payment
+     * @return void
      */
     protected function _importCaptureResultToPayment($api, $payment)
     {
@@ -125,9 +126,10 @@ class Pro extends \Magento\Paypal\Model\Pro
     /**
      * Import refund results to payment
      *
-     * @param \Magento\Paypal\Model\Api\Nvp
-     * @param \Magento\Sales\Model\Order\Payment
+     * @param \Magento\Paypal\Model\Api\Nvp $api
+     * @param \Magento\Sales\Model\Order\Payment $payment
      * @param bool $canRefundMore
+     * @return void
      */
     protected function _importRefundResultToPayment($api, $payment, $canRefundMore)
     {
diff --git a/app/code/Magento/Paypal/Model/Payflow/Request.php b/app/code/Magento/Paypal/Model/Payflow/Request.php
index 8f4f7a3db7f..123db1f5055 100644
--- a/app/code/Magento/Paypal/Model/Payflow/Request.php
+++ b/app/code/Magento/Paypal/Model/Payflow/Request.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Payflow;
 
 /**
  * Payflow Link request model
@@ -31,22 +32,20 @@
  * @package     Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-
-namespace Magento\Paypal\Model\Payflow;
-
 class Request extends \Magento\Object
 {
     /**
      * Set/Get attribute wrapper
      * Also add length path if key contains = or &
      *
-     * @param   string $method
-     * @param   array $args
-     * @return  mixed
+     * @param string $method
+     * @param array $args
+     * @return mixed
+     * @throws \Magento\Exception
      */
     public function __call($method, $args)
     {
-        $key = $this->_underscore(substr($method,3));
+        $key = $this->_underscore(substr($method, 3));
         if (isset($args[0]) && (strstr($args[0], '=') || strstr($args[0], '&'))) {
             $key .= '[' . strlen($args[0]) . ']';
         }
@@ -74,6 +73,6 @@ class Request extends \Magento\Object
                 //\Magento\Profiler::stop('HAS: '.get_class($this).'::'.$method);
                 return isset($this->_data[$key]);
         }
-        throw new \Magento\Exception("Invalid method ".get_class($this)."::".$method."(".print_r($args,1).")");
+        throw new \Magento\Exception("Invalid method ".get_class($this)."::".$method."(".print_r($args, 1).")");
     }
 }
diff --git a/app/code/Magento/Paypal/Model/PayflowDirect.php b/app/code/Magento/Paypal/Model/PayflowDirect.php
index 1c30e094b20..d8f3d961ebc 100644
--- a/app/code/Magento/Paypal/Model/PayflowDirect.php
+++ b/app/code/Magento/Paypal/Model/PayflowDirect.php
@@ -21,11 +21,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Paypal\Model;
 
 class PayflowDirect extends \Magento\Paypal\Model\Direct
 {
+    /**
+     * @var string
+     */
     protected $_code  = \Magento\Paypal\Model\Config::METHOD_WPP_PE_DIRECT;
 
     /**
@@ -65,8 +67,9 @@ class PayflowDirect extends \Magento\Paypal\Model\Direct
     /**
      * Import direct payment results to payment
      *
-     * @param \Magento\Paypal\Model\Api\Nvp
-     * @param \Magento\Sales\Model\Order\Payment
+     * @param \Magento\Paypal\Model\Api\Nvp $api
+     * @param \Magento\Sales\Model\Order\Payment $payment
+     * @return void
      */
     protected function _importResultToPayment($api, $payment)
     {
diff --git a/app/code/Magento/Paypal/Model/PayflowExpress.php b/app/code/Magento/Paypal/Model/PayflowExpress.php
index b1aadf58dea..f74d9c89f24 100644
--- a/app/code/Magento/Paypal/Model/PayflowExpress.php
+++ b/app/code/Magento/Paypal/Model/PayflowExpress.php
@@ -21,13 +21,23 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Paypal\Model;
 
 class PayflowExpress extends \Magento\Paypal\Model\Express
 {
+    /**
+     * @var string
+     */
     protected $_code = \Magento\Paypal\Model\Config::METHOD_WPP_PE_EXPRESS;
+
+    /**
+     * @var string
+     */
     protected $_formBlockType = 'Magento\Paypal\Block\PayflowExpress\Form';
+
+    /**
+     * @var bool
+     */
     protected $_canManageRecurringProfiles = false;
 
     /**
@@ -53,7 +63,7 @@ class PayflowExpress extends \Magento\Paypal\Model\Express
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\UrlInterface $urlBuilder
@@ -65,7 +75,7 @@ class PayflowExpress extends \Magento\Paypal\Model\Express
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\UrlInterface $urlBuilder,
@@ -90,7 +100,7 @@ class PayflowExpress extends \Magento\Paypal\Model\Express
     /**
      * EC PE won't be available if the EC is available
      *
-     * @param \Magento\Sales\Model\Quote $quote
+     * @param \Magento\Sales\Model\Quote|null $quote
      * @return bool
      */
     public function isAvailable($quote = null)
@@ -111,8 +121,9 @@ class PayflowExpress extends \Magento\Paypal\Model\Express
     /**
      * Import payment info to payment
      *
-     * @param \Magento\Paypal\Model\Api\Nvp
-     * @param \Magento\Sales\Model\Order\Payment
+     * @param \Magento\Paypal\Model\Api\Nvp $api
+     * @param \Magento\Sales\Model\Order\Payment $payment
+     * @return void
      */
     protected function _importToPayment($api, $payment)
     {
diff --git a/app/code/Magento/Paypal/Model/PayflowExpress/Checkout.php b/app/code/Magento/Paypal/Model/PayflowExpress/Checkout.php
index 5b7f1ae5877..23eb14c7e87 100644
--- a/app/code/Magento/Paypal/Model/PayflowExpress/Checkout.php
+++ b/app/code/Magento/Paypal/Model/PayflowExpress/Checkout.php
@@ -21,13 +21,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\PayflowExpress;
 
 /**
  * Wrapper that performs Paypal Express and Checkout communication
  * Use current Paypal Express method instance
  */
-namespace Magento\Paypal\Model\PayflowExpress;
-
 class Checkout extends \Magento\Paypal\Model\Express\Checkout
 {
     /**
@@ -46,7 +45,9 @@ class Checkout extends \Magento\Paypal\Model\Express\Checkout
 
     /**
      * Set shipping method to quote, if needed
+     *
      * @param string $methodCode
+     * @return void
      */
     public function updateShippingMethod($methodCode)
     {
diff --git a/app/code/Magento/Paypal/Model/Payflowlink.php b/app/code/Magento/Paypal/Model/Payflowlink.php
index 513ebc7a402..42f1ddeb442 100644
--- a/app/code/Magento/Paypal/Model/Payflowlink.php
+++ b/app/code/Magento/Paypal/Model/Payflowlink.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model;
 
 /**
  * Payflow Link payment gateway model
  */
-namespace Magento\Paypal\Model;
-
 class Payflowlink extends \Magento\Paypal\Model\Payflowpro
 {
     /**
@@ -74,6 +73,8 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
 
     /**
      * Payment method code
+     *
+     * @var string
      */
     protected $_code = \Magento\Paypal\Model\Config::METHOD_PAYFLOWLINK;
 
@@ -87,12 +88,19 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      */
     protected $_infoBlockType = 'Magento\Paypal\Block\Payflow\Link\Info';
 
-    /**#@+
-     * Availability options
+    /**
+     * Availability option
+     *
+     * @var bool
      */
     protected $_canUseInternal          = false;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_isInitializeNeeded      = true;
-    /**#@-*/
 
     /**
      * Request & response model
@@ -142,7 +150,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Logger $logger
      * @param \Magento\Module\ModuleListInterface $moduleList
      * @param \Magento\Core\Model\LocaleInterface $locale
@@ -156,14 +164,14 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      * @param \Magento\App\RequestInterface $requestHttp
      * @param \Magento\Core\Model\WebsiteFactory $websiteFactory
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Logger $logger,
         \Magento\Module\ModuleListInterface $moduleList,
         \Magento\Core\Model\LocaleInterface $locale,
@@ -202,7 +210,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
     /**
      * Do not validate payment form using server methods
      *
-     * @return  bool
+     * @return true
      */
     public function validate()
     {
@@ -212,7 +220,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
     /**
      * Check whether payment method can be used
      *
-     * @param \Magento\Sales\Model\Quote
+     * @param \Magento\Sales\Model\Quote|null $quote
      * @return bool
      */
     public function isAvailable($quote = null)
@@ -233,6 +241,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      *
      * @param string $paymentAction
      * @param \Magento\Object $stateObject
+     * @return void
      */
     public function initialize($paymentAction, $stateObject)
     {
@@ -279,7 +288,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      * Fill response with data.
      *
      * @param array $postData
-     * @return \Magento\Paypal\Model\Payflowlink
+     * @return $this
      */
     public function setResponseData(array $postData)
     {
@@ -311,7 +320,8 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      * Operate with order using data from $_POST which came from Silent Post Url.
      *
      * @param array $responseData
-     * @throws \Magento\Core\Exception in case of validation error or order creation error
+     * @return void
+     * @throws \Magento\Core\Exception In case of validation error or order creation error
      */
     public function process($responseData)
     {
@@ -331,6 +341,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      * Operate with order using information from silent post
      *
      * @param \Magento\Sales\Model\Order $order
+     * @return void
      * @throws \Magento\Core\Exception
      */
     protected function _processOrder(\Magento\Sales\Model\Order $order)
@@ -387,7 +398,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
     /**
      * Get fraud message from response
      *
-     * @return string|bool
+     * @return string|false
      */
     protected function _getFraudMessage()
     {
@@ -403,8 +414,8 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
     /**
      * Check response from Payflow gateway.
      *
-     * @return \Magento\Sales\Model\Order in case of validation passed
-     * @throws \Magento\Core\Exception in other cases
+     * @return false|\Magento\Sales\Model\Order in case of validation passed
+     * @throws \Magento\Core\Exception In other cases
      */
     protected function _getOrderFromResponse()
     {
@@ -580,7 +591,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      *
      * @param mixed $format
      * @param mixed $string
-     * @return mixed
+     * @return string
      */
     protected function _formatStr($format, $string)
     {
@@ -593,6 +604,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      *
      * @param \Magento\Object $response
      * @param \Magento\Sales\Model\Order\Payment $payment
+     * @return void
      * @throws \Magento\Core\Exception
      */
     protected function _processTokenErrors($response, $payment)
@@ -638,6 +650,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      * @deprecated since 1.6.2.0
      * @param \Magento\Object $payment
      * @param string $txnId
+     * @return void
      */
     protected function _addTransaction($payment, $txnId)
     {
@@ -648,8 +661,8 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      *
      * @deprecated since 1.6.2.0
      * @param \Magento\Object $payment
-     * @param  $amount
-     * @return \Magento\Paypal\Model\Payflowlink
+     * @param mixed $amount
+     * @return $this
      */
     protected function _initialize(\Magento\Object $payment, $amount)
     {
@@ -660,7 +673,8 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      * Check whether order review has enough data to initialize
      *
      * @deprecated since 1.6.2.0
-     * @param $token
+     * @param mixed|null $token
+     * @return void
      * @throws \Magento\Core\Exception
      */
     public function prepareOrderReview($token = null)
@@ -675,7 +689,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      * @param mixed $amount
      * @param \Magento\Paypal\Model\Payment\Transaction $transaction
      * @param string $txnId
-     * @return \Magento\Paypal\Model\Payflowlink
+     * @return $this
      */
     protected function _authorize(\Magento\Object $payment, $amount, $transaction, $txnId)
     {
@@ -687,6 +701,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      *
      * @deprecated since 1.6.2.0
      * @param \Magento\Object $document
+     * @return void
      */
     protected function _process(\Magento\Object $document)
     {
@@ -698,7 +713,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      * @deprecated since 1.6.2.0
      * @param \Magento\Paypal\Model\Payment\Transaction $transaction
      * @param mixed $amount
-     * @return \Magento\Paypal\Model\Payflowlink
+     * @return $this
      */
     protected function _checkTransaction($transaction, $amount)
     {
@@ -710,7 +725,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
      *
      * @deprecated since 1.6.2.0
      * @return \Magento\Sales\Model\AbstractModel in case of validation passed
-     * @throws \Magento\Core\Exception in other cases
+     * @throws \Magento\Core\Exception In other cases
      */
     protected function _getDocumentFromResponse()
     {
diff --git a/app/code/Magento/Paypal/Model/Payflowpro.php b/app/code/Magento/Paypal/Model/Payflowpro.php
index 801b8f7cbab..8d4105934fe 100644
--- a/app/code/Magento/Paypal/Model/Payflowpro.php
+++ b/app/code/Magento/Paypal/Model/Payflowpro.php
@@ -23,13 +23,14 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model;
+
+use Magento\Sales\Model\Order\Payment;
 
 /**
  * Payflow Pro payment gateway model
  */
-namespace Magento\Paypal\Model;
-
-class Payflowpro extends  \Magento\Payment\Model\Method\Cc
+class Payflowpro extends \Magento\Payment\Model\Method\Cc
 {
     /**
      * Transaction action codes
@@ -68,42 +69,113 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
 
     /**
      * Payment method code
+     *
+     * @var string
      */
     protected $_code = \Magento\Paypal\Model\Config::METHOD_PAYFLOWPRO;
 
-    /**#@+
+    /**
      * Availability option
+     *
+     * @var bool
      */
     protected $_isGateway               = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canAuthorize            = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canCapture              = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canCapturePartial       = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canRefund               = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canRefundInvoicePartial = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canVoid                 = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canUseInternal          = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canUseCheckout          = true;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canSaveCc = false;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_isProxy = false;
+
+    /**
+     * Availability option
+     *
+     * @var bool
+     */
     protected $_canFetchTransactionInfo = true;
-    /**#@-*/
 
     /**
      * Gateway request timeout
+     *
+     * @var int
      */
     protected $_clientTimeout = 45;
 
     /**
      * Fields that should be replaced in debug with '***'
      *
-     * @var array
+     * @var string[]
      */
     protected $_debugReplacePrivateDataKeys = array('user', 'pwd', 'acct', 'expdate', 'cvv2');
 
     /**
      * Centinel cardinal fields map
      *
-     * @var string
+     * @var string[]
      */
     protected $_centinelFieldMap = array(
         'centinel_mpivendor'    => 'MPIVENDOR3DS',
@@ -112,6 +184,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
         'centinel_eci'          => 'ECI',
         'centinel_xid'          => 'XID',
     );
+
     /**
      * @var \Magento\Core\Model\StoreManagerInterface
      */
@@ -131,7 +204,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Logger $logger
      * @param \Magento\Module\ModuleListInterface $moduleList
      * @param \Magento\Core\Model\LocaleInterface $locale
@@ -140,14 +213,14 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
      * @param \Magento\Paypal\Model\ConfigFactory $configFactory
      * @param \Magento\Math\Random $mathRandom
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Logger $logger,
         \Magento\Module\ModuleListInterface $moduleList,
         \Magento\Core\Model\LocaleInterface $locale,
@@ -176,7 +249,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
     /**
      * Check whether payment method can be used
      *
-     * @param \Magento\Sales\Model\Quote
+     * @param \Magento\Sales\Model\Quote|null $quote
      * @return bool
      */
     public function isAvailable($quote = null)
@@ -211,9 +284,9 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
     /**
      * Authorize payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Payflowpro
+     * @return $this
      */
     public function authorize(\Magento\Object $payment, $amount)
     {
@@ -255,9 +328,9 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
     /**
      * Capture payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Payflowpro
+     * @return $this
      */
     public function capture(\Magento\Object $payment, $amount)
     {
@@ -300,8 +373,8 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
     /**
      * Void payment
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
-     * @return \Magento\Paypal\Model\Payflowpro
+     * @param \Magento\Object|Payment $payment
+     * @return $this
      */
     public function void(\Magento\Object $payment)
     {
@@ -311,7 +384,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
         $response = $this->_postRequest($request);
         $this->_processErrors($response);
 
-        if ($response->getResultCode() == self::RESPONSE_CODE_APPROVED){
+        if ($response->getResultCode() == self::RESPONSE_CODE_APPROVED) {
             $payment->setTransactionId($response->getPnref())
                 ->setIsTransactionClosed(1)
                 ->setShouldCloseParentTransaction(1);
@@ -344,7 +417,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
      * Attempt to void the authorization on cancelling
      *
      * @param \Magento\Object $payment
-     * @return \Magento\Paypal\Model\Payflowpro
+     * @return $this
      */
     public function cancel(\Magento\Object $payment)
     {
@@ -358,9 +431,9 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
     /**
      * Refund capture
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
-     * @return \Magento\Paypal\Model\Payflowpro
+     * @return $this
      */
     public function refund(\Magento\Object $payment, $amount)
     {
@@ -371,7 +444,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
         $response = $this->_postRequest($request);
         $this->_processErrors($response);
 
-        if ($response->getResultCode() == self::RESPONSE_CODE_APPROVED){
+        if ($response->getResultCode() == self::RESPONSE_CODE_APPROVED) {
             $payment->setTransactionId($response->getPnref())
                 ->setIsTransactionClosed(1);
             $payment->setShouldCloseParentTransaction(!$payment->getCreditmemo()->getInvoice()->canRefund());
@@ -426,7 +499,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
     /**
      * Getter for URL to perform Payflow requests, based on test mode by default
      *
-     * @param bool $testMode Ability to specify test mode using
+     * @param bool|null $testMode Ability to specify test mode using
      * @return string
      */
     protected function _getTransactionUrl($testMode = null)
@@ -459,7 +532,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
         );
 
         $_isProxy = $this->getConfigData('use_proxy', false);
-        if ($_isProxy){
+        if ($_isProxy) {
             $_config['proxy'] = $this->getConfigData('proxy_host')
                 . ':'
                 . $this->getConfigData('proxy_port');//http://proxy.shr.secureserver.net:3128',
@@ -513,7 +586,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
     /**
      * Return request object with information for 'authorization' or 'sale' action
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @param float $amount
      * @return \Magento\Object
      */
@@ -525,7 +598,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
         $request->setExpdate(sprintf('%02d', $payment->getCcExpMonth()) . substr($payment->getCcExpYear(), -2, 2));
         $request->setCvv2($payment->getCcCid());
 
-        if ($this->getIsCentinelValidationEnabled()){
+        if ($this->getIsCentinelValidationEnabled()) {
             $params = array();
             $params = $this->getCentinelValidator()->exportCmpiData($params);
             $request = \Magento\Object\Mapper::accumulateByMap($params, $request, $this->_centinelFieldMap);
@@ -568,7 +641,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
     /**
      * Return request object with basic information for gateway request
      *
-     * @param \Magento\Object|\Magento\Sales\Model\Order\Payment $payment
+     * @param \Magento\Object|Payment $payment
      * @return \Magento\Object
      */
     protected function _buildBasicRequest(\Magento\Object $payment)
@@ -598,6 +671,8 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
     /**
      * If response is failed throw exception
      *
+     * @param \Magento\Object $response
+     * @return void
      * @throws \Magento\Core\Exception
      */
     protected function _processErrors(\Magento\Object $response)
@@ -616,6 +691,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
      * Puerto Rico should be as state of USA and not as a country
      *
      * @param \Magento\Object $address
+     * @return void
      */
     protected function _applyCountryWorkarounds(\Magento\Object $address)
     {
@@ -630,7 +706,7 @@ class Payflowpro extends  \Magento\Payment\Model\Method\Cc
      *
      * @param \Magento\Object $payment
      * @param \Magento\Object $request
-     * @return \Magento\Paypal\Model\Payflowpro
+     * @return $this
      */
     protected function _setReferenceTransaction(\Magento\Object $payment, $request)
     {
diff --git a/app/code/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreement.php b/app/code/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreement.php
index e45d90e9fde..65af15c0100 100644
--- a/app/code/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreement.php
+++ b/app/code/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreement.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Payment\Method\Billing;
 
 /**
  * Billing Agreement Payment Method Abstract model
  */
-namespace Magento\Paypal\Model\Payment\Method\Billing;
-
 abstract class AbstractAgreement
     extends \Magento\Payment\Model\Method\AbstractMethod
 {
@@ -36,7 +35,14 @@ abstract class AbstractAgreement
     const TRANSPORT_BILLING_AGREEMENT_ID = 'ba_agreement_id';
     const PAYMENT_INFO_REFERENCE_ID      = 'ba_reference_id';
 
+    /**
+     * @var string
+     */
     protected $_infoBlockType = 'Magento\Paypal\Block\Payment\Info\Billing\Agreement';
+
+    /**
+     * @var string
+     */
     protected $_formBlockType = 'Magento\Paypal\Block\Payment\Form\Billing\Agreement';
 
     /**
@@ -55,7 +61,7 @@ abstract class AbstractAgreement
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory
      * @param array $data
      */
@@ -63,7 +69,7 @@ abstract class AbstractAgreement
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory,
         array $data = array()
     ) {
@@ -74,15 +80,15 @@ abstract class AbstractAgreement
     /**
      * Check whether method is available
      *
-     * @param \Magento\Paypal\Model\Quote $quote
+     * @param \Magento\Paypal\Model\Quote|null $quote
      * @return bool
      */
     public function isAvailable($quote = null)
     {
         if (is_null($this->_isAvailable)) {
-            if (is_object($quote) && $quote->getCustomer()) {
+            if (is_object($quote) && $quote->getCustomerId()) {
                 $availableBA = $this->_agreementFactory->create()->getAvailableCustomerBillingAgreements(
-                    $quote->getCustomer()->getId()
+                    $quote->getCustomerId()
                 );
                 $isAvailableBA = count($availableBA) > 0;
                 $this->_canUseCheckout = $this->_canUseInternal = $isAvailableBA;
@@ -97,8 +103,8 @@ abstract class AbstractAgreement
     /**
      * Assign data to info model instance
      *
-     * @param   mixed $data
-     * @return  \Magento\Payment\Model\Info
+     * @param mixed $data
+     * @return \Magento\Payment\Model\Info
      */
     public function assignData($data)
     {
@@ -114,7 +120,7 @@ abstract class AbstractAgreement
         if ($id) {
             $info = $this->getInfoInstance();
             $ba = $this->_agreementFactory->create()->load($id);
-            if ($ba->getId() && $ba->getCustomerId() == $info->getQuote()->getCustomer()->getId()) {
+            if ($ba->getId() && $ba->getCustomerId() == $info->getQuote()->getCustomerId()) {
                 $info->setAdditionalInformation($key, $id)
                     ->setAdditionalInformation(self::PAYMENT_INFO_REFERENCE_ID, $ba->getReferenceId());
             }
@@ -124,6 +130,7 @@ abstract class AbstractAgreement
 
     /**
      * @param object $quote
+     * @return void
      */
     abstract protected function _isAvailable($quote);
 }
diff --git a/app/code/Magento/Paypal/Model/Payment/Transaction.php b/app/code/Magento/Paypal/Model/Payment/Transaction.php
index 4bae6d8163b..e68cadca693 100644
--- a/app/code/Magento/Paypal/Model/Payment/Transaction.php
+++ b/app/code/Magento/Paypal/Model/Payment/Transaction.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Payment;
 
 /**
  * Payment transaction model
@@ -32,8 +33,6 @@
  * @method string getCreatedAt()
  * @method \Magento\Paypal\Model\Payment\Transaction setCreatedAt(string $value)
  */
-namespace Magento\Paypal\Model\Payment;
-
 class Transaction extends \Magento\Core\Model\AbstractModel
 {
     /**
@@ -46,16 +45,16 @@ class Transaction extends \Magento\Core\Model\AbstractModel
     /**
      * Event object prefix
      *
-     * @see \Magento\Core\Model\Absctract::$_eventPrefix
      * @var string
+     * @see \Magento\Core\Model\Absctract::$_eventPrefix
      */
     protected $_eventPrefix = 'paypal_payment_transaction';
 
     /**
      * Event object prefix
      *
-     * @see \Magento\Core\Model\Absctract::$_eventObject
      * @var string
+     * @see \Magento\Core\Model\Absctract::$_eventObject
      */
     protected $_eventObject = 'paypal_payment_transaction';
 
@@ -72,16 +71,16 @@ class Transaction extends \Magento\Core\Model\AbstractModel
     protected $_dateFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\DateFactory $dateFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\DateFactory $dateFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
@@ -93,6 +92,8 @@ class Transaction extends \Magento\Core\Model\AbstractModel
 
     /**
      * Initialize resource model
+     *
+     * @return null
      */
     protected function _construct()
     {
@@ -102,8 +103,9 @@ class Transaction extends \Magento\Core\Model\AbstractModel
 
     /**
      * Transaction ID setter
+     *
      * @param string $txnId
-     * @return \Magento\Paypal\Model\Payment\Transaction
+     * @return $this
      */
     public function setTxnId($txnId)
     {
@@ -114,8 +116,8 @@ class Transaction extends \Magento\Core\Model\AbstractModel
     /**
      * Check object before loading by by specified transaction ID
      *
-     * @param $txnId
-     * @return \Magento\Paypal\Model\Payment\Transaction
+     * @param string $txnId
+     * @return $this
      */
     protected function _beforeLoadByTxnId($txnId)
     {
@@ -130,7 +132,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel
      * Load self by specified transaction ID. Requires the valid payment object to be set
      *
      * @param string $txnId
-     * @return \Magento\Paypal\Model\Payment\Transaction
+     * @return $this
      */
     public function loadByTxnId($txnId)
     {
@@ -145,7 +147,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel
     /**
      * Check object after loading by by specified transaction ID
      *
-     * @return \Magento\Paypal\Model\Payment\Transaction
+     * @return $this
      */
     protected function _afterLoadByTxnId()
     {
@@ -161,7 +163,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel
      *
      * @param string $key
      * @param mixed $value
-     * @return \Magento\Paypal\Model\Payment\Transaction
+     * @return $this
      * @throws \Magento\Core\Exception
      */
     public function setAdditionalInformation($key, $value)
@@ -179,7 +181,8 @@ class Transaction extends \Magento\Core\Model\AbstractModel
 
     /**
      * Getter for entire additional_information value or one of its element by key
-     * @param string $key
+     * 
+     * @param string|null $key
      * @return array|null|mixed
      */
     public function getAdditionalInformation($key = null)
@@ -197,8 +200,8 @@ class Transaction extends \Magento\Core\Model\AbstractModel
     /**
      * Unsetter for entire additional_information value or one of its element by key
      *
-     * @param string $key
-     * @return \Magento\Paypal\Model\Payment\Transaction
+     * @param string|null $key
+     * @return $this
      */
     public function unsAdditionalInformation($key = null)
     {
@@ -231,7 +234,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel
     /**
      * Verify data required for saving
      *
-     * @return \Magento\Paypal\Model\Payment\Transaction
+     * @return $this
      * @throws \Magento\Core\Exception
      */
     protected function _beforeSave()
@@ -246,6 +249,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel
      * Check whether specified transaction ID is valid
      *
      * @param string $txnId
+     * @return void
      * @throws \Magento\Core\Exception
      */
     protected function _verifyTxnId($txnId)
@@ -259,6 +263,8 @@ class Transaction extends \Magento\Core\Model\AbstractModel
      * Make sure this object is a valid transaction
      *
      * TODO for more restriction we can check for data consistency
+     *
+     * @return void
      * @throws \Magento\Core\Exception
      */
     protected function _verifyThisTransactionExists()
diff --git a/app/code/Magento/Paypal/Model/Pro.php b/app/code/Magento/Paypal/Model/Pro.php
index 59cff81612f..2657d217aa8 100644
--- a/app/code/Magento/Paypal/Model/Pro.php
+++ b/app/code/Magento/Paypal/Model/Pro.php
@@ -23,13 +23,15 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model;
+
+use Magento\RecurringProfile\Model\RecurringProfile;
+use Magento\Paypal\Model\Api\AbstractApi;
 
 /**
  * PayPal Website Payments Pro implementation for payment method instances
  * This model was created because right now PayPal Direct and PayPal Express payment methods cannot have same abstract
  */
-namespace Magento\Paypal\Model;
-
 class Pro
 {
     /**
@@ -131,7 +133,7 @@ class Pro
      * Config instance setter
      *
      * @param \Magento\Paypal\Model\Config $instace
-     * @param int $storeId
+     * @param int|null $storeId
      * @return $this
      */
     public function setConfig(\Magento\Paypal\Model\Config $instace, $storeId = null)
@@ -171,7 +173,7 @@ class Pro
     /**
      * Destroy existing NVP Api object
      *
-     * @return \Magento\Paypal\Model\Pro
+     * @return $this
      */
     public function resetApi()
     {
@@ -196,9 +198,9 @@ class Pro
     /**
      * Transfer transaction/payment information from API instance to order payment
      *
-     * @param \Magento\Object|\Magento\Paypal\Model\Api\AbstractApi $from
+     * @param \Magento\Object|AbstractApi $from
      * @param \Magento\Payment\Model\Info $to
-     * @return \Magento\Paypal\Model\Pro
+     * @return $this
      */
     public function importPaymentInfo(\Magento\Object $from, \Magento\Payment\Model\Info $to)
     {
@@ -230,6 +232,7 @@ class Pro
      * Void transaction
      *
      * @param \Magento\Object $payment
+     * @return void
      * @throws \Magento\Core\Exception
      */
     public function void(\Magento\Object $payment)
@@ -275,6 +278,7 @@ class Pro
      *
      * @param \Magento\Object $payment
      * @param float $amount
+     * @return void
      * @throws \Magento\Core\Exception
      */
     public function refund(\Magento\Object $payment, $amount)
@@ -304,6 +308,7 @@ class Pro
      * Cancel payment
      *
      * @param \Magento\Object $payment
+     * @return void
      */
     public function cancel(\Magento\Object $payment)
     {
@@ -382,10 +387,11 @@ class Pro
     /**
      * Validate RP data
      *
-     * @param \Magento\RecurringProfile\Model\RecurringProfile $profile
+     * @param RecurringProfile $profile
+     * @return void
      * @throws \Magento\Core\Exception
      */
-    public function validateRecurringProfile(\Magento\RecurringProfile\Model\RecurringProfile $profile)
+    public function validateRecurringProfile(RecurringProfile $profile)
     {
         $errors = array();
         if (strlen($profile->getSubscriberName()) > 32) { // up to 32 single-byte chars
@@ -407,11 +413,12 @@ class Pro
     /**
      * Submit RP to the gateway
      *
-     * @param \Magento\RecurringProfile\Model\RecurringProfile $profile
+     * @param RecurringProfile $profile
      * @param \Magento\Payment\Model\Info $paymentInfo
+     * @return void
      * @throws \Magento\Core\Exception
      */
-    public function submitRecurringProfile(\Magento\RecurringProfile\Model\RecurringProfile $profile,
+    public function submitRecurringProfile(RecurringProfile $profile,
         \Magento\Payment\Model\Info $paymentInfo
     ) {
         $api = $this->getApi();
@@ -438,6 +445,7 @@ class Pro
      *
      * @param string $referenceId
      * @param \Magento\Object $result
+     * @return void
      */
     public function getRecurringProfileDetails($referenceId, \Magento\Object $result)
     {
@@ -450,9 +458,10 @@ class Pro
     /**
      * Update RP data
      *
-     * @param \Magento\RecurringProfile\Model\RecurringProfile $profile
+     * @param RecurringProfile $profile
+     * @return void
      */
-    public function updateRecurringProfile(\Magento\RecurringProfile\Model\RecurringProfile $profile)
+    public function updateRecurringProfile(RecurringProfile $profile)
     {
 
     }
@@ -460,9 +469,10 @@ class Pro
     /**
      * Manage status
      *
-     * @param \Magento\RecurringProfile\Model\RecurringProfile $profile
+     * @param RecurringProfile $profile
+     * @return void
      */
-    public function updateRecurringProfileStatus(\Magento\RecurringProfile\Model\RecurringProfile $profile)
+    public function updateRecurringProfileStatus(RecurringProfile $profile)
     {
         $api = $this->getApi();
         $action = null;
@@ -484,8 +494,9 @@ class Pro
     /**
      * Import capture results to payment
      *
-     * @param \Magento\Paypal\Model\Api\Nvp
-     * @param \Magento\Sales\Model\Order\Payment
+     * @param \Magento\Paypal\Model\Api\Nvp $api
+     * @param \Magento\Sales\Model\Order\Payment $payment
+     * @return void
      */
     protected function _importCaptureResultToPayment($api, $payment)
     {
@@ -496,9 +507,10 @@ class Pro
     /**
      * Import refund results to payment
      *
-     * @param \Magento\Paypal\Model\Api\Nvp
-     * @param \Magento\Sales\Model\Order\Payment
+     * @param \Magento\Paypal\Model\Api\Nvp $api
+     * @param \Magento\Sales\Model\Order\Payment $payment
      * @param bool $canRefundMore
+     * @return void
      */
     protected function _importRefundResultToPayment($api, $payment, $canRefundMore)
     {
diff --git a/app/code/Magento/Paypal/Model/Report/Settlement.php b/app/code/Magento/Paypal/Model/Report/Settlement.php
index 9ea857983fd..23c45f5d5bf 100644
--- a/app/code/Magento/Paypal/Model/Report/Settlement.php
+++ b/app/code/Magento/Paypal/Model/Report/Settlement.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Report;
 
 /**
  * Paypal Settlement Report model
@@ -41,8 +42,6 @@
  * @method string getLastModified()
  * @method \Magento\Paypal\Model\Report\Settlement setLastModified(string $value)
  */
-namespace Magento\Paypal\Model\Report;
-
 class Settlement extends \Magento\Core\Model\AbstractModel
 {
     /**
@@ -72,6 +71,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel
 
     /**
      * Reports rows storage
+     *
      * @var array
      */
     protected $_rows = array();
@@ -169,8 +169,8 @@ class Settlement extends \Magento\Core\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\App\Filesystem $filesystem
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -178,8 +178,8 @@ class Settlement extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\App\Filesystem $filesystem,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
@@ -193,6 +193,8 @@ class Settlement extends \Magento\Core\Model\AbstractModel
 
     /**
      * Initialize resource model
+     *
+     * @return void
      */
     protected function _construct()
     {
@@ -300,7 +302,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel
      *
      * @param string $localCsv Path to CSV file
      * @param string $format CSV format(column names)
-     * @return \Magento\Paypal\Model\Report\Settlement
+     * @return $this
      */
     public function parseCsv($localCsv, $format = 'new')
     {
@@ -361,7 +363,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel
     /**
      * Load report by unique key (accoutn + report date)
      *
-     * @return \Magento\Paypal\Model\Report\Settlement
+     * @return $this
      */
     public function loadByAccountAndDate()
     {
diff --git a/app/code/Magento/Paypal/Model/Report/Settlement/Row.php b/app/code/Magento/Paypal/Model/Report/Settlement/Row.php
index 4db5042baa3..f81a008b700 100644
--- a/app/code/Magento/Paypal/Model/Report/Settlement/Row.php
+++ b/app/code/Magento/Paypal/Model/Report/Settlement/Row.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Report\Settlement;
 
 /*
  * Model for report rows
@@ -67,8 +68,6 @@
  * @package     Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Model\Report\Settlement;
-
 class Row extends \Magento\Core\Model\AbstractModel
 {
     /**
@@ -87,6 +86,8 @@ class Row extends \Magento\Core\Model\AbstractModel
 
     /**
      * Initialize resource model
+     *
+     * @return void
      */
     protected function _construct()
     {
@@ -97,7 +98,7 @@ class Row extends \Magento\Core\Model\AbstractModel
      * Return description of Reference ID Type
      * If no code specified, return full list of codes with their description
      *
-     * @param string code
+     * @param string|null $code
      * @return string|array
      */
     public function getReferenceType($code = null)
@@ -121,7 +122,7 @@ class Row extends \Magento\Core\Model\AbstractModel
     /**
      * Get native description for transaction code
      *
-     * @param string code
+     * @param string $code
      * @return string
      */
     public function getTransactionEvent($code)
@@ -148,7 +149,7 @@ class Row extends \Magento\Core\Model\AbstractModel
      * Return description of "Debit or Credit" value
      * If no code specified, return full list of codes with their description
      *
-     * @param string code
+     * @param string|null $code
      * @return string|array
      */
     public function getDebitCreditText($code = null)
@@ -169,8 +170,8 @@ class Row extends \Magento\Core\Model\AbstractModel
     /**
      * Invoke casting some amounts
      *
-     * @param mixed $key
-     * @param mixed $index
+     * @param string $key
+     * @param string|int|null $index
      * @return mixed
      */
     public function getData($key = '', $index = null)
@@ -188,6 +189,7 @@ class Row extends \Magento\Core\Model\AbstractModel
      *
      * @param string $key
      * @param string $creditKey
+     * @return void
      */
     public function _castAmount($key, $creditKey)
     {
@@ -207,6 +209,8 @@ class Row extends \Magento\Core\Model\AbstractModel
 
     /**
      * Fill/translate and sort all event codes/labels
+     *
+     * @return void
      */
     protected function _generateEventLabels()
     {
diff --git a/app/code/Magento/Paypal/Model/Resource/Billing/Agreement.php b/app/code/Magento/Paypal/Model/Resource/Billing/Agreement.php
index e12df7c2fa5..1cb03121487 100644
--- a/app/code/Magento/Paypal/Model/Resource/Billing/Agreement.php
+++ b/app/code/Magento/Paypal/Model/Resource/Billing/Agreement.php
@@ -21,18 +21,17 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Paypal\Model\Resource\Billing;
 
 /**
  * Billing agreement resource model
  */
-namespace Magento\Paypal\Model\Resource\Billing;
-
 class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb
 {
     /**
      * Resource initialization
      *
+     * @return void
      */
     protected function _construct()
     {
@@ -44,7 +43,7 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb
      *
      * @param int $agreementId
      * @param int $orderId
-     * @return \Magento\Paypal\Model\Resource\Billing\Agreement
+     * @return $this
      */
     public function addOrderRelation($agreementId, $orderId)
     {
diff --git a/app/code/Magento/Paypal/Model/Resource/Billing/Agreement/Collection.php b/app/code/Magento/Paypal/Model/Resource/Billing/Agreement/Collection.php
index 6d1dfa08368..9ebedd5d656 100644
--- a/app/code/Magento/Paypal/Model/Resource/Billing/Agreement/Collection.php
+++ b/app/code/Magento/Paypal/Model/Resource/Billing/Agreement/Collection.php
@@ -21,12 +21,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Resource\Billing\Agreement;
+
+use Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
 
 /**
  * Billing agreements resource collection
  */
-namespace Magento\Paypal\Model\Resource\Billing\Agreement;
-
 class Collection
     extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection
 {
@@ -48,12 +49,18 @@ class Collection
      */
     protected $_customerResource;
 
+    /**
+     * @var \Magento\Eav\Helper\Data
+     */
+    protected $_eavHelper;
+
     /**
      * @param \Magento\Core\Model\EntityFactory $entityFactory
      * @param \Magento\Logger $logger
      * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Customer\Model\Resource\Customer $customerResource
+     * @param \Magento\Eav\Helper\Data $eavHelper
      * @param mixed $connection
      * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource
      */
@@ -63,15 +70,19 @@ class Collection
         \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Customer\Model\Resource\Customer $customerResource,
+        \Magento\Eav\Helper\Data $eavHelper,
         $connection = null,
         \Magento\Core\Model\Resource\Db\AbstractDb $resource = null
     ) {
         parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource);
+        $this->_eavHelper = $eavHelper;
         $this->_customerResource = $customerResource;
     }
 
     /**
      * Collection initialization
+     *
+     * @return void
      */
     protected function _construct()
     {
@@ -81,7 +92,7 @@ class Collection
     /**
      * Add customer details(email, firstname, lastname) to select
      *
-     * @return \Magento\Paypal\Model\Resource\Billing\Agreement\Collection
+     * @return $this
      */
     public function addCustomerDetails()
     {
@@ -92,24 +103,30 @@ class Collection
         );
 
         $adapter  = $this->getConnection();
-        $attr     = $this->_customerResource->getAttribute('firstname');
+        $firstNameMetadata = $this->_eavHelper->getAttributeMetadata(
+            CustomerMetadataServiceInterface::ENTITY_TYPE_CUSTOMER,
+            'firstname'
+        );
         $joinExpr = 'firstname.entity_id = main_table.customer_id AND '
-            . $adapter->quoteInto('firstname.entity_type_id = ?', $this->_customerResource->getTypeId()) . ' AND '
-            . $adapter->quoteInto('firstname.attribute_id = ?', $attr->getAttributeId());
+            . $adapter->quoteInto('firstname.entity_type_id = ?', $firstNameMetadata['entity_type_id']) . ' AND '
+            . $adapter->quoteInto('firstname.attribute_id = ?', $firstNameMetadata['attribute_id']);
 
         $select->joinLeft(
-            array('firstname' => $attr->getBackend()->getTable()),
+            array('firstname' => $firstNameMetadata['attribute_table']),
             $joinExpr,
             array('customer_firstname' => 'value')
         );
 
-        $attr = $this->_customerResource->getAttribute('lastname');
+        $lastNameMetadata = $this->_eavHelper->getAttributeMetadata(
+            CustomerMetadataServiceInterface::ENTITY_TYPE_CUSTOMER,
+            'lastname'
+        );
         $joinExpr = 'lastname.entity_id = main_table.customer_id AND '
-            . $adapter->quoteInto('lastname.entity_type_id = ?', $this->_customerResource->getTypeId()) . ' AND '
-            . $adapter->quoteInto('lastname.attribute_id = ?', $attr->getAttributeId());
+            . $adapter->quoteInto('lastname.entity_type_id = ?', $lastNameMetadata['entity_type_id']) . ' AND '
+            . $adapter->quoteInto('lastname.attribute_id = ?', $lastNameMetadata['attribute_id']);
 
         $select->joinLeft(
-            array('lastname' => $attr->getBackend()->getTable()),
+            array('lastname' => $lastNameMetadata['attribute_table']),
             $joinExpr,
             array('customer_lastname' => 'value')
         );
diff --git a/app/code/Magento/Paypal/Model/Resource/Cert.php b/app/code/Magento/Paypal/Model/Resource/Cert.php
index 6d1ff86efa3..6d2537c6e7c 100644
--- a/app/code/Magento/Paypal/Model/Resource/Cert.php
+++ b/app/code/Magento/Paypal/Model/Resource/Cert.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Resource;
 
 /**
  * PayPal resource model for certificate based authentication
  */
-namespace Magento\Paypal\Model\Resource;
-
 class Cert extends \Magento\Core\Model\Resource\Db\AbstractDb
 {
     /**
@@ -58,6 +57,8 @@ class Cert extends \Magento\Core\Model\Resource\Db\AbstractDb
 
     /**
      * Initialize connection
+     *
+     * @return void
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Paypal/Model/Resource/Payment/Transaction.php b/app/code/Magento/Paypal/Model/Resource/Payment/Transaction.php
index 2107aa5167e..c4b4b313900 100644
--- a/app/code/Magento/Paypal/Model/Resource/Payment/Transaction.php
+++ b/app/code/Magento/Paypal/Model/Resource/Payment/Transaction.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Resource\Payment;
 
 /**
  * Paypal transaction resource model
@@ -32,8 +33,6 @@
  * @package     Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Model\Resource\Payment;
-
 class Transaction extends \Magento\Core\Model\Resource\Db\AbstractDb
 {
     /**
@@ -48,6 +47,7 @@ class Transaction extends \Magento\Core\Model\Resource\Db\AbstractDb
     /**
      * Initialize main table and the primary key field name
      *
+     * @return void
      */
     protected function _construct()
     {
@@ -59,6 +59,7 @@ class Transaction extends \Magento\Core\Model\Resource\Db\AbstractDb
      *
      * @param \Magento\Paypal\Model\Payment\Transaction $transaction
      * @param string $txnId
+     * @return void
      */
     public function loadObjectByTxnId(\Magento\Paypal\Model\Payment\Transaction $transaction, $txnId)
     {
@@ -72,10 +73,9 @@ class Transaction extends \Magento\Core\Model\Resource\Db\AbstractDb
     /**
      * Serialize additional information, if any
      *
-     * @throws \Magento\Core\Exception
-     *
      * @param \Magento\Core\Model\AbstractModel $transaction
-     * @return \Magento\Paypal\Model\Resource\Payment\Transaction
+     * @return $this
+     * @throws \Magento\Core\Exception
      */
     protected function _beforeSave(\Magento\Core\Model\AbstractModel $transaction)
     {
@@ -97,9 +97,9 @@ class Transaction extends \Magento\Core\Model\Resource\Db\AbstractDb
      * Load cell/row by specified unique key parts
      *
      * @param string $txnId
-     * @param mixed (array|string|object) $columns
+     * @param array|string|object $columns
      * @param bool $isRow
-     * @return mixed (array|string)
+     * @return array|string
      */
     private function _lookupByTxnId($txnId, $columns, $isRow = false)
     {
diff --git a/app/code/Magento/Paypal/Model/Resource/Payment/Transaction/Collection.php b/app/code/Magento/Paypal/Model/Resource/Payment/Transaction/Collection.php
index 7bfd6f74094..b20ce322597 100644
--- a/app/code/Magento/Paypal/Model/Resource/Payment/Transaction/Collection.php
+++ b/app/code/Magento/Paypal/Model/Resource/Payment/Transaction/Collection.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Resource\Payment\Transaction;
 
 /**
  * Payment transactions collection
@@ -32,8 +33,6 @@
  * @package     Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Model\Resource\Payment\Transaction;
-
 class Collection
     extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection
 {
@@ -45,6 +44,8 @@ class Collection
     protected $_createdBefore          = "";
     /**
      * Initialize collection items factory class
+     *
+     * @return void
      */
     protected function _construct()
     {
@@ -56,7 +57,7 @@ class Collection
      * CreatedAt filter setter
      *
      * @param string $date
-     * @return \Magento\Sales\Model\Resource\Order\Payment\Transaction\Collection
+     * @return $this
      */
     public function addCreatedBeforeFilter($date)
     {
@@ -67,7 +68,7 @@ class Collection
     /**
      * Prepare filters
      *
-     * @return \Magento\Paypal\Model\Resource\Payment\Transaction\Collection
+     * @return $this
      */
     protected function _beforeLoad()
     {
@@ -87,7 +88,7 @@ class Collection
     /**
      * Unserialize additional_information in each item
      *
-     * @return \Magento\Paypal\Model\Resource\Payment\Transaction\Collection
+     * @return $this
      */
     protected function _afterLoad()
     {
diff --git a/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php b/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php
index 558399f2d36..c7e25320d76 100644
--- a/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php
+++ b/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Resource\Report;
 
 /**
  * Report settlement resource model
  */
-namespace Magento\Paypal\Model\Resource\Report;
-
 class Settlement extends \Magento\Core\Model\Resource\Db\AbstractDb
 {
     /**
@@ -55,6 +54,8 @@ class Settlement extends \Magento\Core\Model\Resource\Db\AbstractDb
 
     /**
      * Init main table
+     *
+     * @return void
      */
     protected function _construct()
     {
@@ -66,7 +67,7 @@ class Settlement extends \Magento\Core\Model\Resource\Db\AbstractDb
      * Save report rows collected in settlement model
      *
      * @param \Magento\Core\Model\AbstractModel|\Magento\Paypal\Model\Report\Settlement $object
-     * @return \Magento\Paypal\Model\Resource\Report\Settlement
+     * @return $this
      */
     protected function _afterSave(\Magento\Core\Model\AbstractModel $object)
     {
@@ -117,7 +118,7 @@ class Settlement extends \Magento\Core\Model\Resource\Db\AbstractDb
      * @param \Magento\Paypal\Model\Report\Settlement $report
      * @param string $accountId
      * @param string $reportDate
-     * @return \Magento\Paypal\Model\Resource\Report\Settlement
+     * @return $this
      */
     public function loadByAccountAndDate(\Magento\Paypal\Model\Report\Settlement $report, $accountId, $reportDate)
     {
diff --git a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Options/TransactionEvents.php b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Options/TransactionEvents.php
index e62a8c2425d..7359f514295 100644
--- a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Options/TransactionEvents.php
+++ b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Options/TransactionEvents.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\Resource\Report\Settlement\Options;
 
 /**
  * Transaction Events Types Options
@@ -31,10 +32,8 @@
  * @package     Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Model\Resource\Report\Settlement\Options;
-
 class TransactionEvents
-    implements \Magento\Core\Model\Option\ArrayInterface
+    implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Paypal\Model\Report\Settlement\Row
@@ -50,9 +49,7 @@ class TransactionEvents
     }
 
     /**
-     *  Get full list of codes with their description
-     *
-     * @return array
+     * {@inheritdoc}
      */
     public function toOptionArray()
     {
diff --git a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row.php b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row.php
index 81d245cd965..73de8f5017e 100644
--- a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row.php
+++ b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row.php
@@ -23,22 +23,22 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Paypal\Model\Resource\Report\Settlement;
 
 /**
- *Report settlement row resource model
+ * Report settlement row resource model
  *
  * @category    Magento
  * @package     Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Model\Resource\Report\Settlement;
-
 class Row extends \Magento\Core\Model\Resource\Db\AbstractDb
 {
     /**
      * Resource model initialization.
      * Set main entity table name and primary key field name.
+     *
+     * @return void
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row/Collection.php b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row/Collection.php
index 30fdafd7100..3d4833834d6 100644
--- a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row/Collection.php
+++ b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row/Collection.php
@@ -40,6 +40,7 @@ class Collection
     /**
      * Resource initializing
      *
+     * @return void
      */
     protected function _construct()
     {
@@ -49,7 +50,7 @@ class Collection
     /**
      * Join reports info table
      *
-     * @return \Magento\Paypal\Model\Resource\Report\Settlement\Row\Collection
+     * @return $this
      */
     protected function _initSelect()
     {
@@ -67,7 +68,7 @@ class Collection
      * Filter items collection by account ID
      *
      * @param string $accountId
-     * @return \Magento\Paypal\Model\Resource\Report\Settlement\Row\Collection
+     * @return $this
      */
     public function addAccountFilter($accountId)
     {
diff --git a/app/code/Magento/Paypal/Model/Standard.php b/app/code/Magento/Paypal/Model/Standard.php
index 0734dd826d7..98854280f0b 100644
--- a/app/code/Magento/Paypal/Model/Standard.php
+++ b/app/code/Magento/Paypal/Model/Standard.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model;
 
 /**
  * PayPal Standard Checkout Module
  */
-namespace Magento\Paypal\Model;
-
 class Standard extends \Magento\Payment\Model\Method\AbstractMethod
 {
     /**
@@ -46,7 +45,14 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod
      */
     protected $_infoBlockType = 'Magento\Paypal\Block\Payment\Info';
 
+    /**
+     * @var bool
+     */
     protected $_isInitializeNeeded      = true;
+
+    /**
+     * @var bool
+     */
     protected $_canUseInternal          = false;
 
     /**
@@ -100,7 +106,7 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Session\Generic $paypalSession
      * @param \Magento\Checkout\Model\Session $checkoutSession
      * @param \Magento\UrlInterface $urlBuilder
@@ -117,7 +123,7 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Session\Generic $paypalSession,
         \Magento\Checkout\Model\Session $checkoutSession,
         \Magento\UrlInterface $urlBuilder,
@@ -183,6 +189,8 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Create main block for standard form
      *
+     * @param string $name
+     * @return \Magento\View\Element\AbstractBlock
      */
     public function createFormBlock($name)
     {
@@ -201,7 +209,7 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod
      */
     public function getOrderPlaceRedirectUrl()
     {
-          return $this->_urlBuilder->getUrl('paypal/standard/redirect', array('_secure' => true));
+        return $this->_urlBuilder->getUrl('paypal/standard/redirect', array('_secure' => true));
     }
 
     /**
@@ -247,7 +255,7 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod
      *
      * @param string $paymentAction
      * @param object $stateObject
-     * @return \Magento\Payment\Model\Method\AbstractMethod|void
+     * @return void
      */
     public function initialize($paymentAction, $stateObject)
     {
@@ -276,7 +284,7 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod
 
     /**
      * Check whether payment method can be used
-     * @param \Magento\Sales\Model\Quote
+     * @param \Magento\Sales\Model\Quote|null $quote
      * @return bool
      */
     public function isAvailable($quote = null)
@@ -291,7 +299,7 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod
      * Custom getter for payment configuration
      *
      * @param string $field
-     * @param int $storeId
+     * @param int|null $storeId
      * @return mixed
      */
     public function getConfigData($field, $storeId = null)
diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php b/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php
index 65a5e8e16b1..fa7f05464e4 100644
--- a/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php
+++ b/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\System\Config\Backend;
 
 /**
  * Backend model for saving certificate file in case of using certificate based authentication
  */
-namespace Magento\Paypal\Model\System\Config\Backend;
-
 class Cert extends \Magento\Core\Model\Config\Value
 {
     /**
@@ -47,8 +46,8 @@ class Cert extends \Magento\Core\Model\Config\Value
     protected $_tmpDirectory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Paypal\Model\CertFactory $certFactory
@@ -59,8 +58,8 @@ class Cert extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Paypal\Model\CertFactory $certFactory,
@@ -79,7 +78,7 @@ class Cert extends \Magento\Core\Model\Config\Value
     /**
      * Process additional data before save config
      *
-     * @return \Magento\Paypal\Model\System\Config\Backend\Cert
+     * @return $this
      * @throws \Magento\Core\Exception
      */
     protected function _beforeSave()
@@ -112,7 +111,7 @@ class Cert extends \Magento\Core\Model\Config\Value
     /**
      * Process object after delete data
      *
-     * @return \Magento\Paypal\Model\System\Config\Backend\Cert
+     * @return $this
      */
     protected function _afterDelete()
     {
diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php b/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php
index b6063a3dd38..a9dca446c2f 100644
--- a/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php
+++ b/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php
@@ -23,7 +23,6 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
 namespace Magento\Paypal\Model\System\Config\Backend;
 
 class Cron extends \Magento\Core\Model\Config\Value
@@ -37,8 +36,8 @@ class Cron extends \Magento\Core\Model\Config\Value
     protected $_configValueFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory
@@ -47,8 +46,8 @@ class Cron extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\Config\ValueFactory $configValueFactory,
@@ -64,6 +63,8 @@ class Cron extends \Magento\Core\Model\Config\Value
 
     /**
      * Cron settings after save
+     *
+     * @return $this
      */
     protected function _afterSave()
     {
diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php b/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php
index 326b780a9e3..f3671a984d5 100644
--- a/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php
+++ b/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php
@@ -23,12 +23,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\System\Config\Backend;
 
 /**
  * Backend model for merchant country. Default country used instead of empty value.
  */
-namespace Magento\Paypal\Model\System\Config\Backend;
-
 class MerchantCountry extends \Magento\Core\Model\Config\Value
 {
     /**
@@ -39,8 +38,8 @@ class MerchantCountry extends \Magento\Core\Model\Config\Value
     protected $_coreData;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Helper\Data $coreData
@@ -49,8 +48,8 @@ class MerchantCountry extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Helper\Data $coreData,
@@ -64,6 +63,8 @@ class MerchantCountry extends \Magento\Core\Model\Config\Value
 
     /**
      * Substitute empty value with Default country.
+     *
+     * @return void
      */
     protected function _afterLoad()
     {
diff --git a/app/code/Magento/Paypal/Model/System/Config/Source/AuthorizationAmounts.php b/app/code/Magento/Paypal/Model/System/Config/Source/AuthorizationAmounts.php
index e0bc6a3ac0f..83ddfda9016 100644
--- a/app/code/Magento/Paypal/Model/System/Config/Source/AuthorizationAmounts.php
+++ b/app/code/Magento/Paypal/Model/System/Config/Source/AuthorizationAmounts.php
@@ -23,6 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\System\Config\Source;
 
 /**
  * Source model for available Authorization Amounts for Account Verification
@@ -32,14 +33,10 @@
  * @package     Magento_Paypal
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Paypal\Model\System\Config\Source;
-
-class AuthorizationAmounts implements \Magento\Core\Model\Option\ArrayInterface
+class AuthorizationAmounts implements \Magento\Option\ArrayInterface
 {
     /**
-     * Options getter
-     *
-     * @return array
+     * {@inheritdoc}
      */
     public function toOptionArray()
     {
diff --git a/app/code/Magento/Paypal/Model/System/Config/Source/BuyerCountry.php b/app/code/Magento/Paypal/Model/System/Config/Source/BuyerCountry.php
index 341b31c8e3a..234ff0e3d3d 100644
--- a/app/code/Magento/Paypal/Model/System/Config/Source/BuyerCountry.php
+++ b/app/code/Magento/Paypal/Model/System/Config/Source/BuyerCountry.php
@@ -23,13 +23,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\System\Config\Source;
 
 /**
  * Source model for buyer countries supported by PayPal
  */
-namespace Magento\Paypal\Model\System\Config\Source;
-
-class BuyerCountry implements \Magento\Core\Model\Option\ArrayInterface
+class BuyerCountry implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Paypal\Model\ConfigFactory
@@ -54,8 +53,7 @@ class BuyerCountry implements \Magento\Core\Model\Option\ArrayInterface
     }
 
     /**
-     * @param bool $isMultiselect
-     * @return array
+     * {@inheritdoc}
      */
     public function toOptionArray($isMultiselect = false)
     {
diff --git a/app/code/Magento/Paypal/Model/System/Config/Source/FetchingSchedule.php b/app/code/Magento/Paypal/Model/System/Config/Source/FetchingSchedule.php
index 512bb653d64..bdbb02e34d0 100644
--- a/app/code/Magento/Paypal/Model/System/Config/Source/FetchingSchedule.php
+++ b/app/code/Magento/Paypal/Model/System/Config/Source/FetchingSchedule.php
@@ -23,14 +23,16 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\System\Config\Source;
 
 /**
  * Source model for available settlement report fetching intervals
  */
-namespace Magento\Paypal\Model\System\Config\Source;
-
-class FetchingSchedule implements \Magento\Core\Model\Option\ArrayInterface
+class FetchingSchedule implements \Magento\Option\ArrayInterface
 {
+    /**
+     * {@inheritdoc}
+     */
     public function toOptionArray()
     {
         return array (
diff --git a/app/code/Magento/Paypal/Model/System/Config/Source/Logo.php b/app/code/Magento/Paypal/Model/System/Config/Source/Logo.php
index 06036cf598c..4cd14b9e80d 100644
--- a/app/code/Magento/Paypal/Model/System/Config/Source/Logo.php
+++ b/app/code/Magento/Paypal/Model/System/Config/Source/Logo.php
@@ -23,13 +23,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\System\Config\Source;
 
 /**
  * Source model for available logo types
  */
-namespace Magento\Paypal\Model\System\Config\Source;
-
-class Logo implements \Magento\Core\Model\Option\ArrayInterface
+class Logo implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Paypal\Model\ConfigFactory
@@ -45,7 +44,7 @@ class Logo implements \Magento\Core\Model\Option\ArrayInterface
     }
 
     /**
-     * @return array
+     * {@inheritdoc}
      */
     public function toOptionArray()
     {
diff --git a/app/code/Magento/Paypal/Model/System/Config/Source/MerchantCountry.php b/app/code/Magento/Paypal/Model/System/Config/Source/MerchantCountry.php
index 0d98d5cc45f..d645a86a136 100644
--- a/app/code/Magento/Paypal/Model/System/Config/Source/MerchantCountry.php
+++ b/app/code/Magento/Paypal/Model/System/Config/Source/MerchantCountry.php
@@ -23,13 +23,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\System\Config\Source;
 
 /**
  * Source model for merchant countries supported by PayPal
  */
-namespace Magento\Paypal\Model\System\Config\Source;
-
-class MerchantCountry implements \Magento\Core\Model\Option\ArrayInterface
+class MerchantCountry implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Paypal\Model\ConfigFactory
@@ -54,8 +53,7 @@ class MerchantCountry implements \Magento\Core\Model\Option\ArrayInterface
     }
 
     /**
-     * @param bool $isMultiselect
-     * @return array
+     * {@inheritdoc}
      */
     public function toOptionArray($isMultiselect = false)
     {
diff --git a/app/code/Magento/Paypal/Model/System/Config/Source/PaymentActions.php b/app/code/Magento/Paypal/Model/System/Config/Source/PaymentActions.php
index 02ebab4a6e1..323a60bae27 100644
--- a/app/code/Magento/Paypal/Model/System/Config/Source/PaymentActions.php
+++ b/app/code/Magento/Paypal/Model/System/Config/Source/PaymentActions.php
@@ -23,13 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\System\Config\Source;
 
 /**
  * Source model for available payment actions
  */
-namespace Magento\Paypal\Model\System\Config\Source;
 
-class PaymentActions implements \Magento\Core\Model\Option\ArrayInterface
+class PaymentActions implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Paypal\Model\ConfigFactory
@@ -45,9 +45,7 @@ class PaymentActions implements \Magento\Core\Model\Option\ArrayInterface
     }
 
     /**
-     * Options getter
-     *
-     * @return array
+     * {@inheritdoc}
      */
     public function toOptionArray()
     {
diff --git a/app/code/Magento/Paypal/Model/System/Config/Source/PaymentActions/Express.php b/app/code/Magento/Paypal/Model/System/Config/Source/PaymentActions/Express.php
index 1edd5e213f7..c1e6706bfce 100644
--- a/app/code/Magento/Paypal/Model/System/Config/Source/PaymentActions/Express.php
+++ b/app/code/Magento/Paypal/Model/System/Config/Source/PaymentActions/Express.php
@@ -23,14 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\System\Config\Source\PaymentActions;
 
 /**
  * Source model for available paypal express payment actions
  */
-namespace Magento\Paypal\Model\System\Config\Source\PaymentActions;
-
 class Express
-    implements \Magento\Core\Model\Option\ArrayInterface
+    implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Paypal\Model\ConfigFactory
@@ -46,9 +45,7 @@ class Express
     }
 
     /**
-     * Options getter
-     *
-     * @return array
+     * {@inheritdoc}
      */
     public function toOptionArray()
     {
diff --git a/app/code/Magento/Paypal/Model/System/Config/Source/RequireBillingAddress.php b/app/code/Magento/Paypal/Model/System/Config/Source/RequireBillingAddress.php
index 403556584a4..81dfcd5f4c7 100644
--- a/app/code/Magento/Paypal/Model/System/Config/Source/RequireBillingAddress.php
+++ b/app/code/Magento/Paypal/Model/System/Config/Source/RequireBillingAddress.php
@@ -23,14 +23,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\System\Config\Source;
 
 /**
  * Source model for Require Billing Address
  */
-namespace Magento\Paypal\Model\System\Config\Source;
-
 class RequireBillingAddress
-    implements \Magento\Core\Model\Option\ArrayInterface
+    implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Paypal\Model\ConfigFactory
@@ -46,9 +45,7 @@ class RequireBillingAddress
     }
 
     /**
-     * Options getter
-     *
-     * @return array
+     * {@inheritdoc}
      */
     public function toOptionArray()
     {
diff --git a/app/code/Magento/Paypal/Model/System/Config/Source/UrlMethod.php b/app/code/Magento/Paypal/Model/System/Config/Source/UrlMethod.php
index 58cdac2d596..e940102f13e 100644
--- a/app/code/Magento/Paypal/Model/System/Config/Source/UrlMethod.php
+++ b/app/code/Magento/Paypal/Model/System/Config/Source/UrlMethod.php
@@ -23,18 +23,15 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Paypal\Model\System\Config\Source;
 
 /**
  * Source model for url method: GET/POST
  */
-namespace Magento\Paypal\Model\System\Config\Source;
-
-class UrlMethod implements \Magento\Core\Model\Option\ArrayInterface
+class UrlMethod implements \Magento\Option\ArrayInterface
 {
     /**
-     * Options getter
-     *
-     * @return array
+     * {@inheritdoc}
      */
     public function toOptionArray()
     {
diff --git a/app/code/Magento/Paypal/etc/module.xml b/app/code/Magento/Paypal/etc/module.xml
index 4a6524533f8..a4394551212 100755
--- a/app/code/Magento/Paypal/etc/module.xml
+++ b/app/code/Magento/Paypal/etc/module.xml
@@ -42,6 +42,7 @@
             <module name="Magento_Centinel"/>
             <module name="Magento_Catalog"/>
             <module name="Magento_RecurringProfile"/>
+            <module name="Magento_Eav"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/Paypal/etc/payment.xml b/app/code/Magento/Paypal/etc/payment.xml
index 4e21c0e33ac..27493a348af 100644
--- a/app/code/Magento/Paypal/etc/payment.xml
+++ b/app/code/Magento/Paypal/etc/payment.xml
@@ -41,6 +41,11 @@
         </group>
     </groups>
     <methods>
+        <method name="paypal_express">
+            <support_recurring_payment>1</support_recurring_payment>
+            <allow_multiple_address>1</allow_multiple_address>
+            <allow_multiple_with_3dsecure>1</allow_multiple_with_3dsecure>
+        </method>
         <method name="paypal_direct">
             <allow_multiple_address>1</allow_multiple_address>
             <allow_multiple_with_3dsecure>1</allow_multiple_with_3dsecure>
diff --git a/app/code/Magento/Paypal/i18n/de_DE.csv b/app/code/Magento/Paypal/i18n/de_DE.csv
index c10284950a9..635156ea4fb 100644
--- a/app/code/Magento/Paypal/i18n/de_DE.csv
+++ b/app/code/Magento/Paypal/i18n/de_DE.csv
@@ -65,8 +65,8 @@
 "Your billing agreement # is: %s.","Die Nummer Ihrer Zustimmung zur Abrechnung lautet: %s."
 "Bonus for first ACH Use","Bonus für erste ACH-Benutzung"
 "Buyer Credit Payment","Käuferkredit Zahlung"
-"Buyer\'s Tax ID","Steuernummer des Käufers"
-"Buyer\'s Tax ID Type","Art der Steuernummer des Käufers"
+"Buyer's Tax ID","Steuernummer des Käufers"
+"Buyer's Tax ID Type","Art der Steuernummer des Käufers"
 "By default it is ""reports.paypal.com"".","Standardmäßige Einstellung ist ""reports.paypal.com""."
 "CNPJ","CNPJ"
 "CPF","CPF"
@@ -220,7 +220,7 @@
 "Merchant Liability","Haftbarkeit des Händlers"
 "Merchant Protection Eligibility","Händlerschutz Berechtigung"
 "Merchant Referral Bonus","Händler Empfehlungsbonus"
-"Merchant account doesn\'t have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","Das Händlerkonto hat keine Abhebungsfunktion. Der Händler muss die Zahlung manuell annehmen oder ablehnen im ""Account Overview"" (Kontoübersicht)."
+"Merchant account doesn't have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","Das Händlerkonto hat keine Abhebungsfunktion. Der Händler muss die Zahlung manuell annehmen oder ablehnen im ""Account Overview"" (Kontoübersicht)."
 "Merchant account is not verified.","Händlerkonto ist nicht verifiziert."
 "Merchant denied this pending payment.","Der Händler hat diese ausstehende Zahlung verweigert."
 "Merchant holds a non-U.S. account and does not have a withdrawal mechanism.","Der Händler besitzt ein Nicht-US Konto und hat keinen Überweisungsautomatismus."
@@ -416,7 +416,7 @@
 "The image at the top left of the checkout page. Max size is 750x90-pixel. <strong style=""color:red"">https</strong> is highly encouraged.","Das Bild oben links auf der Checkout-Seite. Max. Größe 750 x 90 Pixel. <strong style=""color:red"">https</strong> wird dringend empfohlen."
 "The maximum number of child authorizations is reached.","Die maximal mögliche Anzahl an Kinder-Autorisationen ist erreicht."
 "The merchant account is not yet verified.","Das Händlerkonto wurde noch nicht verifiziert."
-"The payment curency does not match any of the merchant\'s balances currency.","Die Währung der Zahlung stimmt mit keiner der Währungen des Kontos des Händlers überein."
+"The payment curency does not match any of the merchant's balances currency.","Die Währung der Zahlung stimmt mit keiner der Währungen des Kontos des Händlers überein."
 "The payment eCheck is not yet cleared.","Zahlung per eCheck ist noch nicht vereinbart."
 "The payment is authorized but not settled.","Die Zahlung wurde autorisiert aber noch nicht ausgeführt."
 "The payment is pending because it was made to an email address that is not yet registered or confirmed.","Die Zahlung steht noch aus, da sie an eine Email-Adresse versandt wurde, die weder registriert noch bestätigt ist."
@@ -463,7 +463,7 @@
 "Virtual PayPal Debit Card Transaction","Virtuelle PayPal Überweisung mit Debitkarte"
 "Virtual Terminal Payment","Virtuelles Zahlungsterminal"
 "Void","Leer"
-"Waiting until Customer\'s eCheck will be cleared.","Warten bis der eCheck des Kunden freigegeben ist."
+"Waiting until Customer's eCheck will be cleared.","Warten bis der eCheck des Kunden freigegeben ist."
 "We prefer PayPal (150 X 40)","Wir bevorzugen PayPal (150 X 40)"
 "We prefer PayPal (150 X 60)","Wir bevorzugen PayPal (150 X 60)"
 "Website Payments Plus","Webseite Zahlungen Plus"
diff --git a/app/code/Magento/Paypal/i18n/en_US.csv b/app/code/Magento/Paypal/i18n/en_US.csv
index 8cea21541ae..5d65fec9c84 100644
--- a/app/code/Magento/Paypal/i18n/en_US.csv
+++ b/app/code/Magento/Paypal/i18n/en_US.csv
@@ -65,8 +65,8 @@
 "Your billing agreement # is: %s.","Your billing agreement # is: %s."
 "Bonus for first ACH Use","Bonus for first ACH Use"
 "Buyer Credit Payment","Buyer Credit Payment"
-"Buyer\'s Tax ID","Buyer\'s Tax ID"
-"Buyer\'s Tax ID Type","Buyer\'s Tax ID Type"
+"Buyer's Tax ID","Buyer's Tax ID"
+"Buyer's Tax ID Type","Buyer's Tax ID Type"
 "By default it is ""reports.paypal.com"".","By default it is ""reports.paypal.com""."
 "CNPJ","CNPJ"
 "CPF","CPF"
@@ -220,7 +220,7 @@
 "Merchant Liability","Merchant Liability"
 "Merchant Protection Eligibility","Merchant Protection Eligibility"
 "Merchant Referral Bonus","Merchant Referral Bonus"
-"Merchant account doesn\'t have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","Merchant account doesn\'t have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview."
+"Merchant account doesn't have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","Merchant account doesn't have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview."
 "Merchant account is not verified.","Merchant account is not verified."
 "Merchant denied this pending payment.","Merchant denied this pending payment."
 "Merchant holds a non-U.S. account and does not have a withdrawal mechanism.","Merchant holds a non-U.S. account and does not have a withdrawal mechanism."
@@ -415,7 +415,7 @@
 "The image at the top left of the checkout page. Max size is 750x90-pixel. <strong style=""color:red"">https</strong> is highly encouraged.","The image at the top left of the checkout page. Max size is 750x90-pixel. <strong style=""color:red"">https</strong> is highly encouraged."
 "The maximum number of child authorizations is reached.","The maximum number of child authorizations is reached."
 "The merchant account is not yet verified.","The merchant account is not yet verified."
-"The payment curency does not match any of the merchant\'s balances currency.","The payment curency does not match any of the merchant\'s balances currency."
+"The payment curency does not match any of the merchant's balances currency.","The payment curency does not match any of the merchant's balances currency."
 "The payment eCheck is not yet cleared.","The payment eCheck is not yet cleared."
 "The payment is authorized but not settled.","The payment is authorized but not settled."
 "The payment is pending because it was made to an email address that is not yet registered or confirmed.","The payment is pending because it was made to an email address that is not yet registered or confirmed."
@@ -462,7 +462,7 @@
 "Virtual PayPal Debit Card Transaction","Virtual PayPal Debit Card Transaction"
 "Virtual Terminal Payment","Virtual Terminal Payment"
 "Void","Void"
-"Waiting until Customer\'s eCheck will be cleared.","Waiting until Customer\'s eCheck will be cleared."
+"Waiting until Customer's eCheck will be cleared.","Waiting until Customer's eCheck will be cleared."
 "We prefer PayPal (150 X 40)","We prefer PayPal (150 X 40)"
 "We prefer PayPal (150 X 60)","We prefer PayPal (150 X 60)"
 "Website Payments Plus","Website Payments Plus"
diff --git a/app/code/Magento/Paypal/i18n/es_ES.csv b/app/code/Magento/Paypal/i18n/es_ES.csv
index 54e9caf5fc4..c4aeb894f33 100644
--- a/app/code/Magento/Paypal/i18n/es_ES.csv
+++ b/app/code/Magento/Paypal/i18n/es_ES.csv
@@ -65,8 +65,8 @@
 "Your billing agreement # is: %s.","Su número de acuerdo de facturación es: %s."
 "Bonus for first ACH Use","Bono por el primer Uso de ACH"
 "Buyer Credit Payment","Pago de Crédito de Comprador"
-"Buyer\'s Tax ID","Número de identificación social del contribuyente del comprador\es"
-"Buyer\'s Tax ID Type","Tipo de número de identificación social del contribuyente del comprador\es"
+"Buyer's Tax ID","Número de identificación social del contribuyente del comprador\es"
+"Buyer's Tax ID Type","Tipo de número de identificación social del contribuyente del comprador\es"
 "By default it is ""reports.paypal.com"".","Por defecto es ""reports.paypal.com""."
 "CNPJ","CNPJ"
 "CPF","CPF"
@@ -220,7 +220,7 @@
 "Merchant Liability","Responsabilidad del comerciante"
 "Merchant Protection Eligibility","Requisitos de protección de mercado"
 "Merchant Referral Bonus","Bonificación de referencia del comerciante"
-"Merchant account doesn\'t have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","La cuenta del envío no tiene una opción de retirada de dinero. El recipiente debe aceptar o rechazar manualmente este pago de su resumen de cuentas."
+"Merchant account doesn't have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","La cuenta del envío no tiene una opción de retirada de dinero. El recipiente debe aceptar o rechazar manualmente este pago de su resumen de cuentas."
 "Merchant account is not verified.","La cuenta del comerciante no ha sido verificada."
 "Merchant denied this pending payment.","El comerciante denegó este pago pendiente."
 "Merchant holds a non-U.S. account and does not have a withdrawal mechanism.","El comerciante no posee una cuenta de EEUU ni tampoco un mecanismo de retirada de dinero."
@@ -416,7 +416,7 @@
 "The image at the top left of the checkout page. Max size is 750x90-pixel. <strong style=""color:red"">https</strong> is highly encouraged.","Imagen en la parte superior izquierda de la página de pago. El tamaño máximo es 750x90 píxeles. Se recomienda encarecidamente el uso de <strong style=""color:red"">https</strong>."
 "The maximum number of child authorizations is reached.","Se ha alcanzado el número máximo de autorizaciones infantiles."
 "The merchant account is not yet verified.","Todavía no se ha verificado la cuenta de vendedor."
-"The payment curency does not match any of the merchant\'s balances currency.","La moneda de pago no coincide con ninguna de las monedas de saldo del vendedor."
+"The payment curency does not match any of the merchant's balances currency.","La moneda de pago no coincide con ninguna de las monedas de saldo del vendedor."
 "The payment eCheck is not yet cleared.","Todavía no se ha limpiado el eCheck de pago."
 "The payment is authorized but not settled.","El pago se ha autorizado, pero no se ha realizado."
 "The payment is pending because it was made to an email address that is not yet registered or confirmed.","El pago está pendiente porque se ha realizado a una dirección de mail que todavía no se ha registrado o confirmado."
@@ -463,7 +463,7 @@
 "Virtual PayPal Debit Card Transaction","Transacción de Tarjeta de Débito de PayPal Virtual"
 "Virtual Terminal Payment","Pago Terminal virtual"
 "Void","Nulo"
-"Waiting until Customer\'s eCheck will be cleared.","En espera hasta que se produzca la compensación del Cheque Electrónico del Cliente"
+"Waiting until Customer's eCheck will be cleared.","En espera hasta que se produzca la compensación del Cheque Electrónico del Cliente"
 "We prefer PayPal (150 X 40)","Preferimos PayPal (150 X 40)"
 "We prefer PayPal (150 X 60)","Preferimos PayPal (150 X 60)"
 "Website Payments Plus","Pagos Web Plus"
diff --git a/app/code/Magento/Paypal/i18n/fr_FR.csv b/app/code/Magento/Paypal/i18n/fr_FR.csv
index 6eaf7201817..ced16b1777a 100644
--- a/app/code/Magento/Paypal/i18n/fr_FR.csv
+++ b/app/code/Magento/Paypal/i18n/fr_FR.csv
@@ -65,8 +65,8 @@
 "Your billing agreement # is: %s.","Votre accord de facturation # est : %s."
 "Bonus for first ACH Use","Bonus pour première utilisation de l'ACH"
 "Buyer Credit Payment","Paiement acheteur"
-"Buyer\'s Tax ID","Identification fiscale de l'acheteur"
-"Buyer\'s Tax ID Type","Type d'identification fiscale de l'acheteur"
+"Buyer's Tax ID","Identification fiscale de l'acheteur"
+"Buyer's Tax ID Type","Type d'identification fiscale de l'acheteur"
 "By default it is ""reports.paypal.com"".","Par défaut ""reports.paypal.com"""
 "CNPJ","CNPJ"
 "CPF","CPF"
@@ -220,7 +220,7 @@
 "Merchant Liability","Responsabilité du vendeur"
 "Merchant Protection Eligibility","Eligibilité de protection marchande"
 "Merchant Referral Bonus","Bonus de parrainage d'un vendeur"
-"Merchant account doesn\'t have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","Le compte marchand n'a pas de mécanisme de retrait. Le marchand doit accepter ou refuser manuellement ce paiement à partir de  l'aperçu du compte."
+"Merchant account doesn't have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","Le compte marchand n'a pas de mécanisme de retrait. Le marchand doit accepter ou refuser manuellement ce paiement à partir de  l'aperçu du compte."
 "Merchant account is not verified.","Le compte du vendeur n'est pas vérifié."
 "Merchant denied this pending payment.","Le vendeur a refusé ce paiement en attente."
 "Merchant holds a non-U.S. account and does not have a withdrawal mechanism.","Le vendeur utilise un compte en dehors des Etats Unis et ne dispose pas d'un mécanisme de virement de fonds."
@@ -416,7 +416,7 @@
 "The image at the top left of the checkout page. Max size is 750x90-pixel. <strong style=""color:red"">https</strong> is highly encouraged.","L'image en haut à gauche de la page de paiement. Taille maximum : 750 x 90 pixels. <strong style=""color:red"">https</strong> est fortement conseillé."
 "The maximum number of child authorizations is reached.","Le nombre maximum d'autorisations pour enfant est atteint."
 "The merchant account is not yet verified.","Le compte du vendeur n'est pas vérifié."
-"The payment curency does not match any of the merchant\'s balances currency.","La monnaie du paiement ne correspond pas aux monnaies acceptées par le vendeur."
+"The payment curency does not match any of the merchant's balances currency.","La monnaie du paiement ne correspond pas aux monnaies acceptées par le vendeur."
 "The payment eCheck is not yet cleared.","Le paiement eCheck n'est pas encore validé."
 "The payment is authorized but not settled.","Le paiement est autorisé mais pas encore réglé."
 "The payment is pending because it was made to an email address that is not yet registered or confirmed.","Le paiement est en attente car il a été fait vers une adresse qui n'est pas encore enregistrée ou confirmée."
@@ -463,7 +463,7 @@
 "Virtual PayPal Debit Card Transaction","Transaction via carte de débit virtuelle Paypal"
 "Virtual Terminal Payment","Terminal de paiement virtuel"
 "Void","Annuler"
-"Waiting until Customer\'s eCheck will be cleared.","En attente de la vérification de l'eCheck du client."
+"Waiting until Customer's eCheck will be cleared.","En attente de la vérification de l'eCheck du client."
 "We prefer PayPal (150 X 40)","Nous préférons Paypal (150 X 40)"
 "We prefer PayPal (150 X 60)","Nous préférons PayPal (150 X 60)"
 "Website Payments Plus","Paiements site Internet Plus"
diff --git a/app/code/Magento/Paypal/i18n/nl_NL.csv b/app/code/Magento/Paypal/i18n/nl_NL.csv
index d55a5b82636..ce55d5c76b9 100644
--- a/app/code/Magento/Paypal/i18n/nl_NL.csv
+++ b/app/code/Magento/Paypal/i18n/nl_NL.csv
@@ -65,8 +65,8 @@
 "Your billing agreement # is: %s.","Uw factureringsovereenkomst # is: %s."
 "Bonus for first ACH Use","Bonus voor eerste ACH gebruik"
 "Buyer Credit Payment","Koper krediet betaling"
-"Buyer\'s Tax ID","Kopers Belastings ID"
-"Buyer\'s Tax ID Type","Koper 's Belastings ID Type"
+"Buyer's Tax ID","Kopers Belastings ID"
+"Buyer's Tax ID Type","Koper 's Belastings ID Type"
 "By default it is ""reports.paypal.com"".","Ingesteld op ""reports.paypal.com""."
 "CNPJ","CNPJ"
 "CPF","CPF"
@@ -220,7 +220,7 @@
 "Merchant Liability","Winkelier Aansprakelijkheid"
 "Merchant Protection Eligibility","In aanmerking komen voor handelaar bescherming"
 "Merchant Referral Bonus","Handelaar Doorverwijzing Bonus"
-"Merchant account doesn\'t have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","Handelaar account heeft geen opname mechanisme. Handelaar moet handmatig betalingen accepteren of weigeren via zijn Account Overzicht."
+"Merchant account doesn't have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","Handelaar account heeft geen opname mechanisme. Handelaar moet handmatig betalingen accepteren of weigeren via zijn Account Overzicht."
 "Merchant account is not verified.","Handelaar account niet geverifieerd."
 "Merchant denied this pending payment.","Handelaar heeft deze betaling afgewezen."
 "Merchant holds a non-U.S. account and does not have a withdrawal mechanism.","Handelaar bezit een niet-Amerikaans account en heeft geen opname mechanisme."
@@ -415,7 +415,7 @@
 "The image at the top left of the checkout page. Max size is 750x90-pixel. <strong style=""color:red"">https</strong> is highly encouraged.","De afbeelding linksboven op de afrekeningspagina. Maximale grootte is 750x90 pixels. <strong style=""color:red"">Https</strong> is ten sterkte aangeraden."
 "The maximum number of child authorizations is reached.","Het maximale aantal kindmachtigingen is bereikt."
 "The merchant account is not yet verified.","De handelsaccount is nog niet geverifieerd."
-"The payment curency does not match any of the merchant\'s balances currency.","De betalingsvaluta komt met geen enkele valuta van de saldi van de handelaar overeen."
+"The payment curency does not match any of the merchant's balances currency.","De betalingsvaluta komt met geen enkele valuta van de saldi van de handelaar overeen."
 "The payment eCheck is not yet cleared.","De betalings eCheck is nog niet vrijgegeven."
 "The payment is authorized but not settled.","De betaling is gemachtigd, maar niet afgehandeld."
 "The payment is pending because it was made to an email address that is not yet registered or confirmed.","De betaling staat in de wacht omdat deze aangemaakt is met een emailadres dat nog niet geregistreerd of bevestigd is."
@@ -462,7 +462,7 @@
 "Virtual PayPal Debit Card Transaction","Virtuele Paypal Debitcard Transactie"
 "Virtual Terminal Payment","Virtuele Laatste Betaling"
 "Void","Geldig"
-"Waiting until Customer\'s eCheck will be cleared.","Wachten tot Klant\'s eCheck wordt vrijgegeven."
+"Waiting until Customer's eCheck will be cleared.","Wachten tot Klant's eCheck wordt vrijgegeven."
 "We prefer PayPal (150 X 40)","PayPal heeft onze voorkeur (150 X 40)"
 "We prefer PayPal (150 X 60)","Paypal heeft onze voorkeur (150 X 60)"
 "Website Payments Plus","Website betalingen plus"
diff --git a/app/code/Magento/Paypal/i18n/pt_BR.csv b/app/code/Magento/Paypal/i18n/pt_BR.csv
index 2b8cf17f49c..7a972a9003c 100644
--- a/app/code/Magento/Paypal/i18n/pt_BR.csv
+++ b/app/code/Magento/Paypal/i18n/pt_BR.csv
@@ -65,8 +65,8 @@
 "Your billing agreement # is: %s.","Seu acordo de faturamento # está: %s."
 "Bonus for first ACH Use","Bônus pelo primeiro uso do ACH"
 "Buyer Credit Payment","Pagamento de Crédito do Comprador"
-"Buyer\'s Tax ID","CPF do Comprador"
-"Buyer\'s Tax ID Type","Tipo de CPF/CNPJ do Comprador"
+"Buyer's Tax ID","CPF do Comprador"
+"Buyer's Tax ID Type","Tipo de CPF/CNPJ do Comprador"
 "By default it is ""reports.paypal.com"".","Por padrão, é ""reports.paypal.com""."
 "CNPJ","CNPJ (Cadastro Nacional de Pessoas Jurídicas)"
 "CPF","CPF (Cadastro de Contribuintes Pessoas Físicas)"
@@ -220,7 +220,7 @@
 "Merchant Liability","Responsabilidade do Comerciante"
 "Merchant Protection Eligibility","Elegibilidade de Proteção do Comerciante"
 "Merchant Referral Bonus","Bónus de Comerciante"
-"Merchant account doesn\'t have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","Conta do comerciante não tem um mecanismo de levantamento. O comerciante deve aceitar ou recusar manualmente esse pagamento a partir de sua Visão Geral da conta."
+"Merchant account doesn't have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","Conta do comerciante não tem um mecanismo de levantamento. O comerciante deve aceitar ou recusar manualmente esse pagamento a partir de sua Visão Geral da conta."
 "Merchant account is not verified.","Conta do comerciante não verificada."
 "Merchant denied this pending payment.","Comerciante recusou o pagamento pendente."
 "Merchant holds a non-U.S. account and does not have a withdrawal mechanism.","O comerciante é titular de uma conta fora dos EUA e não tem um mecanismo de levantamento."
@@ -415,7 +415,7 @@
 "The image at the top left of the checkout page. Max size is 750x90-pixel. <strong style=""color:red"">https</strong> is highly encouraged.","A imagem no canto superior esquerdo da página de compra. Tamanho máximo é 750x90 pixels. <strong style=""color:red"">https</strong> é altamente recomendado."
 "The maximum number of child authorizations is reached.","O número máximo de autorizações de criança foi atingido."
 "The merchant account is not yet verified.","A conta de comerciante ainda não foi confirmada."
-"The payment curency does not match any of the merchant\'s balances currency.","A moeda de pagamento não corresponde a nenhuma das moedas dos balanços do comerciante."
+"The payment curency does not match any of the merchant's balances currency.","A moeda de pagamento não corresponde a nenhuma das moedas dos balanços do comerciante."
 "The payment eCheck is not yet cleared.","O pagamento eCheck ainda não está clarificado."
 "The payment is authorized but not settled.","O pagamento está autorizado, mas não liquidado."
 "The payment is pending because it was made to an email address that is not yet registered or confirmed.","O pagamento está pendente porque foi feito para um endereço de e-mail que ainda não está registrado ou confirmado."
@@ -462,7 +462,7 @@
 "Virtual PayPal Debit Card Transaction","Transação via Cartão de Débito Virtual PayPal"
 "Virtual Terminal Payment","Pagamento via Terminal Virtual"
 "Void","Anular"
-"Waiting until Customer\'s eCheck will be cleared.","Aguardando eCheck do Cliente ser liberado."
+"Waiting until Customer's eCheck will be cleared.","Aguardando eCheck do Cliente ser liberado."
 "We prefer PayPal (150 X 40)","Preferimos PayPal (150 x 40)"
 "We prefer PayPal (150 X 60)","Preferimos PayPal (150 x 60)"
 "Website Payments Plus","Website Payments Plus"
diff --git a/app/code/Magento/Paypal/i18n/zh_CN.csv b/app/code/Magento/Paypal/i18n/zh_CN.csv
index 3ead5d652b5..8b5bada8460 100644
--- a/app/code/Magento/Paypal/i18n/zh_CN.csv
+++ b/app/code/Magento/Paypal/i18n/zh_CN.csv
@@ -65,8 +65,8 @@
 "Your billing agreement # is: %s.","您的账单编号为: %s"
 "Bonus for first ACH Use","首次使用ACH奖励"
 "Buyer Credit Payment","买家信用支付"
-"Buyer\'s Tax ID","买家的纳税人 ID"
-"Buyer\'s Tax ID Type","买家的纳税人 ID 类型"
+"Buyer's Tax ID","买家的纳税人 ID"
+"Buyer's Tax ID Type","买家的纳税人 ID 类型"
 "By default it is ""reports.paypal.com"".","默认为“reports.paypal.com”。"
 "CNPJ","CNPJ"
 "CPF","CPF"
@@ -220,7 +220,7 @@
 "Merchant Liability","商家责任"
 "Merchant Protection Eligibility","银行保护的资格"
 "Merchant Referral Bonus","银行推荐奖励"
-"Merchant account doesn\'t have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","银行帐户没有撤销机制。银行必须从您的帐户概述中手工接受或拒绝本支付。"
+"Merchant account doesn't have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.","银行帐户没有撤销机制。银行必须从您的帐户概述中手工接受或拒绝本支付。"
 "Merchant account is not verified.","银行帐户未验证。"
 "Merchant denied this pending payment.","银行拒绝了这一挂起的支付。"
 "Merchant holds a non-U.S. account and does not have a withdrawal mechanism.","银行提供了非美国帐户,并且没有撤销机制。"
@@ -415,7 +415,7 @@
 "The image at the top left of the checkout page. Max size is 750x90-pixel. <strong style=""color:red"">https</strong> is highly encouraged.","付款页面左上角的图像,最大尺寸为750x90像素。 强烈建议使用<strong style=""color:red"">https</strong>地址。"
 "The maximum number of child authorizations is reached.","授权子帐户的最大数量已达到。"
 "The merchant account is not yet verified.","银行帐户尚未验证。"
-"The payment curency does not match any of the merchant\'s balances currency.","支付的币种与银行支持的币种不一致。"
+"The payment curency does not match any of the merchant's balances currency.","支付的币种与银行支持的币种不一致。"
 "The payment eCheck is not yet cleared.","支付的电子支票尚未兑现。"
 "The payment is authorized but not settled.","支付已获授权但尚未确定。"
 "The payment is pending because it was made to an email address that is not yet registered or confirmed.","支付被挂起,因为支付使用了一个未经确认的电子邮件地址。"
@@ -462,7 +462,7 @@
 "Virtual PayPal Debit Card Transaction","虚拟PayPal借记卡交易"
 "Virtual Terminal Payment","虚拟终端支付"
 "Void","无效"
-"Waiting until Customer\'s eCheck will be cleared.","等待直到客户的电子支票兑现。"
+"Waiting until Customer's eCheck will be cleared.","等待直到客户的电子支票兑现。"
 "We prefer PayPal (150 X 40)","我们喜欢PayPal(150X40)"
 "We prefer PayPal (150 X 60)","我们喜欢PayPal(150X60)"
 "Website Payments Plus","网站支付高级版"
diff --git a/app/code/Magento/Persistent/Model/Observer.php b/app/code/Magento/Persistent/Model/Observer.php
index 5c0e79c2872..c612083c82f 100644
--- a/app/code/Magento/Persistent/Model/Observer.php
+++ b/app/code/Magento/Persistent/Model/Observer.php
@@ -517,7 +517,7 @@ class Observer
     {
         /** @var \Magento\Sales\Model\Quote $quote */
         $quote = $this->_quoteFactory->create();
-        $quote->loadByCustomer($this->_getPersistentCustomer());
+        $quote->loadByCustomer($this->_persistentSession->getSession()->getCustomerId());
         return $quote;
     }
 
diff --git a/app/code/Magento/Persistent/Model/Session.php b/app/code/Magento/Persistent/Model/Session.php
index a36d282b2f1..82f4cee0f2a 100644
--- a/app/code/Magento/Persistent/Model/Session.php
+++ b/app/code/Magento/Persistent/Model/Session.php
@@ -101,8 +101,8 @@ class Session extends \Magento\Core\Model\AbstractModel
     /**
      * Construct
      *
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\App\ConfigInterface $coreConfig
      * @param \Magento\Core\Helper\Data $coreData
      * @param \Magento\Persistent\Helper\Data $persistentData
@@ -115,8 +115,8 @@ class Session extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\App\ConfigInterface $coreConfig,
         \Magento\Core\Helper\Data $coreData,
         \Magento\Persistent\Helper\Data $persistentData,
diff --git a/app/code/Magento/Persistent/i18n/de_DE.csv b/app/code/Magento/Persistent/i18n/de_DE.csv
index 6bd594fbd3f..f994c8c7058 100644
--- a/app/code/Magento/Persistent/i18n/de_DE.csv
+++ b/app/code/Magento/Persistent/i18n/de_DE.csv
@@ -60,5 +60,5 @@
 "To proceed to Checkout, please log in using your email address.","Um weiter zur Kasse zu gehen, melden Sie sich bitte mit Ihrer E-Mail-Adresse an."
 "VAT Number","MwSt.-Nummer"
 "Welcome, %s!","Willkommen, %s!"
-"What\'s this?","Was ist das?"
+"What's this?","Was ist das?"
 "Zip/Postal Code","Postleitzahl"
diff --git a/app/code/Magento/Persistent/i18n/en_US.csv b/app/code/Magento/Persistent/i18n/en_US.csv
index a402521a1e8..e45246f8ae8 100644
--- a/app/code/Magento/Persistent/i18n/en_US.csv
+++ b/app/code/Magento/Persistent/i18n/en_US.csv
@@ -60,5 +60,5 @@
 "To proceed to Checkout, please log in using your email address.","To proceed to Checkout, please log in using your email address."
 "VAT Number","VAT Number"
 "Welcome, %s!","Welcome, %s!"
-"What\'s this?","What\'s this?"
+"What's this?","What's this?"
 "Zip/Postal Code","Zip/Postal Code"
diff --git a/app/code/Magento/Persistent/i18n/es_ES.csv b/app/code/Magento/Persistent/i18n/es_ES.csv
index fc70d0dc3ea..7a6ae4c2e16 100644
--- a/app/code/Magento/Persistent/i18n/es_ES.csv
+++ b/app/code/Magento/Persistent/i18n/es_ES.csv
@@ -60,5 +60,5 @@
 "To proceed to Checkout, please log in using your email address.","Para proceder a la comprobación, por favor, inicie sesión con su dirección de correo electrónico."
 "VAT Number","Número de IVA"
 "Welcome, %s!","¡Bienvenido, %s!"
-"What\'s this?","¿Qué es esto?"
+"What's this?","¿Qué es esto?"
 "Zip/Postal Code","Código postal"
diff --git a/app/code/Magento/Persistent/i18n/fr_FR.csv b/app/code/Magento/Persistent/i18n/fr_FR.csv
index 2b5a7f5cb7d..82d77f2333d 100644
--- a/app/code/Magento/Persistent/i18n/fr_FR.csv
+++ b/app/code/Magento/Persistent/i18n/fr_FR.csv
@@ -60,5 +60,5 @@
 "To proceed to Checkout, please log in using your email address.","Pour passer votre commande, veuillez vous connecter en utilisant votre adresse e-mail."
 "VAT Number","Numéro TVA"
 "Welcome, %s!","Bienvenue, %s !"
-"What\'s this?","Qu'est-ce ?"
+"What's this?","Qu'est-ce ?"
 "Zip/Postal Code","Code postal"
diff --git a/app/code/Magento/Persistent/i18n/nl_NL.csv b/app/code/Magento/Persistent/i18n/nl_NL.csv
index 4a34390517b..ccba8a511c7 100644
--- a/app/code/Magento/Persistent/i18n/nl_NL.csv
+++ b/app/code/Magento/Persistent/i18n/nl_NL.csv
@@ -60,5 +60,5 @@
 "To proceed to Checkout, please log in using your email address.","Om verder te gaan naar Checkout, gelieve in te loggen met uw email adres."
 "VAT Number","BTW nummer"
 "Welcome, %s!","Welkom, %s!"
-"What\'s this?","Wat is dit?"
+"What's this?","Wat is dit?"
 "Zip/Postal Code","Zip/Postcode"
diff --git a/app/code/Magento/Persistent/i18n/pt_BR.csv b/app/code/Magento/Persistent/i18n/pt_BR.csv
index 1782977898d..343991c764e 100644
--- a/app/code/Magento/Persistent/i18n/pt_BR.csv
+++ b/app/code/Magento/Persistent/i18n/pt_BR.csv
@@ -60,5 +60,5 @@
 "To proceed to Checkout, please log in using your email address.","Para fazer checkout, por favor faça login usando o seu endereço de e-mail."
 "VAT Number","Número VAT"
 "Welcome, %s!","Bem-vindo, %s!"
-"What\'s this?","O que é isso?"
+"What's this?","O que é isso?"
 "Zip/Postal Code","Zip/Código Postal"
diff --git a/app/code/Magento/Persistent/i18n/zh_CN.csv b/app/code/Magento/Persistent/i18n/zh_CN.csv
index 7353117fb01..8bab2cf2f41 100644
--- a/app/code/Magento/Persistent/i18n/zh_CN.csv
+++ b/app/code/Magento/Persistent/i18n/zh_CN.csv
@@ -60,5 +60,5 @@
 "To proceed to Checkout, please log in using your email address.","要继续结账,请使用你的电子邮件地址登录。"
 "VAT Number","VAT 编号"
 "Welcome, %s!","欢迎,%s!"
-"What\'s this?","这是什么?"
+"What's this?","这是什么?"
 "Zip/Postal Code","邮政编码"
diff --git a/app/code/Magento/ProductAlert/Block/Product/View.php b/app/code/Magento/ProductAlert/Block/Product/View.php
index f1bdcee41ca..c98e7938a89 100644
--- a/app/code/Magento/ProductAlert/Block/Product/View.php
+++ b/app/code/Magento/ProductAlert/Block/Product/View.php
@@ -32,7 +32,7 @@ namespace Magento\ProductAlert\Block\Product;
 class View extends \Magento\View\Element\Template
 {
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
@@ -53,13 +53,13 @@ class View extends \Magento\View\Element\Template
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\ProductAlert\Helper\Data $helper
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\ProductAlert\Helper\Data $helper,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         parent::__construct($context, $data);
diff --git a/app/code/Magento/ProductAlert/Helper/Data.php b/app/code/Magento/ProductAlert/Helper/Data.php
index d2d744e5285..b94d87e528b 100644
--- a/app/code/Magento/ProductAlert/Helper/Data.php
+++ b/app/code/Magento/ProductAlert/Helper/Data.php
@@ -46,10 +46,10 @@ class Data extends \Magento\Core\Helper\Url
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
-    
+
     /**
      * Core store config
      *
@@ -70,7 +70,7 @@ class Data extends \Magento\Core\Helper\Url
     /**
      * @param \Magento\App\Helper\Context $context
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\View\LayoutInterface $layout
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Customer\Model\Session $session
@@ -78,7 +78,7 @@ class Data extends \Magento\Core\Helper\Url
     public function __construct(
         \Magento\App\Helper\Context $context,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\View\LayoutInterface $layout,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Customer\Model\Session $session
diff --git a/app/code/Magento/ProductAlert/Model/Email.php b/app/code/Magento/ProductAlert/Model/Email.php
index b4b25f1d780..886262edd1b 100644
--- a/app/code/Magento/ProductAlert/Model/Email.php
+++ b/app/code/Magento/ProductAlert/Model/Email.php
@@ -119,32 +119,32 @@ class Email extends \Magento\Core\Model\AbstractModel
     protected $_appEmulation;
 
     /**
-     * @var \Magento\Email\Model\TemplateFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_templateFactory;
+    protected $_transportBuilder;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\ProductAlert\Helper\Data $productAlertData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Customer\Model\CustomerFactory $customerFactory
      * @param \Magento\Core\Model\App\Emulation $appEmulation
-     * @param \Magento\Email\Model\TemplateFactory $templateFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\ProductAlert\Helper\Data $productAlertData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Customer\Model\CustomerFactory $customerFactory,
         \Magento\Core\Model\App\Emulation $appEmulation,
-        \Magento\Email\Model\TemplateFactory $templateFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
@@ -154,7 +154,7 @@ class Email extends \Magento\Core\Model\AbstractModel
         $this->_storeManager = $storeManager;
         $this->_customerFactory = $customerFactory;
         $this->_appEmulation = $appEmulation;
-        $this->_templateFactory = $templateFactory;
+        $this->_transportBuilder = $transportBuilder;
         parent::__construct($context, $registry, $resource, $resourceCollection, $data);
     }
 
@@ -350,20 +350,21 @@ class Email extends \Magento\Core\Model\AbstractModel
 
         $this->_appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
 
-        $this->_templateFactory->create()
-            ->setDesignConfig(array(
+        $transport = $this->_transportBuilder
+            ->setTemplateIdentifier($templateId)
+            ->setTemplateOptions(array(
                 'area'  => \Magento\Core\Model\App\Area::AREA_FRONTEND,
                 'store' => $storeId
-            ))->sendTransactional(
-                $templateId,
-                $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId),
-                $this->_customer->getEmail(),
-                $this->_customer->getName(),
-                array(
-                    'customerName'  => $this->_customer->getName(),
-                    'alertGrid'     => $block
-                )
-            );
+            ))
+            ->setTemplateVars(array(
+                'customerName'  => $this->_customer->getName(),
+                'alertGrid'     => $block
+            ))
+            ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId))
+            ->addTo($this->_customer->getEmail(), $this->_customer->getName())
+            ->getTransport();
+
+        $transport->sendMessage();
 
         return true;
     }
diff --git a/app/code/Magento/ProductAlert/Model/Observer.php b/app/code/Magento/ProductAlert/Model/Observer.php
index 70442dd02bd..4c029e65954 100644
--- a/app/code/Magento/ProductAlert/Model/Observer.php
+++ b/app/code/Magento/ProductAlert/Model/Observer.php
@@ -127,9 +127,9 @@ class Observer
     protected $_translate;
 
     /**
-     * @var \Magento\Email\Model\TemplateFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_templateFactory;
+    protected $_transportBuilder;
 
     /**
      * @var \Magento\ProductAlert\Model\EmailFactory
@@ -146,7 +146,7 @@ class Observer
      * @param \Magento\Core\Model\DateFactory $dateFactory
      * @param \Magento\ProductAlert\Model\Resource\Stock\CollectionFactory $stockColFactory
      * @param \Magento\TranslateInterface $translate
-     * @param \Magento\Email\Model\TemplateFactory $templateFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param \Magento\ProductAlert\Model\EmailFactory $emailFactory
      */
     public function __construct(
@@ -159,7 +159,7 @@ class Observer
         \Magento\Core\Model\DateFactory $dateFactory,
         \Magento\ProductAlert\Model\Resource\Stock\CollectionFactory $stockColFactory,
         \Magento\TranslateInterface $translate,
-        \Magento\Email\Model\TemplateFactory $templateFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\ProductAlert\Model\EmailFactory $emailFactory
     ) {
         $this->_taxData = $taxData;
@@ -171,7 +171,7 @@ class Observer
         $this->_dateFactory = $dateFactory;
         $this->_stockColFactory = $stockColFactory;
         $this->_translate = $translate;
-        $this->_templateFactory = $templateFactory;
+        $this->_transportBuilder = $transportBuilder;
         $this->_emailFactory = $emailFactory;
     }
 
@@ -380,19 +380,22 @@ class Observer
                 return $this;
             }
 
-            $$this->_translate->setTranslateInline(false);
+            $this->_translate->setTranslateInline(false);
 
-            /* @var $emailTemplate \Magento\Email\Model\Template */
-            $this->_templateFactory->create()->setDesignConfig(array('area'  => 'backend'))
-                ->sendTransactional(
-                    $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE),
-                    $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_IDENTITY),
-                    $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT),
-                    null,
-                    array('warnings' => join("\n", $this->_errors))
-                );
+            $transport = $this->_transportBuilder
+                ->setTemplateIdentifier($this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE))
+                ->setTemplateOptions(array(
+                    'area'  => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                    'store' => $this->_storeManager->getStore()->getId()
+                ))
+                ->setTemplateVars(array('warnings' => join("\n", $this->_errors)))
+                ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_IDENTITY))
+                ->addTo($this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT))
+                ->getTransport();
 
-            $$this->_translate->setTranslateInline(true);
+            $transport->sendMessage();
+
+            $this->_translate->setTranslateInline(true);
             $this->_errors[] = array();
         }
         return $this;
diff --git a/app/code/Magento/ProductAlert/Model/Price.php b/app/code/Magento/ProductAlert/Model/Price.php
index 5d5e72f08a0..0117f7fb158 100644
--- a/app/code/Magento/ProductAlert/Model/Price.php
+++ b/app/code/Magento/ProductAlert/Model/Price.php
@@ -61,16 +61,16 @@ class Price extends \Magento\Core\Model\AbstractModel
     protected $_customerColFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\ProductAlert\Model\Resource\Price\Customer\CollectionFactory $customerColFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\ProductAlert\Model\Resource\Price\Customer\CollectionFactory $customerColFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/ProductAlert/Model/Stock.php b/app/code/Magento/ProductAlert/Model/Stock.php
index 60acab15364..8a5217be98e 100644
--- a/app/code/Magento/ProductAlert/Model/Stock.php
+++ b/app/code/Magento/ProductAlert/Model/Stock.php
@@ -59,16 +59,16 @@ class Stock extends \Magento\Core\Model\AbstractModel
     protected $_customerColFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\ProductAlert\Model\Resource\Stock\Customer\CollectionFactory $customerColFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\ProductAlert\Model\Resource\Stock\Customer\CollectionFactory $customerColFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/ProductAlert/etc/module.xml b/app/code/Magento/ProductAlert/etc/module.xml
index 40d29f0c30a..ebac0744f61 100755
--- a/app/code/Magento/ProductAlert/etc/module.xml
+++ b/app/code/Magento/ProductAlert/etc/module.xml
@@ -34,7 +34,6 @@
             <module name="Magento_Customer"/>
             <module name="Magento_Core"/>
             <module name="Magento_Tax"/>
-            <module name="Magento_Email"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit.php b/app/code/Magento/Rating/Block/Adminhtml/Edit.php
index eefe3fab22e..aa85dd25441 100644
--- a/app/code/Magento/Rating/Block/Adminhtml/Edit.php
+++ b/app/code/Magento/Rating/Block/Adminhtml/Edit.php
@@ -34,7 +34,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -49,13 +49,13 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Rating\Model\RatingFactory $ratingFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Rating\Model\RatingFactory $ratingFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_ratingFactory = $ratingFactory;
diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php
index c9daf35b314..5612e513ad2 100644
--- a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php
+++ b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php
@@ -51,7 +51,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Rating\Model\Rating\OptionFactory $optionFactory
      * @param \Magento\Session\SessionManagerInterface $session
@@ -60,7 +60,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Rating\Model\Rating\OptionFactory $optionFactory,
         \Magento\Session\SessionManagerInterface $session,
diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Options.php b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Options.php
index 87cd46003ad..5dd5afded54 100644
--- a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Options.php
+++ b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Options.php
@@ -37,14 +37,14 @@ class Options extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Rating\Model\Rating\OptionFactory $optionFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Rating\Model\Rating\OptionFactory $optionFactory,
         array $data = array()
diff --git a/app/code/Magento/Rating/Controller/Adminhtml/Index.php b/app/code/Magento/Rating/Controller/Adminhtml/Index.php
index d85ad15f458..bc9542cda4f 100644
--- a/app/code/Magento/Rating/Controller/Adminhtml/Index.php
+++ b/app/code/Magento/Rating/Controller/Adminhtml/Index.php
@@ -36,17 +36,17 @@ class Index extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Rating/Model/Rating.php b/app/code/Magento/Rating/Model/Rating.php
index 184166ffc16..71d65b99e8c 100644
--- a/app/code/Magento/Rating/Model/Rating.php
+++ b/app/code/Magento/Rating/Model/Rating.php
@@ -61,8 +61,8 @@ class Rating extends \Magento\Core\Model\AbstractModel
     protected $_ratingCollectionF;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Rating\Model\Rating\OptionFactory $ratingOptionFactory
      * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -70,8 +70,8 @@ class Rating extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Rating\Model\Rating\OptionFactory $ratingOptionFactory,
         \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php
index d0e0a0d112e..bff5d51cc28 100644
--- a/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php
+++ b/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php
@@ -38,7 +38,7 @@ class Collection extends \Magento\Rating\Model\Resource\Rating\Collection
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -49,7 +49,7 @@ class Collection extends \Magento\Rating\Model\Resource\Rating\Collection
      * @param \Magento\Event\ManagerInterface $eventManager
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param mixed $connection
      * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource
      */
@@ -60,7 +60,7 @@ class Collection extends \Magento\Rating\Model\Resource\Rating\Collection
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         $connection = null,
         \Magento\Core\Model\Resource\Db\AbstractDb $resource = null
     ) {
diff --git a/app/code/Magento/RecurringProfile/Block/Adminhtml/Customer/Edit/Tab/RecurringProfile.php b/app/code/Magento/RecurringProfile/Block/Adminhtml/Customer/Edit/Tab/RecurringProfile.php
index c9cfa3a844e..1e0a9d3bacf 100644
--- a/app/code/Magento/RecurringProfile/Block/Adminhtml/Customer/Edit/Tab/RecurringProfile.php
+++ b/app/code/Magento/RecurringProfile/Block/Adminhtml/Customer/Edit/Tab/RecurringProfile.php
@@ -35,7 +35,7 @@ class RecurringProfile
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -47,21 +47,21 @@ class RecurringProfile
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Helper\Data $backendHelper
-     * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\RecurringProfile\Model\Resource\Profile\CollectionFactory $profileCollection
      * @param \Magento\RecurringProfile\Model\States $recurringStates
      * @param \Magento\RecurringProfile\Block\Fields $fields
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\RecurringProfile\Model\Method\PaymentMethodsList $payments
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Helper\Data $backendHelper,
-        \Magento\Payment\Helper\Data $paymentData,
         \Magento\RecurringProfile\Model\Resource\Profile\CollectionFactory $profileCollection,
         \Magento\RecurringProfile\Model\States $recurringStates,
         \Magento\RecurringProfile\Block\Fields $fields,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\RecurringProfile\Model\Method\PaymentMethodsList $payments,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
@@ -79,10 +79,10 @@ class RecurringProfile
         parent::__construct(
             $context,
             $backendHelper,
-            $paymentData,
             $profileCollection,
             $recurringStates,
             $fields,
+            $payments,
             $data
         );
     }
diff --git a/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/Grid.php b/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/Grid.php
index b6293e7edea..6903133f5d7 100644
--- a/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/Grid.php
+++ b/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/Grid.php
@@ -27,18 +27,12 @@
  */
 namespace Magento\RecurringProfile\Block\Adminhtml\Profile;
 
+/**
+ * Class Grid
+ * @todo: convert to layout update
+ */
 class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
 {
-    /**
-     * Set ajax/session parameters
-     */
-    /**
-     * Payment data
-     *
-     * @var \Magento\Payment\Helper\Data
-     */
-    protected $_paymentData = null;
-
     /**
      * @var \Magento\RecurringProfile\Model\Resource\Profile\CollectionFactory
      */
@@ -54,27 +48,30 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
      */
     protected $_fields;
 
+    /** @var \Magento\RecurringProfile\Model\Method\PaymentMethodsList */
+    protected $payments;
+
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Helper\Data $backendHelper
-     * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\RecurringProfile\Model\Resource\Profile\CollectionFactory $profileCollection
      * @param \Magento\RecurringProfile\Model\States $recurringStates
      * @param \Magento\RecurringProfile\Block\Fields $fields
+     * @param \Magento\RecurringProfile\Model\Method\PaymentMethodsList $payments
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Helper\Data $backendHelper,
-        \Magento\Payment\Helper\Data $paymentData,
         \Magento\RecurringProfile\Model\Resource\Profile\CollectionFactory $profileCollection,
         \Magento\RecurringProfile\Model\States $recurringStates,
         \Magento\RecurringProfile\Block\Fields $fields,
+        \Magento\RecurringProfile\Model\Method\PaymentMethodsList $payments,
         array $data = array()
     ) {
-        $this->_paymentData = $paymentData;
         $this->_profileCollection = $profileCollection;
         $this->recurringStates = $recurringStates;
+        $this->payments = $payments;
         parent::__construct($context, $backendHelper, $data);
         $this->_fields = $fields;
     }
@@ -151,15 +148,11 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
             'width' => 1,
         ));
 
-        $methods = array();
-        foreach ($this->_paymentData->getRecurringProfileMethods() as $method) {
-            $methods[$method->getCode()] = $method->getTitle();
-        }
         $this->addColumn('method_code', array(
             'header'  => $this->_fields->getFieldLabel('method_code'),
             'index'   => 'method_code',
             'type'    => 'options',
-            'options' => $methods,
+            'options' => $this->payments->toOptionArray(),
         ));
 
         $this->addColumn('schedule_description', array(
diff --git a/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View.php b/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View.php
index 36688fae546..09dccf5a713 100644
--- a/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View.php
+++ b/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View.php
@@ -32,18 +32,18 @@ class View extends \Magento\Backend\Block\Widget\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View/Getawayinfo.php b/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View/Getawayinfo.php
index 899745b4ebd..e4248be3cb0 100644
--- a/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View/Getawayinfo.php
+++ b/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View/Getawayinfo.php
@@ -36,7 +36,7 @@ class Getawayinfo extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -47,13 +47,13 @@ class Getawayinfo extends \Magento\Backend\Block\Widget
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\RecurringProfile\Block\Fields $fields
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\RecurringProfile\Block\Fields $fields,
         array $data = array()
     ) {
diff --git a/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View/Info.php b/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View/Info.php
index 1b7a164e85e..be754558145 100644
--- a/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View/Info.php
+++ b/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View/Info.php
@@ -36,7 +36,7 @@ class Info extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -47,13 +47,13 @@ class Info extends \Magento\Backend\Block\Widget
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\RecurringProfile\Block\Fields $fields
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\RecurringProfile\Block\Fields $fields,
         array $data = array()
     ) {
diff --git a/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View/Tab/Orders.php b/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View/Tab/Orders.php
index 2123c842fa4..f146c58a545 100644
--- a/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View/Tab/Orders.php
+++ b/app/code/Magento/RecurringProfile/Block/Adminhtml/Profile/View/Tab/Orders.php
@@ -34,12 +34,12 @@ class Orders
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
-     * @var \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory
+     * @var \Magento\Sales\Model\Resource\Order\CollectionFactory
      */
     protected $_orderCollection;
 
@@ -48,25 +48,32 @@ class Orders
      */
     protected $_orderConfig;
 
+    /**
+     * @var \Magento\RecurringProfile\Model\Resource\Order\CollectionFilter
+     */
+    protected $_recurringCollectionFilter;
+
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Helper\Data $backendHelper
-     * @param \Magento\Core\Model\Registry $coreRegistry
-     * @param \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory $orderCollection
+     * @param \Magento\Registry $coreRegistry
+     * @param \Magento\Sales\Model\Resource\Order\CollectionFactory $orderCollection
      * @param \Magento\Sales\Model\Order\ConfigFactory $orderConfig
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Helper\Data $backendHelper,
-        \Magento\Core\Model\Registry $coreRegistry,
-        \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory $orderCollection,
+        \Magento\Registry $coreRegistry,
+        \Magento\Sales\Model\Resource\Order\CollectionFactory $orderCollection,
         \Magento\Sales\Model\Order\ConfigFactory $orderConfig,
+        \Magento\RecurringProfile\Model\Resource\Order\CollectionFilter $recurringCollectionFilter,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
         $this->_orderCollection = $orderCollection;
         $this->_orderConfig = $orderConfig;
+        $this->_recurringCollectionFilter = $recurringCollectionFilter;
         parent::__construct($context, $backendHelper, $data);
     }
 
@@ -88,8 +95,10 @@ class Orders
      */
     protected function _prepareCollection()
     {
-        $collection = $this->_orderCollection->create()
-            ->addRecurringProfilesFilter($this->_coreRegistry->registry('current_recurring_profile')->getId());
+        $collection = $this->_recurringCollectionFilter->byIds(
+            $this->_orderCollection->create(),
+            $this->_coreRegistry->registry('current_recurring_profile')->getId()
+        );
         $this->setCollection($collection);
         return parent::_prepareCollection();
     }
diff --git a/app/code/Magento/RecurringProfile/Block/Catalog/Product/View/Profile.php b/app/code/Magento/RecurringProfile/Block/Catalog/Product/View/Profile.php
index b21bc0e32e8..ee7809e0ad2 100644
--- a/app/code/Magento/RecurringProfile/Block/Catalog/Product/View/Profile.php
+++ b/app/code/Magento/RecurringProfile/Block/Catalog/Product/View/Profile.php
@@ -39,7 +39,7 @@ class Profile extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry = null;
 
@@ -52,13 +52,13 @@ class Profile extends \Magento\View\Element\Template
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\RecurringProfile\Model\RecurringProfileFactory $profileFactory
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\RecurringProfile\Model\RecurringProfileFactory $profileFactory,
         array $data = array()
     ) {
diff --git a/app/code/Magento/RecurringProfile/Block/Plugin/Payment.php b/app/code/Magento/RecurringProfile/Block/Plugin/Payment.php
new file mode 100644
index 00000000000..114efdf8768
--- /dev/null
+++ b/app/code/Magento/RecurringProfile/Block/Plugin/Payment.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\RecurringProfile\Block\Plugin;
+
+use Magento\Checkout\Model\Session;
+use Magento\RecurringProfile\Model\Quote\Filter;
+
+class Payment
+{
+    /** @var Filter  */
+    protected $filter;
+
+    /** @var  Session */
+    protected $session;
+
+    /**
+     * @param Session $session
+     * @param Filter $filter
+     */
+    public function __construct(
+        Session $session,
+        Filter $filter
+    ) {
+        $this->session = $session;
+        $this->filter = $filter;
+    }
+
+    /**
+     * Add hasRecurringItems option
+     *
+     * @param array $result
+     * @return array
+     */
+    public function afterGetOptions(array $result)
+    {
+        $quote = $this->session->getQuote();
+        $result['hasRecurringItems'] = $quote && $this->filter->hasRecurringItems($quote);
+        return $result;
+    }
+} 
\ No newline at end of file
diff --git a/app/code/Magento/RecurringProfile/Block/Profile/Grid.php b/app/code/Magento/RecurringProfile/Block/Profile/Grid.php
index 523e1169978..ed54e6a5662 100644
--- a/app/code/Magento/RecurringProfile/Block/Profile/Grid.php
+++ b/app/code/Magento/RecurringProfile/Block/Profile/Grid.php
@@ -30,7 +30,7 @@ namespace Magento\RecurringProfile\Block\Profile;
 class Grid extends \Magento\RecurringProfile\Block\Profiles
 {
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
@@ -54,14 +54,14 @@ class Grid extends \Magento\RecurringProfile\Block\Profiles
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\RecurringProfile\Model\Profile $recurringProfile
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\RecurringProfile\Block\Fields $fields
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\RecurringProfile\Model\Profile $recurringProfile,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\RecurringProfile\Block\Fields $fields,
         array $data = array()
     ) {
diff --git a/app/code/Magento/RecurringProfile/Block/Profile/Related/Orders/Grid.php b/app/code/Magento/RecurringProfile/Block/Profile/Related/Orders/Grid.php
index 7e8566318da..112c131a836 100644
--- a/app/code/Magento/RecurringProfile/Block/Profile/Related/Orders/Grid.php
+++ b/app/code/Magento/RecurringProfile/Block/Profile/Related/Orders/Grid.php
@@ -30,7 +30,7 @@ namespace Magento\RecurringProfile\Block\Profile\Related\Orders;
 class Grid extends \Magento\RecurringProfile\Block\Profile\View
 {
     /**
-     * @var \Magento\Sales\Model\Resource\Order\Collection
+     * @var \Magento\RecurringProfile\Model\Resource\Order\Collection
      */
     protected $_orderCollection;
     /**
@@ -43,20 +43,27 @@ class Grid extends \Magento\RecurringProfile\Block\Profile\View
      */
     protected $_coreHelper;
 
+    /**
+     * @var \Magento\RecurringProfile\Model\Resource\Order\CollectionFilter
+     */
+    protected $_recurringCollectionFilter;
+
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Model\Resource\Order\Collection $collection
      * @param \Magento\Sales\Model\Order\Config $config
      * @param \Magento\Core\Helper\Data $coreHelper
+     * @param \Magento\RecurringProfile\Model\Resource\Order\CollectionFilter $recurringCollectionFilter
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Sales\Model\Resource\Order\Collection $collection,
         \Magento\Sales\Model\Order\Config $config,
         \Magento\Core\Helper\Data $coreHelper,
+        \Magento\RecurringProfile\Model\Resource\Order\CollectionFilter $recurringCollectionFilter,
         array $data = array()
     ) {
         $this->_coreHelper = $coreHelper;
@@ -64,6 +71,7 @@ class Grid extends \Magento\RecurringProfile\Block\Profile\View
         $this->_orderCollection = $collection;
         $this->_config = $config;
         $this->_isScopePrivate = true;
+        $this->_recurringCollectionFilter = $recurringCollectionFilter;
     }
     /**
      * Prepare related orders collection
@@ -73,11 +81,14 @@ class Grid extends \Magento\RecurringProfile\Block\Profile\View
     protected function _prepareRelatedOrders($fieldsToSelect = '*')
     {
         if (null === $this->_relatedOrders) {
-            $this->_relatedOrders = $this->_orderCollection
+            $this->_orderCollection
                 ->addFieldToSelect($fieldsToSelect)
                 ->addFieldToFilter('customer_id', $this->_registry->registry('current_customer')->getId())
-                ->addRecurringProfilesFilter($this->_recurringProfile->getId())
                 ->setOrder('entity_id', 'desc');
+            $this->_relatedOrders = $this->_recurringCollectionFilter->byIds(
+                $this->_orderCollection,
+                $this->_recurringProfile->getId()
+            );
         }
     }
 
diff --git a/app/code/Magento/RecurringProfile/Block/Profile/View.php b/app/code/Magento/RecurringProfile/Block/Profile/View.php
index 0183fa3b3a9..5b5aae97d0c 100644
--- a/app/code/Magento/RecurringProfile/Block/Profile/View.php
+++ b/app/code/Magento/RecurringProfile/Block/Profile/View.php
@@ -56,7 +56,7 @@ class View extends \Magento\View\Element\Template
     protected $_relatedOrders = null;
 
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
@@ -69,12 +69,12 @@ class View extends \Magento\View\Element\Template
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_registry = $registry;
diff --git a/app/code/Magento/RecurringProfile/Block/Profile/View/Address.php b/app/code/Magento/RecurringProfile/Block/Profile/View/Address.php
index 165f9ecb850..d3e683eb7d7 100644
--- a/app/code/Magento/RecurringProfile/Block/Profile/View/Address.php
+++ b/app/code/Magento/RecurringProfile/Block/Profile/View/Address.php
@@ -31,13 +31,13 @@ class Address extends \Magento\RecurringProfile\Block\Profile\View
 {
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Model\Order\AddressFactory $addressFactory
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Sales\Model\Order\AddressFactory $addressFactory,
         array $data = array()
     ) {
diff --git a/app/code/Magento/RecurringProfile/Block/Profile/View/Fees.php b/app/code/Magento/RecurringProfile/Block/Profile/View/Fees.php
index bd800dfef39..720336d40e7 100644
--- a/app/code/Magento/RecurringProfile/Block/Profile/View/Fees.php
+++ b/app/code/Magento/RecurringProfile/Block/Profile/View/Fees.php
@@ -41,14 +41,14 @@ class Fees extends \Magento\RecurringProfile\Block\Profile\View
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Helper\Data $coreHelper
      * @param \Magento\RecurringProfile\Block\Fields $fields
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Core\Helper\Data $coreHelper,
         \Magento\RecurringProfile\Block\Fields $fields,
         array $data = array()
diff --git a/app/code/Magento/RecurringProfile/Block/Profile/View/Item.php b/app/code/Magento/RecurringProfile/Block/Profile/View/Item.php
index 3162e01be2e..5fb29bc8a80 100644
--- a/app/code/Magento/RecurringProfile/Block/Profile/View/Item.php
+++ b/app/code/Magento/RecurringProfile/Block/Profile/View/Item.php
@@ -40,14 +40,14 @@ class Item extends \Magento\RecurringProfile\Block\Profile\View
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\Product\Option $option
      * @param \Magento\Catalog\Model\Product $product
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\Product\Option $option,
         \Magento\Catalog\Model\Product $product,
         array $data = array()
@@ -115,7 +115,7 @@ class Item extends \Magento\RecurringProfile\Block\Profile\View
                     'option_id' => $option->getId(),
                     'key' => $request['options'][$option->getId()]['secret_key']
                 );
-                $group->setCustomOptionDownloadUrl('sales/download/downloadProfileCustomOption')
+                $group->setCustomOptionDownloadUrl('recurringProfile/download/downloadProfileCustomOption')
                     ->setCustomOptionUrlParams($downloadParams);
             }
 
diff --git a/app/code/Magento/RecurringProfile/Block/Profile/View/Reference.php b/app/code/Magento/RecurringProfile/Block/Profile/View/Reference.php
index 90a94a18c82..7041b7eae29 100644
--- a/app/code/Magento/RecurringProfile/Block/Profile/View/Reference.php
+++ b/app/code/Magento/RecurringProfile/Block/Profile/View/Reference.php
@@ -36,13 +36,13 @@ class Reference extends \Magento\RecurringProfile\Block\Profile\View
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\RecurringProfile\Block\Fields $fields
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\RecurringProfile\Block\Fields $fields,
         array $data = array()
     ) {
diff --git a/app/code/Magento/RecurringProfile/Block/Profile/View/Schedule.php b/app/code/Magento/RecurringProfile/Block/Profile/View/Schedule.php
index 18d0c76e378..a554fa6376d 100644
--- a/app/code/Magento/RecurringProfile/Block/Profile/View/Schedule.php
+++ b/app/code/Magento/RecurringProfile/Block/Profile/View/Schedule.php
@@ -36,13 +36,13 @@ class Schedule extends \Magento\RecurringProfile\Block\Profile\View
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\RecurringProfile\Block\Fields $fields
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\RecurringProfile\Block\Fields $fields,
         array $data = array()
     ) {
diff --git a/app/code/Magento/RecurringProfile/Controller/Adminhtml/RecurringProfile.php b/app/code/Magento/RecurringProfile/Controller/Adminhtml/RecurringProfile.php
index bbbd032e54a..ae2a81317f9 100644
--- a/app/code/Magento/RecurringProfile/Controller/Adminhtml/RecurringProfile.php
+++ b/app/code/Magento/RecurringProfile/Controller/Adminhtml/RecurringProfile.php
@@ -54,7 +54,7 @@ class RecurringProfile extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -70,13 +70,13 @@ class RecurringProfile extends \Magento\Backend\App\Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Customer\Service\V1\CustomerServiceInterface $customerService
      * @param \Magento\Logger $logger
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Customer\Service\V1\CustomerServiceInterface $customerService,
         \Magento\Logger $logger
     ) {
diff --git a/app/code/Magento/RecurringProfile/Controller/Download.php b/app/code/Magento/RecurringProfile/Controller/Download.php
new file mode 100644
index 00000000000..91e3d5c38ff
--- /dev/null
+++ b/app/code/Magento/RecurringProfile/Controller/Download.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\RecurringProfile\Controller;
+
+class Download extends \Magento\App\Action\Action
+{
+    /** @var \Magento\Sales\Model\Download */
+    protected $download;
+
+    public function __construct(\Magento\App\Action\Context $context, \Magento\Sales\Model\Download $download)
+    {
+        parent::__construct($context);
+        $this->download = $download;
+    }
+
+    /**
+     * Profile custom options download action
+     */
+    public function downloadProfileCustomOptionAction()
+    {
+        $recurringProfile = $this->_objectManager->create('Magento\RecurringProfile\Model\Profile')
+            ->load($this->getRequest()->getParam('id'));
+
+        if (!$recurringProfile->getId()) {
+            $this->_forward('noroute');
+        }
+
+        $orderItemInfo = $recurringProfile->getData('order_item_info');
+        try {
+            $buyRequest = unserialize($orderItemInfo['info_buyRequest']);
+            if ($buyRequest['product'] != $orderItemInfo['product_id']) {
+                throw new \Exception();
+            }
+            $this->download->downloadFile($this->getOptionInfo($buyRequest));
+        } catch (\Exception $e) {
+            $this->_forward('noroute');
+        }
+    }
+
+    /**
+     * Retrieve custom option information
+     *
+     * @param array $buyRequest
+     * @return array
+     * @throws \Exception
+     */
+    protected function getOptionInfo($buyRequest)
+    {
+        $optionId = $this->getRequest()->getParam('option_id');
+        if (!isset($buyRequest['options'][$optionId])) {
+            throw new \Exception();
+        }
+        /** @var Magento\Catalog\Model\Product $product */
+        $product = $this->_objectManager->create('Magento\Catalog\Model\Product')->load($buyRequest['product']);
+        if (!$product->getId()) {
+            throw new \Exception();
+        }
+        $option = $product->getOptionById($optionId);
+        if (!$option || !$option->getId() || $option->getType() != 'file') {
+            throw new \Exception();
+        }
+        $info = $buyRequest['options'][$this->getRequest()->getParam('option_id')];
+        if ($this->getRequest()->getParam('key') != $info['secret_key']) {
+            throw new \Exception();
+        }
+        return $info;
+    }
+}
diff --git a/app/code/Magento/RecurringProfile/Controller/RecurringProfile.php b/app/code/Magento/RecurringProfile/Controller/RecurringProfile.php
index 1c228392c92..a59005b537f 100644
--- a/app/code/Magento/RecurringProfile/Controller/RecurringProfile.php
+++ b/app/code/Magento/RecurringProfile/Controller/RecurringProfile.php
@@ -40,7 +40,7 @@ class RecurringProfile extends \Magento\App\Action\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -51,12 +51,12 @@ class RecurringProfile extends \Magento\App\Action\Action
 
     /**
      * @param \Magento\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\App\Action\Title $title
      */
     public function __construct(
         \Magento\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\App\Action\Title $title
     ) {
         $this->_coreRegistry = $coreRegistry;
@@ -102,6 +102,14 @@ class RecurringProfile extends \Magento\App\Action\Action
         $this->_viewAction();
     }
 
+    /**
+     * Profile related orders view
+     */
+    public function ordersAction()
+    {
+        $this->_viewAction();
+    }
+
     /**
      * Attempt to set profile state
      */
diff --git a/app/code/Magento/RecurringProfile/Model/Method/PaymentMethodsList.php b/app/code/Magento/RecurringProfile/Model/Method/PaymentMethodsList.php
new file mode 100644
index 00000000000..5aaf5b9c114
--- /dev/null
+++ b/app/code/Magento/RecurringProfile/Model/Method/PaymentMethodsList.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\RecurringProfile\Model\Method;
+
+class PaymentMethodsList implements \Magento\Option\ArrayInterface
+{
+    /** @var  \Magento\Payment\Helper\Data */
+    protected $paymentHelper;
+
+    /** @var  RecurringPaymentSpecification */
+    protected $specification;
+
+    /**
+     * @param \Magento\Payment\Helper\Data $paymentHelper
+     * @param RecurringPaymentSpecification $specification
+     */
+    public function __construct(
+        \Magento\Payment\Helper\Data $paymentHelper,
+        RecurringPaymentSpecification $specification
+    ) {
+        $this->paymentHelper = $paymentHelper;
+        $this->specification = $specification;
+    }
+
+    /**
+     * Return option array
+     *
+     * @return array
+     */
+    public function toOptionArray()
+    {
+        $result = array();
+        foreach ($this->paymentHelper->getPaymentMethods() as $code => $data) {
+            if ($this->specification->isSatisfiedBy($code)) {
+                $result[$code] =  isset($data['title'])
+                    ? $data['title']
+                    : $this->paymentHelper->getMethodInstance($code)->getTitle();
+            }
+        }
+        return $result;
+    }
+}
\ No newline at end of file
diff --git a/app/code/Magento/RecurringProfile/Model/Method/RecurringPaymentSpecification.php b/app/code/Magento/RecurringProfile/Model/Method/RecurringPaymentSpecification.php
new file mode 100644
index 00000000000..7fab8988192
--- /dev/null
+++ b/app/code/Magento/RecurringProfile/Model/Method/RecurringPaymentSpecification.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\RecurringProfile\Model\Method;
+
+use Magento\Payment\Model\Method\Specification\AbstractSpecification;
+
+/**
+ * Enable method specification
+ */
+class RecurringPaymentSpecification extends AbstractSpecification
+{
+    /**
+     * Allow multiple address flag
+     */
+    const CONFIG_KEY = 'support_recurring_payment';
+
+    /**
+     * {@inheritdoc}
+     */
+    public function isSatisfiedBy($paymentMethod)
+    {
+        return isset($this->methodsInfo[$paymentMethod][self::CONFIG_KEY])
+            && $this->methodsInfo[$paymentMethod][self::CONFIG_KEY];
+    }
+}
diff --git a/app/code/Magento/RecurringProfile/Model/Observer.php b/app/code/Magento/RecurringProfile/Model/Observer.php
index c4c253d20eb..2d5254bad3a 100644
--- a/app/code/Magento/RecurringProfile/Model/Observer.php
+++ b/app/code/Magento/RecurringProfile/Model/Observer.php
@@ -48,7 +48,7 @@ class Observer
      *
      * @var \Magento\RecurringProfile\Model\RecurringProfileFactory
      */
-    protected $_profileFactory;
+    protected $_recurringProfileFactory;
 
     /**
      * @var \Magento\View\Element\BlockFactory
@@ -60,25 +60,41 @@ class Observer
      */
     protected $_fields;
 
+    /**
+     * @var \Magento\Checkout\Model\Session
+     */
+    protected $_checkoutSession;
+
+    /**
+     * @var Quote
+     */
+    protected $_quoteImporter;
+
     /**
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
-     * @param \Magento\RecurringProfile\Model\RecurringProfileFactory $profileFactory
+     * @param \Magento\RecurringProfile\Model\RecurringProfileFactory $recurringProfileFactory
      * @param \Magento\View\Element\BlockFactory $blockFactory
      * @param \Magento\RecurringProfile\Block\Fields $fields
+     * @param \Magento\Checkout\Model\Session $checkoutSession
+     * @param QuoteImporter $quoteImporter
      */
     public function __construct(
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
-        \Magento\RecurringProfile\Model\RecurringProfileFactory $profileFactory,
+        \Magento\RecurringProfile\Model\RecurringProfileFactory $recurringProfileFactory,
         \Magento\View\Element\BlockFactory $blockFactory,
-        \Magento\RecurringProfile\Block\Fields $fields
+        \Magento\RecurringProfile\Block\Fields $fields,
+        \Magento\Checkout\Model\Session $checkoutSession,
+        \Magento\RecurringProfile\Model\QuoteImporter $quoteImporter
     ) {
         $this->_locale = $locale;
         $this->_storeManager = $storeManager;
-        $this->_profileFactory = $profileFactory;
+        $this->_recurringProfileFactory = $recurringProfileFactory;
         $this->_blockFactory = $blockFactory;
         $this->_fields = $fields;
+        $this->_checkoutSession = $checkoutSession;
+        $this->_quoteImporter = $quoteImporter;
     }
 
     /**
@@ -98,7 +114,7 @@ class Observer
         }
 
         /** @var \Magento\RecurringProfile\Model\RecurringProfile $profile */
-        $profile = $this->_profileFactory->create(['locale' => $this->_locale]);
+        $profile = $this->_recurringProfileFactory->create(['locale' => $this->_locale]);
         $profile->setStore($this->_storeManager->getStore())
             ->importBuyRequest($buyRequest)
             ->importProduct($product);
@@ -157,4 +173,33 @@ class Observer
 
         $observer->getEvent()->getResult()->output = $output;
     }
+
+    /**
+     * Submit recurring profiles
+     *
+     * @param \Magento\Event\Observer $observer
+     * @throws \Magento\Core\Exception
+     */
+    public function submitRecurringPaymentProfiles($observer)
+    {
+        $profiles = $this->_quoteImporter->prepareRecurringPaymentProfiles($observer->getEvent()->getQuote());
+        foreach ($profiles as $profile) {
+            if (!$profile->isValid()) {
+                throw new \Magento\Core\Exception($profile->getValidationErrors());
+            }
+            $profile->submit();
+        }
+    }
+
+    public function addRecurringProfileIdsToSession($observer)
+    {
+        $profiles = $this->_quoteImporter->prepareRecurringPaymentProfiles($observer->getEvent()->getQuote());
+        if ($profiles) {
+            $ids = array();
+            foreach ($profiles as $profile) {
+                $ids[] = $profile->getId();
+            }
+            $this->_checkoutSession->setLastRecurringProfileIds($ids);
+        }
+    }
 }
diff --git a/app/code/Magento/RecurringProfile/Model/Observer/PaymentAvailabilityObserver.php b/app/code/Magento/RecurringProfile/Model/Observer/PaymentAvailabilityObserver.php
new file mode 100644
index 00000000000..051f971ab43
--- /dev/null
+++ b/app/code/Magento/RecurringProfile/Model/Observer/PaymentAvailabilityObserver.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\RecurringProfile\Model\Observer;
+
+use \Magento\Sales\Model\Quote;
+
+class PaymentAvailabilityObserver
+{
+    /** @var  \Magento\RecurringProfile\Model\Quote\Filter */
+    protected $quoteFilter;
+
+    /**
+     * @param \Magento\RecurringProfile\Model\Quote\Filter $quoteFilter
+     */
+    public function __construct(\Magento\RecurringProfile\Model\Quote\Filter $quoteFilter)
+    {
+        $this->quoteFilter = $quoteFilter;
+    }
+
+    /**
+     * @param \Magento\Payment\Model\Method\AbstractMethod $paymentMethod
+     * @return bool
+     */
+    private function canManageRecurringProfiles(\Magento\Payment\Model\Method\AbstractMethod $paymentMethod)
+    {
+        return $paymentMethod instanceof \Magento\Payment\Model\Recurring\Profile\MethodInterface;
+    }
+
+    /**
+     * @param \Magento\Event\Observer $observer
+     */
+    public function observe(\Magento\Event\Observer $observer)
+    {
+        /** @var \Magento\Sales\Model\Quote $quote */
+        $quote = $observer->getEvent()->getQuote();
+        /** @var \Magento\Payment\Model\Method\AbstractMethod $paymentMethod */
+        $paymentMethod = $observer->getEvent()->getMethodInstance();
+        $result = $observer->getEvent()->getResult();
+
+        if ($quote
+            && $this->quoteFilter->hasRecurringItems($quote)
+            && !$this->canManageRecurringProfiles($paymentMethod)
+        ) {
+            $result->isAvailable = false;
+        }
+    }
+}
+ 
\ No newline at end of file
diff --git a/app/code/Magento/RecurringProfile/Model/PeriodUnits.php b/app/code/Magento/RecurringProfile/Model/PeriodUnits.php
index c2ff91f0653..7c587123fcb 100644
--- a/app/code/Magento/RecurringProfile/Model/PeriodUnits.php
+++ b/app/code/Magento/RecurringProfile/Model/PeriodUnits.php
@@ -23,9 +23,7 @@
  */
 namespace Magento\RecurringProfile\Model;
 
-use Magento\Core\Model\Option;
-
-class PeriodUnits implements Option\ArrayInterface
+class PeriodUnits implements \Magento\Option\ArrayInterface
 {
     const DAY = 'day';
     const WEEK = 'week';
diff --git a/app/code/Magento/RecurringProfile/Model/Profile.php b/app/code/Magento/RecurringProfile/Model/Profile.php
index c9088be385f..edd3462e72b 100644
--- a/app/code/Magento/RecurringProfile/Model/Profile.php
+++ b/app/code/Magento/RecurringProfile/Model/Profile.php
@@ -135,8 +135,8 @@ class Profile extends \Magento\RecurringProfile\Model\RecurringProfile
     protected $states;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param PeriodUnits $periodUnits
      * @param \Magento\RecurringProfile\Block\Fields $fields
@@ -153,8 +153,8 @@ class Profile extends \Magento\RecurringProfile\Model\RecurringProfile
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\RecurringProfile\Model\PeriodUnits $periodUnits,
         \Magento\RecurringProfile\Block\Fields $fields,
diff --git a/app/code/Magento/RecurringProfile/Model/Quote/Filter.php b/app/code/Magento/RecurringProfile/Model/Quote/Filter.php
new file mode 100644
index 00000000000..44dd77a03f0
--- /dev/null
+++ b/app/code/Magento/RecurringProfile/Model/Quote/Filter.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\RecurringProfile\Model\Quote;
+
+use \Magento\Sales\Model\Quote;
+
+/**
+ * Class Filter
+ */
+class Filter
+{
+    /**
+     * Whether there are items with recurring profile
+     *
+     * @param \Magento\Sales\Model\Quote $quote
+     * @return bool
+     */
+    public function hasRecurringItems(Quote $quote)
+    {
+        foreach ($quote->getAllVisibleItems() as $item) {
+            if ($item->getProduct() && $item->getProduct()->getIsRecurring() == '1') {
+                return true;
+            }
+        }
+        return false;
+    }
+}
+ 
\ No newline at end of file
diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/Nominal/AbstractRecurring.php b/app/code/Magento/RecurringProfile/Model/Quote/Total/AbstractRecurring.php
similarity index 94%
rename from app/code/Magento/Sales/Model/Quote/Address/Total/Nominal/AbstractRecurring.php
rename to app/code/Magento/RecurringProfile/Model/Quote/Total/AbstractRecurring.php
index 64d1b8a0bb1..5c41017f44f 100644
--- a/app/code/Magento/Sales/Model/Quote/Address/Total/Nominal/AbstractRecurring.php
+++ b/app/code/Magento/RecurringProfile/Model/Quote/Total/AbstractRecurring.php
@@ -18,8 +18,6 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Sales
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
@@ -27,7 +25,7 @@
 /**
  * Total model for recurring profiles
  */
-namespace Magento\Sales\Model\Quote\Address\Total\Nominal;
+namespace Magento\RecurringProfile\Model\Quote\Total;
 
 abstract class AbstractRecurring
     extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal
@@ -57,7 +55,7 @@ abstract class AbstractRecurring
      * Collect recurring item parameters and copy to the address items
      *
      * @param \Magento\Sales\Model\Quote\Address $address
-     * @return \Magento\Sales\Model\Quote\Address\Total\Nominal\AbstractRecurring
+     * @return \Magento\RecurringProfile\Model\Quote\Total\AbstractRecurring
      */
     public function collect(\Magento\Sales\Model\Quote\Address $address)
     {
@@ -105,6 +103,7 @@ abstract class AbstractRecurring
      *
      * @param \Magento\Sales\Model\Quote\Address $address
      * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
     protected function _afterCollectSuccess($address, $item)
     {
diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/Nominal/Recurring/Initial.php b/app/code/Magento/RecurringProfile/Model/Quote/Total/Initial.php
similarity index 86%
rename from app/code/Magento/Sales/Model/Quote/Address/Total/Nominal/Recurring/Initial.php
rename to app/code/Magento/RecurringProfile/Model/Quote/Total/Initial.php
index 9beee23eee1..ae31484611d 100644
--- a/app/code/Magento/Sales/Model/Quote/Address/Total/Nominal/Recurring/Initial.php
+++ b/app/code/Magento/RecurringProfile/Model/Quote/Total/Initial.php
@@ -18,8 +18,6 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Sales
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
@@ -27,10 +25,10 @@
 /**
  * Total model for recurring profile initial fee
  */
-namespace Magento\Sales\Model\Quote\Address\Total\Nominal\Recurring;
+namespace Magento\RecurringProfile\Model\Quote\Total;
 
 class Initial
-    extends \Magento\Sales\Model\Quote\Address\Total\Nominal\AbstractRecurring
+    extends \Magento\RecurringProfile\Model\Quote\Total\AbstractRecurring
 {
     /**
      * Custom row total/profile keys
diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/Nominal/Recurring/Trial.php b/app/code/Magento/RecurringProfile/Model/Quote/Total/Trial.php
similarity index 89%
rename from app/code/Magento/Sales/Model/Quote/Address/Total/Nominal/Recurring/Trial.php
rename to app/code/Magento/RecurringProfile/Model/Quote/Total/Trial.php
index 18a53563261..3fc3f1d7856 100644
--- a/app/code/Magento/Sales/Model/Quote/Address/Total/Nominal/Recurring/Trial.php
+++ b/app/code/Magento/RecurringProfile/Model/Quote/Total/Trial.php
@@ -18,8 +18,6 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Sales
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
@@ -27,10 +25,10 @@
 /**
  * Total model for recurring profile trial payment
  */
-namespace Magento\Sales\Model\Quote\Address\Total\Nominal\Recurring;
+namespace Magento\RecurringProfile\Model\Quote\Total;
 
 class Trial
-    extends \Magento\Sales\Model\Quote\Address\Total\Nominal\AbstractRecurring
+    extends \Magento\RecurringProfile\Model\Quote\Total\AbstractRecurring
 {
     /**
      * Custom row total/profile keys
diff --git a/app/code/Magento/RecurringProfile/Model/QuoteImporter.php b/app/code/Magento/RecurringProfile/Model/QuoteImporter.php
new file mode 100644
index 00000000000..c89c7c337e9
--- /dev/null
+++ b/app/code/Magento/RecurringProfile/Model/QuoteImporter.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+/**
+ * Recurring profile quote model
+ */
+namespace Magento\RecurringProfile\Model;
+
+class QuoteImporter
+{
+    /**
+     * @var \Magento\RecurringProfile\Model\ProfileFactory
+     */
+    protected $_profileFactory;
+
+    /**
+     * @param \Magento\RecurringProfile\Model\ProfileFactory $profileFactory
+     */
+    public function __construct(\Magento\RecurringProfile\Model\ProfileFactory $profileFactory)
+    {
+        $this->_profileFactory = $profileFactory;
+    }
+
+    /**
+     * Prepare recurring payment profiles
+     *
+     * @param \Magento\Sales\Model\Quote $quote
+     * @throws \Exception
+     * @return array
+     */
+    public function prepareRecurringPaymentProfiles(\Magento\Sales\Model\Quote $quote)
+    {
+        if (!$quote->getTotalsCollectedFlag()) {
+            throw new \Exception('Quote totals must be collected before this operation.');
+        }
+
+        $result = [];
+        foreach ($quote->getAllVisibleItems() as $item) {
+            $product = $item->getProduct();
+            if (is_object($product) && ($product->isRecurring())
+                && $profile = $this->_profileFactory->create()->importProduct($product)
+            ) {
+                $profile->importQuote($quote);
+                $profile->importQuoteItem($item);
+                $result[] = $profile;
+            }
+        }
+        return $result;
+    }
+}
diff --git a/app/code/Magento/RecurringProfile/Model/RecurringProfile.php b/app/code/Magento/RecurringProfile/Model/RecurringProfile.php
index 4c482f9df3b..a9367259a96 100644
--- a/app/code/Magento/RecurringProfile/Model/RecurringProfile.php
+++ b/app/code/Magento/RecurringProfile/Model/RecurringProfile.php
@@ -88,8 +88,8 @@ class RecurringProfile extends \Magento\Core\Model\AbstractModel
     protected $_locale;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param PeriodUnits $periodUnits
      * @param \Magento\RecurringProfile\Block\Fields $fields
@@ -99,8 +99,8 @@ class RecurringProfile extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\RecurringProfile\Model\PeriodUnits $periodUnits,
         \Magento\RecurringProfile\Block\Fields $fields,
diff --git a/app/code/Magento/RecurringProfile/Model/Resource/Order/CollectionFilter.php b/app/code/Magento/RecurringProfile/Model/Resource/Order/CollectionFilter.php
new file mode 100644
index 00000000000..c0a3f6abb15
--- /dev/null
+++ b/app/code/Magento/RecurringProfile/Model/Resource/Order/CollectionFilter.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+
+/**
+ * Flat sales order collection
+ */
+namespace Magento\RecurringProfile\Model\Resource\Order;
+
+class CollectionFilter
+{
+    /**
+     * Add filter by specified recurring profile id(s)
+     *
+     * @param \Magento\Core\Model\Resource\Db\Collection\AbstractCollection $collection
+     * @param array|int $ids
+     * @return \Magento\Sales\Model\Resource\Order\Collection
+     */
+    public function byIds($collection, $ids)
+    {
+        $ids = (is_array($ids)) ? $ids : array($ids);
+        $collection->getSelect()
+            ->joinInner(
+                array('rpo' => $collection->getTable('recurring_profile_order')),
+                'main_table.entity_id = rpo.order_id',
+                array())
+            ->where('rpo.profile_id IN(?)', $ids);
+        return $collection;
+    }
+}
diff --git a/app/code/Magento/RecurringProfile/Model/States.php b/app/code/Magento/RecurringProfile/Model/States.php
index 6e71f25ef30..5f628433dac 100644
--- a/app/code/Magento/RecurringProfile/Model/States.php
+++ b/app/code/Magento/RecurringProfile/Model/States.php
@@ -23,9 +23,7 @@
  */
 namespace Magento\RecurringProfile\Model;
 
-use Magento\Core\Model\Option\ArrayInterface;
-
-class States implements ArrayInterface
+class States implements \Magento\Option\ArrayInterface
 {
     /**
      * @var string
diff --git a/app/code/Magento/RecurringProfile/etc/di.xml b/app/code/Magento/RecurringProfile/etc/di.xml
index 4b01a188af7..5234b163ca2 100644
--- a/app/code/Magento/RecurringProfile/etc/di.xml
+++ b/app/code/Magento/RecurringProfile/etc/di.xml
@@ -31,4 +31,7 @@
             </argument>
         </arguments>
     </type>
+    <type name="Magento\Checkout\Block\Onepage\Payment">
+        <plugin name="recurringprofile" type="Magento\RecurringProfile\Block\Plugin\Payment" />
+    </type>
 </config>
diff --git a/app/code/Magento/RecurringProfile/etc/events.xml b/app/code/Magento/RecurringProfile/etc/events.xml
new file mode 100644
index 00000000000..138451f567d
--- /dev/null
+++ b/app/code/Magento/RecurringProfile/etc/events.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+-->
+<config>
+    <event name="sales_model_service_quote_submit_nominal_items">
+        <observer name="magento_recurringprofile" instance="Magento\RecurringProfile\Model\Observer" method="submitRecurringPaymentProfiles" />
+    </event>
+    <event name="checkout_submit_all_after">
+        <observer name="magento_recurringprofile" instance="Magento\RecurringProfile\Model\Observer" method="addRecurringProfileIdsToSession" />
+    </event>
+    <event name="paypal_express_place_order_success">
+        <observer name="magento_recurringprofile" instance="Magento\RecurringProfile\Model\Observer" method="addRecurringProfileIdsToSession" />
+    </event>
+    <event name="payment_method_is_active">
+        <observer name="magento_recurringprofile" instance="Magento\RecurringProfile\Model\Observer\PaymentAvailabilityObserver" method="observe" />
+    </event>
+</config>
diff --git a/app/code/Magento/Cms/etc/events.xml b/app/code/Magento/RecurringProfile/etc/frontend/page_types.xml
similarity index 83%
rename from app/code/Magento/Cms/etc/events.xml
rename to app/code/Magento/RecurringProfile/etc/frontend/page_types.xml
index e143b427cd6..922db7cde2f 100644
--- a/app/code/Magento/Cms/etc/events.xml
+++ b/app/code/Magento/RecurringProfile/etc/frontend/page_types.xml
@@ -23,8 +23,7 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 -->
-<config>
-    <event name="controller_front_init_routers">
-        <observer name="cms" instance="Magento\Cms\Controller\Router" method="initControllerRouters" />
-    </event>
-</config>
+<page_types>
+    <type id="sales_recurringprofile_index" label="Recurring Profile"/>
+    <type id="sales_recurringprofile_view" label="Recurring Profile View"/>
+</page_types>
diff --git a/app/code/Magento/RecurringProfile/etc/module.xml b/app/code/Magento/RecurringProfile/etc/module.xml
index bce35e7e344..4d360b6a96f 100644
--- a/app/code/Magento/RecurringProfile/etc/module.xml
+++ b/app/code/Magento/RecurringProfile/etc/module.xml
@@ -33,6 +33,7 @@
             <module name="Magento_Backend"/>
             <module name="Magento_Core"/>
             <module name="Magento_Catalog"/>
+            <module name="Magento_Checkout"/>
             <module name="Magento_Customer"/>
             <module name="Magento_Payment"/>
             <module name="Magento_Sales"/>
diff --git a/app/code/Magento/RecurringProfile/etc/sales.xml b/app/code/Magento/RecurringProfile/etc/sales.xml
new file mode 100644
index 00000000000..ff83653ffe0
--- /dev/null
+++ b/app/code/Magento/RecurringProfile/etc/sales.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+-->
+<config>
+    <section name="quote">
+        <group name="nominal_totals">
+            <item name="recurring_initial_fee" instance="Magento\RecurringProfile\Model\Quote\Total\Initial" sort_order="10"/>
+            <item name="recurring_trial_payment" instance="Magento\RecurringProfile\Model\Quote\Total\Trial" sort_order="50"/>
+        </group>
+    </section>
+</config>
diff --git a/app/code/Magento/Reports/Block/Product/AbstractProduct.php b/app/code/Magento/Reports/Block/Product/AbstractProduct.php
index 227028ef786..4df3b191973 100644
--- a/app/code/Magento/Reports/Block/Product/AbstractProduct.php
+++ b/app/code/Magento/Reports/Block/Product/AbstractProduct.php
@@ -60,7 +60,7 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -73,13 +73,13 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr
      * @param \Magento\Reports\Model\Product\Index\Factory $indexFactory
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Reports/Model/Event.php b/app/code/Magento/Reports/Model/Event.php
index 6b689ebf08a..fd00071254a 100644
--- a/app/code/Magento/Reports/Model/Event.php
+++ b/app/code/Magento/Reports/Model/Event.php
@@ -67,8 +67,8 @@ class Event extends \Magento\Core\Model\AbstractModel
     protected $_eventTypeFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\DateFactory $dateFactory
      * @param \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -76,8 +76,8 @@ class Event extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\DateFactory $dateFactory,
         \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php b/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php
index ebc069145d5..deedcab06b1 100644
--- a/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php
+++ b/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php
@@ -69,8 +69,8 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel
     protected $dateTime;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Log\Model\Visitor $logVisitor
      * @param \Magento\Customer\Model\Session $customerSession
@@ -82,8 +82,8 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Log\Model\Visitor $logVisitor,
         \Magento\Customer\Model\Session $customerSession,
diff --git a/app/code/Magento/Reports/Model/Product/Index/Compared.php b/app/code/Magento/Reports/Model/Product/Index/Compared.php
index 45441c54499..9f2973be6f9 100644
--- a/app/code/Magento/Reports/Model/Product/Index/Compared.php
+++ b/app/code/Magento/Reports/Model/Product/Index/Compared.php
@@ -59,8 +59,8 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex
     protected $_productCompare = null;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Log\Model\Visitor $logVisitor
      * @param \Magento\Customer\Model\Session $customerSession
@@ -73,8 +73,8 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Log\Model\Visitor $logVisitor,
         \Magento\Customer\Model\Session $customerSession,
diff --git a/app/code/Magento/Reports/Model/Resource/Product/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Collection.php
index 57f8ce31b47..14bd60dd018 100644
--- a/app/code/Magento/Reports/Model/Resource/Product/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Product/Collection.php
@@ -88,7 +88,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
      * @param \Magento\Validator\UniversalFactory $universalFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Catalog\Helper\Product\Flat $catalogProductFlat
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
      * @param \Magento\Catalog\Model\Resource\Url $catalogUrl
@@ -114,7 +114,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
         \Magento\Validator\UniversalFactory $universalFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Catalog\Helper\Product\Flat $catalogProductFlat,
+        \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
         \Magento\Catalog\Model\Resource\Url $catalogUrl,
@@ -141,7 +141,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
             $universalFactory,
             $storeManager,
             $catalogData,
-            $catalogProductFlat,
+            $catalogProductFlatState,
             $coreStoreConfig,
             $productOptionFactory,
             $catalogUrl,
diff --git a/app/code/Magento/Reports/Model/Resource/Product/Index/Collection/AbstractCollection.php b/app/code/Magento/Reports/Model/Resource/Product/Index/Collection/AbstractCollection.php
index ba0a113f955..0a8f4cc9410 100644
--- a/app/code/Magento/Reports/Model/Resource/Product/Index/Collection/AbstractCollection.php
+++ b/app/code/Magento/Reports/Model/Resource/Product/Index/Collection/AbstractCollection.php
@@ -61,7 +61,7 @@ abstract class AbstractCollection
      * @param \Magento\Validator\UniversalFactory $universalFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Catalog\Helper\Product\Flat $catalogProductFlat
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
      * @param \Magento\Catalog\Model\Resource\Url $catalogUrl
@@ -85,7 +85,7 @@ abstract class AbstractCollection
         \Magento\Validator\UniversalFactory $universalFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Catalog\Helper\Product\Flat $catalogProductFlat,
+        \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
         \Magento\Catalog\Model\Resource\Url $catalogUrl,
@@ -107,7 +107,7 @@ abstract class AbstractCollection
             $universalFactory,
             $storeManager,
             $catalogData,
-            $catalogProductFlat,
+            $catalogProductFlatState,
             $coreStoreConfig,
             $productOptionFactory,
             $catalogUrl,
diff --git a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php
index 6e53922d83f..264726a6f31 100644
--- a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php
@@ -74,7 +74,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection
      * @param \Magento\Validator\UniversalFactory $universalFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Catalog\Helper\Product\Flat $catalogProductFlat
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
      * @param \Magento\Catalog\Model\Resource\Url $catalogUrl
@@ -102,7 +102,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection
         \Magento\Validator\UniversalFactory $universalFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Catalog\Helper\Product\Flat $catalogProductFlat,
+        \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
         \Magento\Catalog\Model\Resource\Url $catalogUrl,
@@ -128,7 +128,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection
             $universalFactory,
             $storeManager,
             $catalogData,
-            $catalogProductFlat,
+            $catalogProductFlatState,
             $coreStoreConfig,
             $productOptionFactory,
             $catalogUrl,
diff --git a/app/code/Magento/Reports/Model/Resource/Report/Collection/AbstractCollection.php b/app/code/Magento/Reports/Model/Resource/Report/Collection/AbstractCollection.php
index afb1b6fab83..6ed85738818 100644
--- a/app/code/Magento/Reports/Model/Resource/Report/Collection/AbstractCollection.php
+++ b/app/code/Magento/Reports/Model/Resource/Report/Collection/AbstractCollection.php
@@ -244,13 +244,23 @@ class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collection\Abst
         return $this;
     }
 
+    /**
+     * @return $this
+     */
+    protected function _initSelect()
+    {
+        return $this;
+    }
+
     /**
      * Apply filters common to reports
      *
      * @return $this
      */
-    protected function _initSelect()
+    protected function _beforeLoad()
     {
+        parent::_beforeLoad();
+
         $this->_applyDateRangeFilter();
         $this->_applyStoresFilter();
         $this->_applyCustomFilter();
diff --git a/app/code/Magento/Review/Block/Adminhtml/Add/Form.php b/app/code/Magento/Review/Block/Adminhtml/Add/Form.php
index fa58391274b..ac0c468f695 100644
--- a/app/code/Magento/Review/Block/Adminhtml/Add/Form.php
+++ b/app/code/Magento/Review/Block/Adminhtml/Add/Form.php
@@ -50,7 +50,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\System\Store $systemStore
      * @param \Magento\Review\Helper\Data $reviewData
@@ -58,7 +58,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\System\Store $systemStore,
         \Magento\Review\Helper\Data $reviewData,
diff --git a/app/code/Magento/Review/Block/Adminhtml/Edit.php b/app/code/Magento/Review/Block/Adminhtml/Edit.php
index be6711f6ac0..820b98d1b22 100644
--- a/app/code/Magento/Review/Block/Adminhtml/Edit.php
+++ b/app/code/Magento/Review/Block/Adminhtml/Edit.php
@@ -41,7 +41,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -56,14 +56,14 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Review\Model\ReviewFactory $reviewFactory
      * @param \Magento\Review\Helper\Action\Pager $reviewActionPager
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Review\Model\ReviewFactory $reviewFactory,
         \Magento\Review\Helper\Action\Pager $reviewActionPager,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php
index 1e0d62c72c7..dfc55268791 100644
--- a/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php
+++ b/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php
@@ -61,7 +61,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\System\Store $systemStore
      * @param \Magento\Customer\Model\CustomerFactory $customerFactory
@@ -71,7 +71,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\System\Store $systemStore,
         \Magento\Customer\Model\CustomerFactory $customerFactory,
diff --git a/app/code/Magento/Review/Block/Adminhtml/Grid.php b/app/code/Magento/Review/Block/Adminhtml/Grid.php
index 5ac101ef5dd..a4372c1c816 100644
--- a/app/code/Magento/Review/Block/Adminhtml/Grid.php
+++ b/app/code/Magento/Review/Block/Adminhtml/Grid.php
@@ -58,7 +58,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -83,7 +83,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Review\Model\Resource\Review\Product\CollectionFactory $productsFactory
      * @param \Magento\Review\Helper\Data $reviewData
      * @param \Magento\Review\Helper\Action\Pager $reviewActionPager
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -93,7 +93,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
         \Magento\Review\Model\Resource\Review\Product\CollectionFactory $productsFactory,
         \Magento\Review\Helper\Data $reviewData,
         \Magento\Review\Helper\Action\Pager $reviewActionPager,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_productsFactory = $productsFactory;
diff --git a/app/code/Magento/Review/Block/Adminhtml/Main.php b/app/code/Magento/Review/Block/Adminhtml/Main.php
index f8933abeac8..e23dc928a0c 100644
--- a/app/code/Magento/Review/Block/Adminhtml/Main.php
+++ b/app/code/Magento/Review/Block/Adminhtml/Main.php
@@ -34,7 +34,7 @@ class Main extends \Magento\Backend\Block\Widget\Grid\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -56,14 +56,14 @@ class Main extends \Magento\Backend\Block\Widget\Grid\Container
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Customer\Model\CustomerFactory $customerFactory
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Customer\Model\CustomerFactory $customerFactory,
         \Magento\Catalog\Model\ProductFactory $productFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Review/Block/Adminhtml/Rating/Detailed.php b/app/code/Magento/Review/Block/Adminhtml/Rating/Detailed.php
index a96a1ef2796..dec3a13343f 100644
--- a/app/code/Magento/Review/Block/Adminhtml/Rating/Detailed.php
+++ b/app/code/Magento/Review/Block/Adminhtml/Rating/Detailed.php
@@ -52,7 +52,7 @@ class Detailed extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -74,14 +74,14 @@ class Detailed extends \Magento\Backend\Block\Template
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Rating\Model\Resource\Rating\CollectionFactory $ratingsFactory
      * @param \Magento\Rating\Model\Resource\Rating\Option\Vote\CollectionFactory $votesFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Rating\Model\Resource\Rating\CollectionFactory $ratingsFactory,
         \Magento\Rating\Model\Resource\Rating\Option\Vote\CollectionFactory $votesFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_ratingsFactory = $ratingsFactory;
diff --git a/app/code/Magento/Review/Block/Adminhtml/Rating/Summary.php b/app/code/Magento/Review/Block/Adminhtml/Rating/Summary.php
index 7e3830e1cda..a1a6c617c68 100644
--- a/app/code/Magento/Review/Block/Adminhtml/Rating/Summary.php
+++ b/app/code/Magento/Review/Block/Adminhtml/Rating/Summary.php
@@ -43,7 +43,7 @@ class Summary extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -65,14 +65,14 @@ class Summary extends \Magento\Backend\Block\Template
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Rating\Model\Resource\Rating\Option\Vote\CollectionFactory $votesFactory
      * @param \Magento\Rating\Model\RatingFactory $ratingFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Rating\Model\Resource\Rating\Option\Vote\CollectionFactory $votesFactory,
         \Magento\Rating\Model\RatingFactory $ratingFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_votesFactory = $votesFactory;
diff --git a/app/code/Magento/Review/Block/Customer/View.php b/app/code/Magento/Review/Block/Customer/View.php
index d23751758e2..d9e408a2139 100644
--- a/app/code/Magento/Review/Block/Customer/View.php
+++ b/app/code/Magento/Review/Block/Customer/View.php
@@ -83,7 +83,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -99,13 +99,13 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct
      * @param \Magento\Customer\Model\Session $customerSession
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Review/Block/Product/View.php b/app/code/Magento/Review/Block/Product/View.php
index f6af37fd442..bf121539a1c 100644
--- a/app/code/Magento/Review/Block/Product/View.php
+++ b/app/code/Magento/Review/Block/Product/View.php
@@ -53,7 +53,7 @@ class View extends \Magento\Catalog\Block\Product\View
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -78,7 +78,7 @@ class View extends \Magento\Catalog\Block\Product\View
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Review/Block/Product/View/Other.php b/app/code/Magento/Review/Block/Product/View/Other.php
index e3051b6e9d0..6124ced6f6e 100644
--- a/app/code/Magento/Review/Block/Product/View/Other.php
+++ b/app/code/Magento/Review/Block/Product/View/Other.php
@@ -32,19 +32,18 @@ namespace Magento\Review\Block\Product\View;
 class Other extends \Magento\View\Element\Template
 {
     /**
-     * Core model registry
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_registry = $registry;
diff --git a/app/code/Magento/Review/Block/View.php b/app/code/Magento/Review/Block/View.php
index 38d493b8cc7..14e51e6c2e3 100644
--- a/app/code/Magento/Review/Block/View.php
+++ b/app/code/Magento/Review/Block/View.php
@@ -63,7 +63,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -77,13 +77,13 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct
      * @param \Magento\Review\Model\ReviewFactory $reviewFactory
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Review/Controller/Product.php b/app/code/Magento/Review/Controller/Product.php
index 918239e399c..82c69962a00 100644
--- a/app/code/Magento/Review/Controller/Product.php
+++ b/app/code/Magento/Review/Controller/Product.php
@@ -39,7 +39,7 @@ class Product extends \Magento\App\Action\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -122,7 +122,7 @@ class Product extends \Magento\App\Action\Action
 
     /**
      * @param \Magento\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
      * @param \Magento\Logger $logger
@@ -137,7 +137,7 @@ class Product extends \Magento\App\Action\Action
      */
     public function __construct(
         \Magento\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Catalog\Model\CategoryFactory $categoryFactory,
         \Magento\Logger $logger,
diff --git a/app/code/Magento/Review/Model/Resource/Review/Product/Collection.php b/app/code/Magento/Review/Model/Resource/Review/Product/Collection.php
index f7211458a52..bdcbf6ecfa3 100644
--- a/app/code/Magento/Review/Model/Resource/Review/Product/Collection.php
+++ b/app/code/Magento/Review/Model/Resource/Review/Product/Collection.php
@@ -88,7 +88,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
      * @param \Magento\Validator\UniversalFactory $universalFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
-     * @param \Magento\Catalog\Helper\Product\Flat $catalogProductFlat
+     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
      * @param \Magento\Catalog\Model\Resource\Url $catalogUrl
@@ -113,7 +113,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
         \Magento\Validator\UniversalFactory $universalFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
-        \Magento\Catalog\Helper\Product\Flat $catalogProductFlat,
+        \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
         \Magento\Catalog\Model\Resource\Url $catalogUrl,
@@ -138,7 +138,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
             $universalFactory,
             $storeManager,
             $catalogData,
-            $catalogProductFlat,
+            $catalogProductFlatState,
             $coreStoreConfig,
             $productOptionFactory,
             $catalogUrl,
diff --git a/app/code/Magento/Review/Model/Review.php b/app/code/Magento/Review/Model/Review.php
index 1fe17a541aa..86124ac64a6 100644
--- a/app/code/Magento/Review/Model/Review.php
+++ b/app/code/Magento/Review/Model/Review.php
@@ -116,8 +116,8 @@ class Review extends \Magento\Core\Model\AbstractModel
     protected $_urlModel;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Review\Model\Resource\Review\Product\CollectionFactory $productFactory
      * @param \Magento\Review\Model\Resource\Review\Status\CollectionFactory $statusFactory
      * @param \Magento\Review\Model\Resource\Review\Summary\CollectionFactory $summaryFactory
@@ -130,8 +130,8 @@ class Review extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Review\Model\Resource\Review\Product\CollectionFactory $productFactory,
         \Magento\Review\Model\Resource\Review\Status\CollectionFactory $statusFactory,
         \Magento\Review\Model\Resource\Review\Summary\CollectionFactory $summaryFactory,
diff --git a/app/code/Magento/Review/Model/Review/Status.php b/app/code/Magento/Review/Model/Review/Status.php
index 77bcb5e5649..e7b5ae70416 100644
--- a/app/code/Magento/Review/Model/Review/Status.php
+++ b/app/code/Magento/Review/Model/Review/Status.php
@@ -37,15 +37,15 @@ namespace Magento\Review\Model\Review;
 class Status extends \Magento\Core\Model\AbstractModel
 {
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
diff --git a/app/code/Magento/Review/Model/Review/Summary.php b/app/code/Magento/Review/Model/Review/Summary.php
index ea8ad61347b..6414fcdb239 100644
--- a/app/code/Magento/Review/Model/Review/Summary.php
+++ b/app/code/Magento/Review/Model/Review/Summary.php
@@ -31,15 +31,15 @@ namespace Magento\Review\Model\Review;
 class Summary extends \Magento\Core\Model\AbstractModel
 {
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Review\Model\Resource\Review\Summary $resource
      * @param \Magento\Review\Model\Resource\Review\Summary\Collection $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Review\Model\Resource\Review\Summary $resource,
         \Magento\Review\Model\Resource\Review\Summary\Collection $resourceCollection,
         array $data = array()
diff --git a/app/code/Magento/Review/i18n/de_DE.csv b/app/code/Magento/Review/i18n/de_DE.csv
index eacb925e72f..fd00ded0e34 100644
--- a/app/code/Magento/Review/i18n/de_DE.csv
+++ b/app/code/Magento/Review/i18n/de_DE.csv
@@ -6,7 +6,7 @@
 "3 stars","3 Sterne"
 "4 stars","4 Sterne"
 "5 stars","5 Sterne"
-"<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
+"<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
 "Add New Review","Neues Review hinzufügen"
 "Add Your Review","Eigenes Review hinzufügen"
 "Administrator","Administrator"
@@ -44,7 +44,7 @@
 "Name in Store","Name im Shop"
 "New Review","Neues Review"
 "Nickname","Nickname"
-"Nickname can\'t be empty","Nickname darf nicht leer sein"
+"Nickname can't be empty","Nickname darf nicht leer sein"
 "Only registered users can write reviews. Please, <a href=""%s"">log in</a> or <a href=""%s"">register</a>","Nur registrierte Benutzer können Bewertungen schreiben. Bitte <a href=""%s"">loggen Sie sich ein</a> oder <a href=""%s"">registrieren Sie sich</a>"
 "Pending Reviews","Ausstehende Reviews"
 "Pending Reviews of Customer `%s`","Ausstehende Reviews des Kunden '%s'"
@@ -67,8 +67,8 @@
 "Review Details","Reviewdetails"
 "Review Form Fields Before","Felder Bewertungsformular vorher"
 "Review by <span>%s</span>","Review von <span>%s</span>"
-"Review can\'t be empty","Review darf nicht leer sein"
-"Review summary can\'t be empty","Zusammenfassung des Reviews darf nicht leer sein"
+"Review can't be empty","Review darf nicht leer sein"
+"Review summary can't be empty","Zusammenfassung des Reviews darf nicht leer sein"
 "Reviews and Ratings","Reviews und Bewertungen"
 "SKU","SKU"
 "Save Review","Review speichern"
diff --git a/app/code/Magento/Review/i18n/en_US.csv b/app/code/Magento/Review/i18n/en_US.csv
index 369dae49b8d..367ef415570 100644
--- a/app/code/Magento/Review/i18n/en_US.csv
+++ b/app/code/Magento/Review/i18n/en_US.csv
@@ -6,7 +6,7 @@
 "3 stars","3 stars"
 "4 stars","4 stars"
 "5 stars","5 stars"
-"<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
+"<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
 "Add New Review","Add New Review"
 "Add Your Review","Add Your Review"
 "Administrator","Administrator"
@@ -45,7 +45,7 @@
 "Name in Store","Name in Store"
 "New Review","New Review"
 "Nickname","Nickname"
-"Nickname can\'t be empty","Nickname can\'t be empty"
+"Nickname can't be empty","Nickname can't be empty"
 "Only registered users can write reviews. Please, <a href=""%s"">log in</a> or <a href=""%s"">register</a>","Only registered users can write reviews. Please, <a href=""%s"">log in</a> or <a href=""%s"">register</a>"
 "Pending Reviews","Pending Reviews"
 "Pending Reviews of Customer `%s`","Pending Reviews of Customer `%s`"
@@ -68,8 +68,8 @@
 "Review Details","Review Details"
 "Review Form Fields Before","Review Form Fields Before"
 "Review by <span>%s</span>","Review by <span>%s</span>"
-"Review can\'t be empty","Review can\'t be empty"
-"Review summary can\'t be empty","Review summary can\'t be empty"
+"Review can't be empty","Review can't be empty"
+"Review summary can't be empty","Review summary can't be empty"
 "Reviews and Ratings","Reviews and Ratings"
 "SKU","SKU"
 "Save Review","Save Review"
diff --git a/app/code/Magento/Review/i18n/es_ES.csv b/app/code/Magento/Review/i18n/es_ES.csv
index b71b0aec1ea..bbd0019f5c9 100644
--- a/app/code/Magento/Review/i18n/es_ES.csv
+++ b/app/code/Magento/Review/i18n/es_ES.csv
@@ -6,7 +6,7 @@
 "3 stars","3 estrellas"
 "4 stars","4 estrellas"
 "5 stars","5 estrellas"
-"<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
+"<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
 "Add New Review","Añadir Nueva Revisión"
 "Add Your Review","Añadir Tu Revisión"
 "Administrator","Administrador"
@@ -44,7 +44,7 @@
 "Name in Store","Nombre en la Tienda"
 "New Review","Nueva Revisión"
 "Nickname","Apodo"
-"Nickname can\'t be empty","El apodo no puede estar vacío"
+"Nickname can't be empty","El apodo no puede estar vacío"
 "Only registered users can write reviews. Please, <a href=""%s"">log in</a> or <a href=""%s"">register</a>","Sólo usuarios registrados pueden escribir sus opiniones. <a href=""%s"">Conéctese</a> o <a href=""%s"">regístrese</a>"
 "Pending Reviews","Revisiones Pendientes"
 "Pending Reviews of Customer `%s`","Revisiones Pendientes del Cliente `%s`"
@@ -67,8 +67,8 @@
 "Review Details","Detalles de Revisión"
 "Review Form Fields Before","Revisar campos del formulario antes"
 "Review by <span>%s</span>","Revisión por <span>%s</span>"
-"Review can\'t be empty","La opinión no puede estar vacía"
-"Review summary can\'t be empty","El resumen de la opinión no puede estar vacío"
+"Review can't be empty","La opinión no puede estar vacía"
+"Review summary can't be empty","El resumen de la opinión no puede estar vacío"
 "Reviews and Ratings","Revisiones y Valoraciones"
 "SKU","Número de referencia"
 "Save Review","Guardar Revisión"
diff --git a/app/code/Magento/Review/i18n/fr_FR.csv b/app/code/Magento/Review/i18n/fr_FR.csv
index dfe52dff1fa..be523f8a103 100644
--- a/app/code/Magento/Review/i18n/fr_FR.csv
+++ b/app/code/Magento/Review/i18n/fr_FR.csv
@@ -6,7 +6,7 @@
 "3 stars","3 étoiles"
 "4 stars","4 étoiles"
 "5 stars","5 étoiles"
-"<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
+"<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
 "Add New Review","Ajouter un nouvel avis"
 "Add Your Review","Ajouter votre avis"
 "Administrator","Administrateur"
@@ -44,7 +44,7 @@
 "Name in Store","Nom dans la boutique"
 "New Review","Nouvel avis"
 "Nickname","Surnom"
-"Nickname can\'t be empty","Le pseudo doit être spécifié"
+"Nickname can't be empty","Le pseudo doit être spécifié"
 "Only registered users can write reviews. Please, <a href=""%s"">log in</a> or <a href=""%s"">register</a>","Seuls les utilisateurs qui se sont identifiés peuvent faire partager leurs remarques. Veillez vous <a href=""%s"">identifier </a> ou <a href=""%s"">vous enregistrer</a>"
 "Pending Reviews","Avis en attente"
 "Pending Reviews of Customer `%s`","Avis en attente du client `%s`"
@@ -67,8 +67,8 @@
 "Review Details","Détails de l'avis"
 "Review Form Fields Before","Vérifiez les champs du formulaire avant"
 "Review by <span>%s</span>","Avis de <span>%s</span>"
-"Review can\'t be empty","Le champ Visualiser doit être rempli"
-"Review summary can\'t be empty","Le champ Visualiser le récapitulatif doit être rempli"
+"Review can't be empty","Le champ Visualiser doit être rempli"
+"Review summary can't be empty","Le champ Visualiser le récapitulatif doit être rempli"
 "Reviews and Ratings","Avis et évaluations"
 "SKU","UGS"
 "Save Review","Enregistrer l'avis"
diff --git a/app/code/Magento/Review/i18n/nl_NL.csv b/app/code/Magento/Review/i18n/nl_NL.csv
index a938593e17f..9da9f411908 100644
--- a/app/code/Magento/Review/i18n/nl_NL.csv
+++ b/app/code/Magento/Review/i18n/nl_NL.csv
@@ -6,7 +6,7 @@
 "3 stars","3 sterren"
 "4 stars","4 sterren"
 "5 stars","5 sterren"
-"<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
+"<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
 "Add New Review","Voeg Nieuwe Beoordeling toe"
 "Add Your Review","Voeg Uw Beoordeling toe"
 "Administrator","Administrator"
@@ -44,7 +44,7 @@
 "Name in Store","Naam in Winkel"
 "New Review","Nieuwe Review"
 "Nickname","Bijnaam"
-"Nickname can\'t be empty","Nickname kan niet leeg zijn"
+"Nickname can't be empty","Nickname kan niet leeg zijn"
 "Only registered users can write reviews. Please, <a href=""%s"">log in</a> or <a href=""%s"">register</a>","Alleen geregistreerde gebruikers kunnen beoordelingen schrijven. <a href=""%s"">Log in</a> of <a href=""%s"">registreer</a>"
 "Pending Reviews","In afwachting van beoordelingen"
 "Pending Reviews of Customer `%s`","Nog gaande zijnde Reviews van Klant `%s`"
@@ -67,8 +67,8 @@
 "Review Details","Details recensie"
 "Review Form Fields Before","Beoordeel formuliervelden voor"
 "Review by <span>%s</span>","Recensie door <span>%s</span>"
-"Review can\'t be empty","Beoordeling kan niet leeg zijn"
-"Review summary can\'t be empty","Overzicht kan niet leeg zijn"
+"Review can't be empty","Beoordeling kan niet leeg zijn"
+"Review summary can't be empty","Overzicht kan niet leeg zijn"
 "Reviews and Ratings","Beoordelingen en waarderingen"
 "SKU","SKU"
 "Save Review","Recensie opslaan"
diff --git a/app/code/Magento/Review/i18n/pt_BR.csv b/app/code/Magento/Review/i18n/pt_BR.csv
index f96a6be95c6..ea1bf5212ac 100644
--- a/app/code/Magento/Review/i18n/pt_BR.csv
+++ b/app/code/Magento/Review/i18n/pt_BR.csv
@@ -6,7 +6,7 @@
 "3 stars","3 estrelas"
 "4 stars","4 estrelas"
 "5 stars","5 estrelas"
-"<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""esta.meta=\'branco\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
+"<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""esta.meta='branco'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
 "Add New Review","Adicionar novo comentário"
 "Add Your Review","Adicionar seu comentário"
 "Administrator","Administrador"
@@ -44,7 +44,7 @@
 "Name in Store","Noma na loja"
 "New Review","Nova Resenha"
 "Nickname","Alcunha (Nickname)"
-"Nickname can\'t be empty","O apelido não pode estar vazio"
+"Nickname can't be empty","O apelido não pode estar vazio"
 "Only registered users can write reviews. Please, <a href=""%s"">log in</a> or <a href=""%s"">register</a>","Apenas usuários cadastrados podem escrever avaliações. Por favor, <a href=""%s"">conecte-se</a> ou <a href=""%s"">cadastre-se</a>"
 "Pending Reviews","Comentários Pendentes"
 "Pending Reviews of Customer `%s`","Aguardando revisão do cliente '%s'"
@@ -67,8 +67,8 @@
 "Review Details","Detalhes de análise"
 "Review Form Fields Before","Analisar antes os campos do formulário"
 "Review by <span>%s</span>","Analisado por <span>%s</span>"
-"Review can\'t be empty","Revisão não pode estar vazia"
-"Review summary can\'t be empty","Resumo da revisão não pode estar vazio"
+"Review can't be empty","Revisão não pode estar vazia"
+"Review summary can't be empty","Resumo da revisão não pode estar vazio"
 "Reviews and Ratings","Resenhas e Avaliações"
 "SKU","Unidade de Manutenção de Estoque"
 "Save Review","Salvar análise"
diff --git a/app/code/Magento/Review/i18n/zh_CN.csv b/app/code/Magento/Review/i18n/zh_CN.csv
index a6540ceb979..57907575727 100644
--- a/app/code/Magento/Review/i18n/zh_CN.csv
+++ b/app/code/Magento/Review/i18n/zh_CN.csv
@@ -6,7 +6,7 @@
 "3 stars","3 星"
 "4 stars","4 星"
 "5 stars","5 星"
-"<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""this.target=\'blank\'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
+"<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>","<a href=""%1$s"" onclick=""this.target='blank'"">%2$s %3$s</a> <a href=""mailto:%4$s"">(%4$s)</a>"
 "Add New Review","添加新评测"
 "Add Your Review","添加您的评测"
 "Administrator","管理员"
@@ -44,7 +44,7 @@
 "Name in Store","商店名称"
 "New Review","新评测"
 "Nickname","昵称"
-"Nickname can\'t be empty","昵称不能为空"
+"Nickname can't be empty","昵称不能为空"
 "Only registered users can write reviews. Please, <a href=""%s"">log in</a> or <a href=""%s"">register</a>","仅注册用户可撰写评论。请<a href=""%s"">登录</a>或<a href=""%s"">注册</a>"
 "Pending Reviews","挂起的评测"
 "Pending Reviews of Customer `%s`","来自客户“%s”未决的评论"
@@ -67,8 +67,8 @@
 "Review Details","评测详情"
 "Review Form Fields Before","评测表单字段之前"
 "Review by <span>%s</span>","评测者 <span>%s</span>"
-"Review can\'t be empty","评论不能为空"
-"Review summary can\'t be empty","评论摘要不能为空"
+"Review can't be empty","评论不能为空"
+"Review summary can't be empty","评论摘要不能为空"
 "Reviews and Ratings","评测与评级"
 "SKU","SKU"
 "Save Review","保存评测"
diff --git a/app/code/Magento/Rss/Block/Order/Status.php b/app/code/Magento/Rss/Block/Order/Status.php
index 7dc44361281..20b0a880d40 100644
--- a/app/code/Magento/Rss/Block/Order/Status.php
+++ b/app/code/Magento/Rss/Block/Order/Status.php
@@ -34,7 +34,7 @@ class Status extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -50,14 +50,14 @@ class Status extends \Magento\View\Element\Template
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Rss\Model\RssFactory $rssFactory
      * @param \Magento\Rss\Model\Resource\OrderFactory $orderFactory
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Rss\Model\RssFactory $rssFactory,
         \Magento\Rss\Model\Resource\OrderFactory $orderFactory,
         array $data = array()
diff --git a/app/code/Magento/Rss/Block/Wishlist.php b/app/code/Magento/Rss/Block/Wishlist.php
index 5f983466ca0..3ae79b55fe6 100644
--- a/app/code/Magento/Rss/Block/Wishlist.php
+++ b/app/code/Magento/Rss/Block/Wishlist.php
@@ -77,7 +77,7 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -95,13 +95,13 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock
      * @param \Magento\Catalog\Helper\Output $outputHelper
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Rss/Controller/Order.php b/app/code/Magento/Rss/Controller/Order.php
index 850101a5405..fbe27825a11 100644
--- a/app/code/Magento/Rss/Controller/Order.php
+++ b/app/code/Magento/Rss/Controller/Order.php
@@ -34,17 +34,17 @@ class Order extends \Magento\App\Action\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Rss/Model/System/Config/Backend/Links.php b/app/code/Magento/Rss/Model/System/Config/Backend/Links.php
index 84953cec8dd..014c2f9d8d9 100644
--- a/app/code/Magento/Rss/Model/System/Config/Backend/Links.php
+++ b/app/code/Magento/Rss/Model/System/Config/Backend/Links.php
@@ -38,8 +38,8 @@ class Links extends \Magento\Core\Model\Config\Value
     protected $_cacheTypeList;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\App\Cache\TypeListInterface $cacheTypeList
@@ -48,8 +48,8 @@ class Links extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\App\Cache\TypeListInterface $cacheTypeList,
diff --git a/app/code/Magento/Rss/i18n/de_DE.csv b/app/code/Magento/Rss/i18n/de_DE.csv
index 8dca1fca61f..4093b2e2f80 100644
--- a/app/code/Magento/Rss/i18n/de_DE.csv
+++ b/app/code/Magento/Rss/i18n/de_DE.csv
@@ -2,7 +2,7 @@
 "%s - Special Products","%s - Sonderangebote"
 "%s RSS Feed","%s RSS-Feed"
 "%s has reached a quantity of %s.","%s hat eine Menge von %s erreicht."
-"%s\'s Wishlist","%ss Wunschzettel"
+"%s's Wishlist","%ss Wunschzettel"
 "Cannot retrieve the wishlist","Kann den Wunschzettel nicht abrufen."
 "Catalog","Katalog"
 "Category Feeds","Feeds aus Kategorien"
diff --git a/app/code/Magento/Rss/i18n/en_US.csv b/app/code/Magento/Rss/i18n/en_US.csv
index ddc6d7767a4..2781d474864 100644
--- a/app/code/Magento/Rss/i18n/en_US.csv
+++ b/app/code/Magento/Rss/i18n/en_US.csv
@@ -2,7 +2,7 @@
 "%s - Special Products","%s - Special Products"
 "%s RSS Feed","%s RSS Feed"
 "%s has reached a quantity of %s.","%s has reached a quantity of %s."
-"%s\'s Wishlist","%s\'s Wishlist"
+"%s's Wishlist","%s's Wishlist"
 "Cannot retrieve the wishlist","Cannot retrieve the wishlist"
 "Catalog","Catalog"
 "Category Feeds","Category Feeds"
diff --git a/app/code/Magento/Rss/i18n/es_ES.csv b/app/code/Magento/Rss/i18n/es_ES.csv
index 8a1b656e386..4bfdde6c4e3 100644
--- a/app/code/Magento/Rss/i18n/es_ES.csv
+++ b/app/code/Magento/Rss/i18n/es_ES.csv
@@ -2,7 +2,7 @@
 "%s - Special Products","%s - Productos especiales"
 "%s RSS Feed","Fuente RSS de %s"
 "%s has reached a quantity of %s.","%s ha alcanzado una cantidad de %s"
-"%s\'s Wishlist","%s's Lista"
+"%s's Wishlist","%s's Lista"
 "Cannot retrieve the wishlist","No se puede recuperar la lista de regalos"
 "Catalog","Catálogo"
 "Category Feeds","Fuentes por categoría"
diff --git a/app/code/Magento/Rss/i18n/fr_FR.csv b/app/code/Magento/Rss/i18n/fr_FR.csv
index 8e0dc13a01f..fc34750285f 100644
--- a/app/code/Magento/Rss/i18n/fr_FR.csv
+++ b/app/code/Magento/Rss/i18n/fr_FR.csv
@@ -2,7 +2,7 @@
 "%s - Special Products","%s - Produits spéciaux"
 "%s RSS Feed","%s Flux RSS"
 "%s has reached a quantity of %s.","%s a atteint une quantité de %s."
-"%s\'s Wishlist","Liste de cadeaux de %s"
+"%s's Wishlist","Liste de cadeaux de %s"
 "Cannot retrieve the wishlist","Impossible de récupérer la liste de cadeaux"
 "Catalog","Catalogue"
 "Category Feeds","Flux de catégorie"
diff --git a/app/code/Magento/Rss/i18n/nl_NL.csv b/app/code/Magento/Rss/i18n/nl_NL.csv
index 2415a1d9846..9d26ecaaf9d 100644
--- a/app/code/Magento/Rss/i18n/nl_NL.csv
+++ b/app/code/Magento/Rss/i18n/nl_NL.csv
@@ -2,7 +2,7 @@
 "%s - Special Products","%s - Speciale Producten"
 "%s RSS Feed","%s RSS Feed"
 "%s has reached a quantity of %s.","%s heeft een kwantiteit van %s bereikt."
-"%s\'s Wishlist","%s\'s Wensenlijst"
+"%s's Wishlist","%s's Wensenlijst"
 "Cannot retrieve the wishlist","Kan de wensenlijst niet ontvangen"
 "Catalog","Catalogus"
 "Category Feeds","Categorie feeds"
diff --git a/app/code/Magento/Rss/i18n/pt_BR.csv b/app/code/Magento/Rss/i18n/pt_BR.csv
index e8b53bbe839..2c0b5c7b49b 100644
--- a/app/code/Magento/Rss/i18n/pt_BR.csv
+++ b/app/code/Magento/Rss/i18n/pt_BR.csv
@@ -2,7 +2,7 @@
 "%s - Special Products","%s - Produtos especiais"
 "%s RSS Feed","%s RSS Feed"
 "%s has reached a quantity of %s.","%s atingiu a quantia de %s."
-"%s\'s Wishlist","Lista de presente de %s\"
+"%s's Wishlist","Lista de presente de %s\"
 "Cannot retrieve the wishlist","Não é possível recuperar a lista de presente"
 "Catalog","Catálogo"
 "Category Feeds","Feeds da categoria"
diff --git a/app/code/Magento/Rss/i18n/zh_CN.csv b/app/code/Magento/Rss/i18n/zh_CN.csv
index bb08f2c0cff..d95ecdb96ba 100644
--- a/app/code/Magento/Rss/i18n/zh_CN.csv
+++ b/app/code/Magento/Rss/i18n/zh_CN.csv
@@ -2,7 +2,7 @@
 "%s - Special Products","%s - 特价产品"
 "%s RSS Feed","%s RSS源"
 "%s has reached a quantity of %s.","%s 已经达到了一些 %s"
-"%s\'s Wishlist","%s 的愿望清单"
+"%s's Wishlist","%s 的愿望清单"
 "Cannot retrieve the wishlist","无法获取愿望清单"
 "Catalog","分类"
 "Category Feeds","分类源"
diff --git a/app/code/Magento/Rule/Model/AbstractModel.php b/app/code/Magento/Rule/Model/AbstractModel.php
index a90309cd88a..13a27aed067 100644
--- a/app/code/Magento/Rule/Model/AbstractModel.php
+++ b/app/code/Magento/Rule/Model/AbstractModel.php
@@ -93,8 +93,8 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel
     protected $_locale;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -102,8 +102,8 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Rule/Model/Rule.php b/app/code/Magento/Rule/Model/Rule.php
index eda4c0ae201..5188c6a3045 100644
--- a/app/code/Magento/Rule/Model/Rule.php
+++ b/app/code/Magento/Rule/Model/Rule.php
@@ -48,8 +48,8 @@ class Rule extends AbstractModel
     protected $_actions;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\Rule\Model\Condition\CombineFactory $conditionsFactory
@@ -59,8 +59,8 @@ class Rule extends AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\Rule\Model\Condition\CombineFactory $conditionsFactory,
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php b/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php
index e1943ac01c4..4d735dc3b7e 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php
@@ -56,7 +56,7 @@ class AbstractItems extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -68,13 +68,13 @@ class AbstractItems extends \Magento\Backend\Block\Template
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Catalog\Model\ProductFactory $productFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_productFactory = $productFactory;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php b/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php
index 6e6bcfd77f8..d07306e70e0 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php
@@ -38,7 +38,7 @@ class AbstractOrder extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -49,13 +49,13 @@ class AbstractOrder extends \Magento\Backend\Block\Widget
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Helper\Admin $adminHelper
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Sales\Helper\Admin $adminHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Address.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Address.php
index 8ec4eca51b2..22f90f71adf 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Address.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Address.php
@@ -34,18 +34,18 @@ class Address extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php
index 348a185fc5a..b9219a9ab6d 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php
@@ -35,7 +35,7 @@ class Form
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -50,7 +50,7 @@ class Form
      * @param \Magento\Customer\Helper\Data $customerHelper
      * @param \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService
      * @param \Magento\Customer\Helper\Address $addressHelper
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
@@ -65,7 +65,7 @@ class Form
         \Magento\Customer\Helper\Data $customerHelper,
         \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService,
         \Magento\Customer\Helper\Address $addressHelper,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form.php
index 5b9b5708f4b..ff8ca293bcc 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form.php
@@ -128,7 +128,7 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate
                 $addressForm = $this->_customerFormFactory->create(
                     'customer_address',
                     'adminhtml_customer_address',
-                    $addressDto->__toArray()
+                    $addressDto->getAttributes()
                 );
                 $data['addresses'][$addressDto->getId()] = $addressForm
                     ->outputData(\Magento\Eav\Model\AttributeDataFactory::OUTPUT_FORMAT_JSON);
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php
index 363f0cf1963..4b318687500 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php
@@ -155,7 +155,7 @@ class Account extends \Magento\Sales\Block\Adminhtml\Order\Create\Form\AbstractF
         } catch (\Exception $e) {
             /** If customer does not exist do nothing. */
         }
-        $data = isset($customer) ? $customer->__toArray() : array();
+        $data = isset($customer) ? $customer->getAttributes() : array();
         foreach ($this->getQuote()->getData() as $key => $value) {
             if (strpos($key, 'customer_') === 0) {
                 $data[substr($key, 9)] = $value;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php
index 84b9b7eb8a9..a4329f46693 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php
@@ -143,7 +143,7 @@ class Address extends \Magento\Sales\Block\Adminhtml\Order\Create\Form\AbstractF
             $addressForm = $this->_customerFormFactory->create(
                 'customer_address',
                 'adminhtml_customer_address',
-                $addressDto->__toArray()
+                $addressDto->getAttributes()
             );
             $data[$addressDto->getId()] = $addressForm->outputData(
                 \Magento\Eav\Model\AttributeDataFactory::OUTPUT_FORMAT_JSON
@@ -277,7 +277,7 @@ class Address extends \Magento\Sales\Block\Adminhtml\Order\Create\Form\AbstractF
         $formatTypeRenderer = $this->_addressHelper->getFormatTypeRenderer('oneline');
         $result = '';
         if ($formatTypeRenderer) {
-            $result = $formatTypeRenderer->renderArray($addressData->__toArray());
+            $result = $formatTypeRenderer->renderArray($addressData->getAttributes());
         }
         return $this->escapeHtml($result);
     }
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php
index 532c9e0f1b8..2478edddc0d 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php
@@ -65,7 +65,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Backend\Model\Session\Quote $sessionQuote
      * @param \Magento\GiftMessage\Helper\Message $messageHelper
@@ -73,7 +73,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Backend\Model\Session\Quote $sessionQuote,
         \Magento\GiftMessage\Helper\Message $messageHelper,
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create.php
index 6c9521e328f..69b8a41299b 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create.php
@@ -35,18 +35,18 @@ class Create extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Items.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Items.php
index ae8f325e6c3..1f5cc8b2461 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Items.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Items.php
@@ -43,14 +43,14 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Helper\Data $salesData
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Catalog\Model\ProductFactory $productFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Sales\Helper\Data $salesData,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php
index 6d64c7d2556..3e9d3ea60be 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php
@@ -38,18 +38,18 @@ class View extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View/Comments.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View/Comments.php
index c837f3f8222..48cdf667a57 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View/Comments.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View/Comments.php
@@ -39,18 +39,18 @@ class Comments extends \Magento\Backend\Block\Text\ListText
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create.php
index b6184432389..6eb25fd8bbf 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create.php
@@ -35,18 +35,18 @@ class Create extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Items.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Items.php
index a6d83c08c8a..3948ef7be0c 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Items.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Items.php
@@ -43,14 +43,14 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Helper\Data $salesData
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Catalog\Model\ProductFactory $productFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Sales\Helper\Data $salesData,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php
index e05e2bdf711..8c1667cbf1e 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php
@@ -45,7 +45,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -57,13 +57,13 @@ class View extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Model\Auth\Session $backendSession
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Model\Auth\Session $backendSession,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_backendSession = $backendSession;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View/Comments.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View/Comments.php
index fcb86272ca1..85917f0b174 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View/Comments.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View/Comments.php
@@ -39,18 +39,18 @@ class Comments extends \Magento\Backend\Block\Text\ListText
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php
index c5a0305cf2f..36a6e3fa8e9 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php
@@ -43,7 +43,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Sales\Model\Order\Config $orderConfig
      * @param \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $collectionFactory
@@ -51,7 +51,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Sales\Model\Order\Config $orderConfig,
         \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $collectionFactory,
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php
index 5c01a6f55c9..a6375beaf5c 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php
@@ -43,7 +43,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -59,14 +59,14 @@ class View extends \Magento\Backend\Block\Widget\Form\Container
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Model\Config $salesConfig
      * @param \Magento\Sales\Helper\Reorder $reorderHelper
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Sales\Model\Config $salesConfig,
         \Magento\Sales\Helper\Reorder $reorderHelper,
         array $data = array()
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Giftmessage.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Giftmessage.php
index 1473547241a..1ec1e638d93 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Giftmessage.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Giftmessage.php
@@ -45,7 +45,7 @@ class Giftmessage extends \Magento\Backend\Block\Widget
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -62,14 +62,14 @@ class Giftmessage extends \Magento\Backend\Block\Widget
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\GiftMessage\Model\MessageFactory $messageFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\GiftMessage\Helper\Message $messageHelper
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\GiftMessage\Model\MessageFactory $messageFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\GiftMessage\Helper\Message $messageHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php
index 34b0064aed6..8f0d2fc7a79 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php
@@ -38,10 +38,10 @@ class History extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
-    
+
     /**
      * Sales data
      *
@@ -52,13 +52,13 @@ class History extends \Magento\Backend\Block\Template
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Sales\Helper\Data $salesData
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Sales\Helper\Data $salesData,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php
index e62c28153fd..aeff22b584e 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php
@@ -50,7 +50,7 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Helper\Admin $adminHelper
      * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService
      * @param CustomerMetadataServiceInterface $customerMetadataService
@@ -59,7 +59,7 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Sales\Helper\Admin $adminHelper,
         \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService,
         CustomerMetadataServiceInterface $customerMetadataService,
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php
index 0e60429430f..3da5ac481ac 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php
@@ -48,7 +48,7 @@ class DefaultRenderer extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\GiftMessage\Helper\Message $messageHelper
      * @param \Magento\Checkout\Helper\Data $checkoutHelper
      * @param array $data
@@ -56,7 +56,7 @@ class DefaultRenderer extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Catalog\Model\ProductFactory $productFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\GiftMessage\Helper\Message $messageHelper,
         \Magento\Checkout\Helper\Data $checkoutHelper,
         array $data = array()
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Messages.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Messages.php
index 4f10e2c27ca..166cbce76ea 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Messages.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Messages.php
@@ -38,7 +38,7 @@ class Messages extends \Magento\View\Element\Messages
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $coreRegistry = null;
 
@@ -47,7 +47,7 @@ class Messages extends \Magento\View\Element\Messages
      * @param \Magento\Message\Factory $messageFactory
      * @param \Magento\Message\CollectionFactory $collectionFactory
      * @param \Magento\Message\ManagerInterface $messageManager
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
@@ -55,7 +55,7 @@ class Messages extends \Magento\View\Element\Messages
         \Magento\Message\Factory $messageFactory,
         \Magento\Message\CollectionFactory $collectionFactory,
         \Magento\Message\ManagerInterface $messageManager,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Creditmemos.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Creditmemos.php
index 6cfa1ee36a4..b65d04d36fb 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Creditmemos.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Creditmemos.php
@@ -40,7 +40,7 @@ class Creditmemos
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -59,7 +59,7 @@ class Creditmemos
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory
      * @param \Magento\Sales\Model\Order\Creditmemo $orderCreditmemo
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -67,7 +67,7 @@ class Creditmemos
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory,
         \Magento\Sales\Model\Order\Creditmemo $orderCreditmemo,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php
index 45532f4183b..50237f6a034 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php
@@ -43,18 +43,18 @@ class History
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Invoices.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Invoices.php
index 41743203a09..4dc528c1c96 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Invoices.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Invoices.php
@@ -40,7 +40,7 @@ class Invoices
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -59,7 +59,7 @@ class Invoices
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory
      * @param \Magento\Sales\Model\Order\Invoice $orderInvoice
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -67,7 +67,7 @@ class Invoices
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory,
         \Magento\Sales\Model\Order\Invoice $orderInvoice,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Shipments.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Shipments.php
index ca7726e567b..6c7e3e2a1d5 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Shipments.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Shipments.php
@@ -36,7 +36,7 @@ class Shipments
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -49,14 +49,14 @@ class Shipments
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tabs.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tabs.php
index 5ac91da0aac..3fb32362d95 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tabs.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tabs.php
@@ -34,7 +34,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -42,14 +42,14 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Backend\Model\Auth\Session $authSession
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Backend\Model\Auth\Session $authSession,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form.php
index e914de1a70d..11bf6bb5670 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form.php
@@ -42,14 +42,14 @@ class Form extends \Magento\Reports\Block\Adminhtml\Filter\Form
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Sales\Model\Order\ConfigFactory $orderConfig
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Sales\Model\Order\ConfigFactory $orderConfig,
         array $data = array()
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php b/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php
index b97322bc485..24aaaecae29 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php
@@ -49,7 +49,7 @@ class Coupon extends \Magento\Sales\Block\Adminhtml\Report\Filter\Form
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Sales\Model\Order\ConfigFactory $orderConfig
      * @param \Magento\SalesRule\Model\Resource\Report\RuleFactory $reportRule
@@ -57,7 +57,7 @@ class Coupon extends \Magento\Sales\Block\Adminhtml\Report\Filter\Form
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Sales\Model\Order\ConfigFactory $orderConfig,
         \Magento\SalesRule\Model\Resource\Report\RuleFactory $reportRule,
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Totals.php b/app/code/Magento/Sales/Block/Adminhtml/Totals.php
index 6b76b15b05f..32b2bf5adba 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Totals.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Totals.php
@@ -35,13 +35,13 @@ class Totals extends \Magento\Sales\Block\Order\Totals
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Helper\Admin $adminHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Sales\Helper\Admin $adminHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php
index c7417b26996..ac8669142fb 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php
@@ -45,18 +45,18 @@ class Detail extends \Magento\Backend\Block\Widget\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail/Grid.php
index 11c7f3a29b1..2f99f3693d9 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail/Grid.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail/Grid.php
@@ -38,7 +38,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -51,14 +51,14 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Data\CollectionFactory $collectionFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Data\CollectionFactory $collectionFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_collectionFactory = $collectionFactory;
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Grid.php
index de7195575f2..05dc58f2fcb 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Grid.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Grid.php
@@ -38,10 +38,10 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
-    
+
     /**
      * Payment data
      *
@@ -65,7 +65,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Sales\Model\Order\Payment\Transaction $transaction
      * @param \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $collectionFactory
      * @param \Magento\Payment\Helper\Data $paymentData
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -74,7 +74,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
         \Magento\Sales\Model\Order\Payment\Transaction $transaction,
         \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $collectionFactory,
         \Magento\Payment\Helper\Data $paymentData,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Sales/Block/Order/Creditmemo.php b/app/code/Magento/Sales/Block/Order/Creditmemo.php
index 5051f6b8e15..4703ebd9d39 100644
--- a/app/code/Magento/Sales/Block/Order/Creditmemo.php
+++ b/app/code/Magento/Sales/Block/Order/Creditmemo.php
@@ -52,14 +52,14 @@ class Creditmemo extends \Magento\Sales\Block\Order\Creditmemo\Items
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Payment\Helper\Data $paymentHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Payment\Helper\Data $paymentHelper,
         array $data = array()
diff --git a/app/code/Magento/Sales/Block/Order/Creditmemo/Items.php b/app/code/Magento/Sales/Block/Order/Creditmemo/Items.php
index f4f797daf3b..d4e5ecc440d 100644
--- a/app/code/Magento/Sales/Block/Order/Creditmemo/Items.php
+++ b/app/code/Magento/Sales/Block/Order/Creditmemo/Items.php
@@ -34,18 +34,18 @@ class Items extends \Magento\Sales\Block\Items\AbstractItems
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Order/Creditmemo/Totals.php b/app/code/Magento/Sales/Block/Order/Creditmemo/Totals.php
index 9609d7a6789..5a3b2f8bce1 100644
--- a/app/code/Magento/Sales/Block/Order/Creditmemo/Totals.php
+++ b/app/code/Magento/Sales/Block/Order/Creditmemo/Totals.php
@@ -29,12 +29,12 @@ class Totals extends \Magento\Sales\Block\Order\Totals
 {
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         parent::__construct($context, $registry, $data);
diff --git a/app/code/Magento/Sales/Block/Order/Info.php b/app/code/Magento/Sales/Block/Order/Info.php
index 861b945ad41..bf3420dc387 100644
--- a/app/code/Magento/Sales/Block/Order/Info.php
+++ b/app/code/Magento/Sales/Block/Order/Info.php
@@ -41,7 +41,7 @@ class Info extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -52,13 +52,13 @@ class Info extends \Magento\View\Element\Template
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Payment\Helper\Data $paymentHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Payment\Helper\Data $paymentHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Sales/Block/Order/Info/Buttons.php b/app/code/Magento/Sales/Block/Order/Info/Buttons.php
index e78513db515..8a6fe8a5b32 100644
--- a/app/code/Magento/Sales/Block/Order/Info/Buttons.php
+++ b/app/code/Magento/Sales/Block/Order/Info/Buttons.php
@@ -40,7 +40,7 @@ class Buttons extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -51,13 +51,13 @@ class Buttons extends \Magento\View\Element\Template
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Customer\Model\Session $customerSession
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Customer\Model\Session $customerSession,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Sales/Block/Order/Invoice.php b/app/code/Magento/Sales/Block/Order/Invoice.php
index 4b84a76d58a..99ff50e07a3 100644
--- a/app/code/Magento/Sales/Block/Order/Invoice.php
+++ b/app/code/Magento/Sales/Block/Order/Invoice.php
@@ -48,14 +48,14 @@ class Invoice extends \Magento\Sales\Block\Order\Invoice\Items
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Payment\Helper\Data $paymentHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Payment\Helper\Data $paymentHelper,
         array $data = array()
diff --git a/app/code/Magento/Sales/Block/Order/Invoice/Items.php b/app/code/Magento/Sales/Block/Order/Invoice/Items.php
index c8162106013..0727dd879b5 100644
--- a/app/code/Magento/Sales/Block/Order/Invoice/Items.php
+++ b/app/code/Magento/Sales/Block/Order/Invoice/Items.php
@@ -38,18 +38,18 @@ class Items extends \Magento\Sales\Block\Items\AbstractItems
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Order/Invoice/Totals.php b/app/code/Magento/Sales/Block/Order/Invoice/Totals.php
index b762ef093fc..d3c14c9bb36 100644
--- a/app/code/Magento/Sales/Block/Order/Invoice/Totals.php
+++ b/app/code/Magento/Sales/Block/Order/Invoice/Totals.php
@@ -29,12 +29,12 @@ class Totals extends \Magento\Sales\Block\Order\Totals
 {
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         parent::__construct($context, $registry, $data);
diff --git a/app/code/Magento/Sales/Block/Order/Items.php b/app/code/Magento/Sales/Block/Order/Items.php
index 52d88c8ccae..a2ab2b82663 100644
--- a/app/code/Magento/Sales/Block/Order/Items.php
+++ b/app/code/Magento/Sales/Block/Order/Items.php
@@ -38,18 +38,18 @@ class Items extends \Magento\Sales\Block\Items\AbstractItems
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Order/Link.php b/app/code/Magento/Sales/Block/Order/Link.php
index 40f448150af..996313df489 100644
--- a/app/code/Magento/Sales/Block/Order/Link.php
+++ b/app/code/Magento/Sales/Block/Order/Link.php
@@ -29,19 +29,19 @@ namespace Magento\Sales\Block\Order;
  */
 class Link extends \Magento\View\Element\Html\Link\Current
 {
-    /** @var \Magento\Core\Model\Registry  */
+    /** @var \Magento\Registry  */
     protected $_registry;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\App\DefaultPathInterface $defaultPath
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\App\DefaultPathInterface $defaultPath,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         parent::__construct($context, $defaultPath, $data);
diff --git a/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php b/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php
index 2a9ca1e450e..fa172cd92f2 100644
--- a/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php
+++ b/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php
@@ -34,7 +34,7 @@ class Creditmemo extends \Magento\Sales\Block\Items\AbstractItems
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -45,13 +45,13 @@ class Creditmemo extends \Magento\Sales\Block\Items\AbstractItems
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Payment\Helper\Data $paymentHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Payment\Helper\Data $paymentHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php b/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php
index 5cad3b904aa..b505b74995f 100644
--- a/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php
+++ b/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php
@@ -34,7 +34,7 @@ class Invoice extends \Magento\Sales\Block\Items\AbstractItems
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -45,13 +45,13 @@ class Invoice extends \Magento\Sales\Block\Items\AbstractItems
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Payment\Helper\Data $paymentHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Payment\Helper\Data $paymentHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php b/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php
index 9c3e227841d..fff9896d019 100644
--- a/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php
+++ b/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php
@@ -48,7 +48,7 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -59,13 +59,13 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Payment\Helper\Data $paymentHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Payment\Helper\Data $paymentHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Sales/Block/Order/PrintShipment.php b/app/code/Magento/Sales/Block/Order/PrintShipment.php
index 461f19eaf38..e6d071efe3d 100644
--- a/app/code/Magento/Sales/Block/Order/PrintShipment.php
+++ b/app/code/Magento/Sales/Block/Order/PrintShipment.php
@@ -38,7 +38,7 @@ class PrintShipment extends \Magento\Sales\Block\Items\AbstractItems
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -49,13 +49,13 @@ class PrintShipment extends \Magento\Sales\Block\Items\AbstractItems
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Payment\Helper\Data $paymentHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Payment\Helper\Data $paymentHelper,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Sales/Block/Order/Totals.php b/app/code/Magento/Sales/Block/Order/Totals.php
index b9ff01e0c34..6ea76ba996d 100644
--- a/app/code/Magento/Sales/Block/Order/Totals.php
+++ b/app/code/Magento/Sales/Block/Order/Totals.php
@@ -41,18 +41,18 @@ class Totals extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sales/Block/Order/View.php b/app/code/Magento/Sales/Block/Order/View.php
index 764853bf3d0..39db103fdc0 100644
--- a/app/code/Magento/Sales/Block/Order/View.php
+++ b/app/code/Magento/Sales/Block/Order/View.php
@@ -39,7 +39,7 @@ class View extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -55,14 +55,14 @@ class View extends \Magento\View\Element\Template
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Payment\Helper\Data $paymentHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Payment\Helper\Data $paymentHelper,
         array $data = array()
diff --git a/app/code/Magento/Sales/Controller/AbstractController.php b/app/code/Magento/Sales/Controller/AbstractController.php
index bade585075c..951c798a078 100644
--- a/app/code/Magento/Sales/Controller/AbstractController.php
+++ b/app/code/Magento/Sales/Controller/AbstractController.php
@@ -34,17 +34,17 @@ abstract class AbstractController extends \Magento\App\Action\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order.php b/app/code/Magento/Sales/Controller/Adminhtml/Order.php
index a7e82aa7be6..266afe31a68 100644
--- a/app/code/Magento/Sales/Controller/Adminhtml/Order.php
+++ b/app/code/Magento/Sales/Controller/Adminhtml/Order.php
@@ -47,7 +47,7 @@ class Order extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -63,13 +63,13 @@ class Order extends \Magento\Backend\App\Action
 
     /**
      * @param Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\App\Response\Http\FileFactory $fileFactory
      * @param \Magento\Translate\InlineInterface $translateInline
      */
     public function __construct(
         Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\App\Response\Http\FileFactory $fileFactory,
         \Magento\Translate\InlineInterface $translateInline
     ) {
diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php
index 78830b9df1c..736fa2b9e5a 100644
--- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php
+++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php
@@ -170,7 +170,7 @@ class Creditmemo
             'request' => $this->getRequest(),
         ));
 
-        $this->_objectManager->get('Magento\Core\Model\Registry')->register('current_creditmemo', $creditmemo);
+        $this->_objectManager->get('Magento\Registry')->register('current_creditmemo', $creditmemo);
         return $creditmemo;
     }
 
diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php
index 4877d8c711c..cc0661ef92e 100644
--- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php
+++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php
@@ -38,7 +38,7 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -50,12 +50,12 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic
     /**
      * @param \Magento\Backend\App\Action\Context $context
      * @param \Magento\App\Response\Http\FileFactory $fileFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
         \Magento\App\Response\Http\FileFactory $fileFactory,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context, $fileFactory);
diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php
index ff09f54f97d..6783b8f97e8 100644
--- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php
+++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php
@@ -38,17 +38,17 @@ class Status extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php b/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php
index 6b4c60e11e7..aba38bb402f 100644
--- a/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php
+++ b/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php
@@ -38,17 +38,17 @@ class Transactions extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Sales/Controller/Download.php b/app/code/Magento/Sales/Controller/Download.php
index f4d2789fe87..b175f4513cf 100644
--- a/app/code/Magento/Sales/Controller/Download.php
+++ b/app/code/Magento/Sales/Controller/Download.php
@@ -18,169 +18,27 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Sales
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Sales\Controller;
+
+use \Magento\Catalog\Model\Product\Type\AbstractType as AbstractProductType;
 
 /**
  * Sales controller for download purposes
- *
- * @category   Magento
- * @package    Magento_Sales
- * @author     Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Sales\Controller;
-
 class Download extends \Magento\App\Action\Action
 {
     /**
-     * @var \Magento\App\Response\Http\FileFactory
-     */
-    protected $_fileResponseFactory;
-
-    /**
-     * Filesystem instance
-     *
-     * @var \Magento\App\Filesystem
-     */
-    protected $_filesystem;
-    
-    /**
-     * @param \Magento\App\Action\Context $context
-     * @param \Magento\App\Response\Http\FileFactory $fileResponseFactory
-     * @param \Magento\App\Filesystem $filesystem
-     */
-    public function __construct(
-        \Magento\App\Action\Context $context,
-        \Magento\App\Response\Http\FileFactory $fileResponseFactory,
-        \Magento\App\Filesystem $filesystem
-    ) {
-        $this->_fileResponseFactory = $fileResponseFactory;
-        $this->_filesystem = $filesystem;
-        parent::__construct($context);
-    }
-
-    /**
-     * Custom options downloader
-     *
-     * @param mixed $info
-     */
-    protected function _downloadFileAction($info)
-    {
-        $secretKey = $this->getRequest()->getParam('key');
-        try {
-            if ($secretKey != $info['secret_key']) {
-                throw new \Exception();
-            }
-
-            /** @var \Magento\Filesystem\Directory\Read $directory */
-            $directory = $this->_objectManager->get('Magento\App\Filesystem')
-                ->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR);
-
-            $relativePath = $info['order_path'];
-            $filePath = $directory->getAbsolutePath($relativePath);
-            if ((!$directory->isFile($relativePath) || !$directory->isReadable($relativePath))
-                && !$this->_processDatabaseFile($filePath)
-            ) {
-                //try get file from quote
-                $relativePath = $info['quote_path'];
-                $filePath = $directory->getAbsolutePath($relativePath);
-                if ((!$directory->isFile($relativePath) || !$directory->isReadable($relativePath))
-                    && !$this->_processDatabaseFile($filePath)
-                ) {
-                    throw new \Exception();
-                }
-            }
-            $this->_fileResponseFactory->create(
-                $info['title'],
-                array(
-                    'value' => $filePath,
-                    'type'  => 'filename'
-                ),
-                \Magento\App\Filesystem::ROOT_DIR
-            );
-        } catch (\Exception $e) {
-            $this->_forward('noroute');
-        }
-    }
-
-    /**
-     * Check file in database storage if needed and place it on file system
-     *
-     * @param string $filePath
-     * @return bool
+     * @var \Magento\Sales\Model\Download
      */
-    protected function _processDatabaseFile($filePath)
-    {
-        if (!$this->_objectManager->get('Magento\Core\Helper\File\Storage\Database')->checkDbUsage()) {
-            return false;
-        }
-
-        $relativePath = $this->_objectManager->get('Magento\Core\Helper\File\Storage\Database')
-            ->getMediaRelativePath($filePath);
-        $file = $this->_objectManager->create('Magento\Core\Model\File\Storage\Database')
-            ->loadByFilename($relativePath);
-
-        if (!$file->getId()) {
-            return false;
-        }
-
-        /** @var \Magento\Filesystem\Directory\WriteInterface $directory */
-        $directory = $this->_objectManager->get('Magento\App\Filesystem')
-            ->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR);
-        $stream = $directory->openFile($filePath, 'w+');
-        $stream->lock();
-        $stream->write($filePath, $file->getContent());
-        $stream->unlock();
-        $stream->close();
-
-        return true;
-    }
+    protected $_download;
 
-    /**
-     * Profile custom options download action
-     */
-    public function downloadProfileCustomOptionAction()
+    public function __construct(\Magento\App\Action\Context $context, \Magento\Sales\Model\Download $download)
     {
-        $recurringProfile = $this->_objectManager->create('Magento\RecurringProfile\Model\Profile')
-            ->load($this->getRequest()->getParam('id'));
-
-        if (!$recurringProfile->getId()) {
-            $this->_forward('noroute');
-        }
-
-        $orderItemInfo = $recurringProfile->getData('order_item_info');
-        try {
-            $request = unserialize($orderItemInfo['info_buyRequest']);
-
-            if ($request['product'] != $orderItemInfo['product_id']) {
-                $this->_forward('noroute');
-                return;
-            }
-
-            $optionId = $this->getRequest()->getParam('option_id');
-            if (!isset($request['options'][$optionId])) {
-                $this->_forward('noroute');
-                return;
-            }
-            // Check if the product exists
-            $product = $this->_objectManager->create('Magento\Catalog\Model\Product')->load($request['product']);
-            if (!$product || !$product->getId()) {
-                $this->_forward('noroute');
-                return;
-            }
-            // Try to load the option
-            $option = $product->getOptionById($optionId);
-            if (!$option || !$option->getId() || $option->getType() != 'file') {
-                $this->_forward('noroute');
-                return;
-            }
-            $this->_downloadFileAction($request['options'][$this->getRequest()->getParam('option_id')]);
-        } catch (\Exception $e) {
-            $this->_forward('noroute');
-        }
+        $this->_download = $download;
+        parent::__construct($context);
     }
 
     /**
@@ -198,8 +56,8 @@ class Download extends \Magento\App\Action\Action
         }
 
         $optionId = null;
-        if (strpos($option->getCode(), \Magento\Catalog\Model\Product\Type\AbstractType::OPTION_PREFIX) === 0) {
-            $optionId = str_replace(\Magento\Catalog\Model\Product\Type\AbstractType::OPTION_PREFIX, '', $option->getCode());
+        if (strpos($option->getCode(), AbstractProductType::OPTION_PREFIX) === 0) {
+            $optionId = str_replace(AbstractProductType::OPTION_PREFIX, '', $option->getCode());
             if ((int)$optionId != $optionId) {
                 $optionId = null;
             }
@@ -218,7 +76,11 @@ class Download extends \Magento\App\Action\Action
 
         try {
             $info = unserialize($option->getValue());
-            $this->_downloadFileAction($info);
+            if ($this->getRequest()->getParam('key') != $info['secret_key']) {
+                $this->_forward('noroute');
+                return;
+            }
+            $this->_download->downloadFile($info);
         } catch (\Exception $e) {
             $this->_forward('noroute');
         }
diff --git a/app/code/Magento/Sales/Helper/Guest.php b/app/code/Magento/Sales/Helper/Guest.php
index 55df6ad74a3..6bb48e376c7 100644
--- a/app/code/Magento/Sales/Helper/Guest.php
+++ b/app/code/Magento/Sales/Helper/Guest.php
@@ -43,7 +43,7 @@ class Guest extends \Magento\Core\Helper\Data
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -73,7 +73,7 @@ class Guest extends \Magento\Core\Helper\Data
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Core\Model\Locale $locale
      * @param \Magento\App\State $appState
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Stdlib\Cookie $coreCookie
      * @param \Magento\Message\ManagerInterface $messageManager
@@ -87,7 +87,7 @@ class Guest extends \Magento\Core\Helper\Data
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Core\Model\Locale $locale,
         \Magento\App\State $appState,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Stdlib\Cookie $coreCookie,
         \Magento\Message\ManagerInterface $messageManager,
diff --git a/app/code/Magento/Sales/Model/AbstractModel.php b/app/code/Magento/Sales/Model/AbstractModel.php
index f20c2d2ae11..2e27caed334 100644
--- a/app/code/Magento/Sales/Model/AbstractModel.php
+++ b/app/code/Magento/Sales/Model/AbstractModel.php
@@ -43,8 +43,8 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel
     protected $dateTime;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $coreLocale
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -52,8 +52,8 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $coreLocale,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Sales/Model/AdminOrder.php b/app/code/Magento/Sales/Model/AdminOrder.php
deleted file mode 100644
index f434ce6a14a..00000000000
--- a/app/code/Magento/Sales/Model/AdminOrder.php
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category    Magento
- * @package     Magento_Sales
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Order control model
- *
- * @category   Magento
- * @package    Magento_Sales
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Sales\Model;
-
-class AdminOrder
-{
-    /**
-     * @var \Magento\Message\ManagerInterface
-     */
-    protected $messageManager;
-
-    /**
-     * @var \Magento\Customer\Model\CustomerFactory]
-     */
-    protected $_customerFactory;
-
-    /**
-     * @var \Magento\Catalog\Model\ProductFactory
-     */
-    protected $_productFactory;
-
-    /**
-     * @param \Magento\Catalog\Model\ProductFactory $productFactory
-     * @param \Magento\Customer\Model\CustomerFactory $customerFactory
-     * @param \Magento\Message\ManagerInterface $messageManager
-     */
-    public function __construct(
-        \Magento\Catalog\Model\ProductFactory $productFactory,
-        \Magento\Customer\Model\CustomerFactory $customerFactory,
-        \Magento\Message\ManagerInterface $messageManager
-    ) {
-        $this->_productFactory = $productFactory;
-        $this->_customerFactory = $customerFactory;
-        $this->messageManager = $messageManager;
-    }
-
-    public function checkRelation(\Magento\Sales\Model\Order $order)
-    {
-        /**
-         * Check customer existing
-         */
-        $customer = $this->_customerFactory->create()->load($order->getCustomerId());
-        if (!$customer->getId()) {
-            $this->messageManager->addNotice(__(' The customer does not exist in the system anymore.'));
-        }
-
-        /**
-         * Check Item products existing
-         */
-        $productIds = array();
-        foreach ($order->getAllItems() as $item) {
-            $productIds[] = $item->getProductId();
-        }
-
-        $productCollection = $this->_productFactory->create()->getCollection()
-            ->addIdFilter($productIds)
-            ->load();
-
-        $hasBadItems = false;
-        foreach ($order->getAllItems() as $item) {
-            if (!$productCollection->getItemById($item->getProductId())) {
-                $this->messageManager->addError(
-                   __('The item %1 (SKU %2) does not exist in the catalog anymore.', $item->getName(), $item->getSku()
-                ));
-                $hasBadItems = true;
-            }
-        }
-        if ($hasBadItems) {
-            $this->messageManager->addError(
-                __('Some items in this order are no longer in our catalog.')
-            );
-        }
-        return $this;
-    }
-
-}
diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php
index 97246cabba1..8d26da9a9a4 100644
--- a/app/code/Magento/Sales/Model/AdminOrder/Create.php
+++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php
@@ -18,24 +18,29 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Sales
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\Sales\Model\AdminOrder;
+
+use Magento\Customer\Service\V1\CustomerServiceInterface;
+use Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
+use Magento\Customer\Service\V1\CustomerAddressServiceInterface;
+use Magento\Customer\Service\V1\Dto\AddressBuilder as CustomerAddressBuilder;
+use Magento\Customer\Service\V1\Dto\CustomerBuilder;
+use Magento\Customer\Service\V1\CustomerGroupServiceInterface;
+use Magento\Customer\Service\V1\Dto\Customer as CustomerDto;
+use Magento\Customer\Model\Metadata\Form as CustomerForm;
+use Magento\Customer\Service\V1\Dto\Address as CustomerAddressDto;
 
 /**
  * Order create model
- *
- * @category    Magento
- * @package     Magento_Sales
- * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Sales\Model\AdminOrder;
-
 class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartInterface
 {
+    const XML_PATH_DEFAULT_EMAIL_DOMAIN = 'customer/create_account/email_domain';
+
     /**
      * Quote session object
      *
@@ -85,27 +90,6 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
      */
     protected $_isValidate              = false;
 
-    /**
-     * Customer instance
-     *
-     * @var \Magento\Customer\Model\Customer
-     */
-    protected $_customer;
-
-    /**
-     * Customer Address Form instance
-     *
-     * @var \Magento\Customer\Model\Form
-     */
-    protected $_customerAddressForm;
-
-    /**
-     * Customer Form instance
-     *
-     * @var \Magento\Customer\Model\Form
-     */
-    protected $_customerForm;
-
     /**
      * Array of validate errors
      *
@@ -123,7 +107,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -164,40 +148,96 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
      */
     protected $quoteInitializer;
 
+    /**
+     * @var CustomerServiceInterface
+     */
+    protected $_customerService;
+
+    /**
+     * @var CustomerAddressServiceInterface
+     */
+    protected $_customerAddressService;
+
+    /**
+     * @var CustomerAddressBuilder
+     */
+    protected $_customerAddressBuilder;
+
+    /**
+     * @var \Magento\Customer\Model\Metadata\FormFactory
+     */
+    protected $_metadataFormFactory;
+
+    /**
+     * @var CustomerBuilder
+     */
+    protected $_customerBuilder;
+
+    /**
+     * @var \Magento\Customer\Helper\Data
+     */
+    protected $_customerHelper;
+
+    /**
+     * @var CustomerGroupServiceInterface
+     */
+    protected $_customerGroupService;
+
     /**
      * @param \Magento\ObjectManager $objectManager
      * @param \Magento\Event\ManagerInterface $eventManager
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Sales\Model\Config $salesConfig
-     * @param \Magento\Backend\Model\Session\Quote $sessionQuote
+     * @param \Magento\Backend\Model\Session\Quote $quoteSession
      * @param \Magento\Logger $logger
      * @param \Magento\Object\Copy $objectCopyService
      * @param \Magento\Message\ManagerInterface $messageManager
      * @param Product\Quote\Initializer $quoteInitializer
+     * @param CustomerServiceInterface $customerService
+     * @param CustomerAddressServiceInterface $customerAddressService
+     * @param CustomerAddressBuilder $customerAddressBuilder
+     * @param \Magento\Customer\Model\Metadata\FormFactory $metadataFormFactory
+     * @param CustomerBuilder $customerBuilder
+     * @param \Magento\Customer\Helper\Data $customerHelper
+     * @param CustomerGroupServiceInterface $customerGroupService
      * @param array $data
      */
     public function __construct(
         \Magento\ObjectManager $objectManager,
         \Magento\Event\ManagerInterface $eventManager,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Sales\Model\Config $salesConfig,
-        \Magento\Backend\Model\Session\Quote $sessionQuote,
+        \Magento\Backend\Model\Session\Quote $quoteSession,
         \Magento\Logger $logger,
         \Magento\Object\Copy $objectCopyService,
         \Magento\Message\ManagerInterface $messageManager,
         Product\Quote\Initializer $quoteInitializer,
+        CustomerServiceInterface $customerService,
+        CustomerAddressServiceInterface $customerAddressService,
+        CustomerAddressBuilder $customerAddressBuilder,
+        \Magento\Customer\Model\Metadata\FormFactory $metadataFormFactory,
+        CustomerBuilder $customerBuilder,
+        \Magento\Customer\Helper\Data $customerHelper,
+        CustomerGroupServiceInterface $customerGroupService,
         array $data = array()
     ) {
         $this->_objectManager = $objectManager;
         $this->_eventManager = $eventManager;
         $this->_coreRegistry = $coreRegistry;
         $this->_salesConfig = $salesConfig;
+        $this->_session = $quoteSession;
         $this->_logger = $logger;
         $this->_objectCopyService = $objectCopyService;
         $this->quoteInitializer = $quoteInitializer;
-        parent::__construct($data);
-        $this->_session = $sessionQuote;
         $this->messageManager = $messageManager;
+        $this->_customerService = $customerService;
+        $this->_customerAddressService = $customerAddressService;
+        $this->_customerAddressBuilder = $customerAddressBuilder;
+        $this->_metadataFormFactory = $metadataFormFactory;
+        $this->_customerBuilder = $customerBuilder;
+        $this->_customerHelper = $customerHelper;
+        $this->_customerGroupService = $customerGroupService;
+        parent::__construct($data);
     }
 
     /**
@@ -340,7 +380,8 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
      * Initialize creation data from existing order
      *
      * @param \Magento\Sales\Model\Order $order
-     * @return \Magento\Sales\Model\AdminOrder\Create
+     * @return $this
+     * @throws \Magento\Core\Exception
      */
     public function initFromOrder(\Magento\Sales\Model\Order $order)
     {
@@ -432,6 +473,11 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
         return $this;
     }
 
+    /**
+     * Copy billing address from order
+     *
+     * @param \Magento\Sales\Model\Order $order
+     */
     protected function _initBillingAddressFromOrder(\Magento\Sales\Model\Order $order)
     {
         $this->getQuote()->getBillingAddress()->setCustomerAddressId('');
@@ -443,6 +489,11 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
         );
     }
 
+    /**
+     * Copy shipping address from order
+     *
+     * @param \Magento\Sales\Model\Order $order
+     */
     protected function _initShippingAddressFromOrder(\Magento\Sales\Model\Order $order)
     {
         $orderShippingAddress = $order->getShippingAddress();
@@ -510,7 +561,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
      *
      * @params bool $cacheReload pass cached wishlist object and get new one
      * @param bool $cacheReload
-     * @return \Magento\Wishlist\Model\Wishlist
+     * @return \Magento\Wishlist\Model\Wishlist|bool Return false if customer ID is not specified
      */
     public function getCustomerWishlist($cacheReload = false)
     {
@@ -518,10 +569,10 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
             return $this->_wishlist;
         }
 
-        if ($this->getSession()->getCustomer()->getId()) {
-            $this->_wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist')->loadByCustomer(
-                $this->getSession()->getCustomer(), true
-            );
+        $customerId = (int)$this->getSession()->getCustomerId();
+        if ($customerId) {
+            $this->_wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist');
+            $this->_wishlist->loadByCustomer($customerId, true);
             $this->_wishlist->setStore($this->getSession()->getStore())
                 ->setSharedStoreIds($this->getSession()->getStore()->getWebsite()->getStoreIds());
         } else {
@@ -544,11 +595,12 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
 
         $this->_cart = $this->_objectManager->create('Magento\Sales\Model\Quote');
 
-        if ($this->getSession()->getCustomer()->getId()) {
-            $this->_cart->setStore($this->getSession()->getStore())
-                ->loadByCustomer($this->getSession()->getCustomer()->getId());
+        $customerId = (int)$this->getSession()->getCustomerId();
+        if ($customerId) {
+            $this->_cart->setStore($this->getSession()->getStore())->loadByCustomer($customerId);
             if (!$this->_cart->getId()) {
-                $this->_cart->assignCustomer($this->getSession()->getCustomer());
+                $customerData = $this->_customerService->getCustomer($customerId);
+                $this->_cart->assignCustomer($customerData);
                 $this->_cart->save();
             }
         }
@@ -566,8 +618,8 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
         if (!is_null($this->_compareList)) {
             return $this->_compareList;
         }
-
-        if ($this->getSession()->getCustomer()->getId()) {
+        $customerId = (int)$this->getSession()->getCustomerId();
+        if ($customerId) {
             $this->_compareList = $this->_objectManager->create('Magento\Catalog\Model\Product\Compare\ListCompare');
         } else {
             $this->_compareList = false;
@@ -575,6 +627,11 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
         return $this->_compareList;
     }
 
+    /**
+     * Retrieve current customer group ID.
+     *
+     * @return int
+     */
     public function getCustomerGroupId()
     {
         $groupId = $this->getQuote()->getCustomerGroupId();
@@ -591,6 +648,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
      * @param   string $moveTo
      * @param   int $qty
      * @return  \Magento\Sales\Model\AdminOrder\Create
+     * @throws \Magento\Core\Exception
      */
     public function moveQuoteItem($item, $moveTo, $qty)
     {
@@ -653,15 +711,11 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
                 case 'wishlist':
                     $wishlist = null;
                     if (!isset($moveTo[1])) {
-                        $wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist')->loadByCustomer(
-                            $this->getSession()->getCustomer(),
-                            true
-                        );
+                        $wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist')
+                            ->loadByCustomer($this->getSession()->getCustomerId(), true);
                     } else {
                         $wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist')->load($moveTo[1]);
-                        if (!$wishlist->getId()
-                            || $wishlist->getCustomerId() != $this->getSession()->getCustomerId()
-                        ) {
+                        if (!$wishlist->getId() || $wishlist->getCustomerId() != $this->getSession()->getCustomerId()) {
                             $wishlist = null;
                         }
                     }
@@ -699,6 +753,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
      *
      * @param array $data
      * @return \Magento\Sales\Model\AdminOrder\Create
+     * @throws \Magento\Core\Exception
      */
     public function applySidebarData($data)
     {
@@ -804,6 +859,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
      * @param   int|\Magento\Catalog\Model\Product $product
      * @param array|float|int|\Magento\Object $config
      * @return  \Magento\Sales\Model\AdminOrder\Create
+     * @throws \Magento\Core\Exception
      */
     public function addProduct($product, $config = 1)
     {
@@ -924,6 +980,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
      * @param \Magento\Sales\Model\Quote\Item $item
      * @param $additionalOptions
      * @return array
+     * @throws \Magento\Core\Exception
      */
     protected function _parseOptions(\Magento\Sales\Model\Quote\Item $item, $additionalOptions)
     {
@@ -1064,6 +1121,12 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
         return $newInfoOptions;
     }
 
+    /**
+     * Return valid price
+     *
+     * @param float|int $price
+     * @return int
+     */
     protected function _parseCustomPrice($price)
     {
         $price = $this->_objectManager->get('Magento\Core\Model\LocaleInterface')->getNumber($price);
@@ -1084,31 +1147,19 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
     /**
      * Return Customer (Checkout) Form instance
      *
-     * @return \Magento\Customer\Model\Form
+     * @param CustomerDto $customerDto
+     * @return CustomerForm
      */
-    protected function _getCustomerForm()
+    protected function _createCustomerForm(CustomerDto $customerDto)
     {
-        if (is_null($this->_customerForm)) {
-            $this->_customerForm = $this->_objectManager->create('Magento\Customer\Model\Form')
-                ->setFormCode('adminhtml_checkout')
-                ->ignoreInvisible(false);
-        }
-        return $this->_customerForm;
-    }
+        $customerForm = $this->_metadataFormFactory->create(
+            \Magento\Customer\Service\V1\CustomerMetadataServiceInterface::ENTITY_TYPE_CUSTOMER,
+            'adminhtml_checkout',
+            $customerDto->getAttributes(),
+            CustomerForm::DONT_IGNORE_INVISIBLE
+        );
 
-    /**
-     * Return Customer Address Form instance
-     *
-     * @return \Magento\Customer\Model\Form
-     */
-    protected function _getCustomerAddressForm()
-    {
-        if (is_null($this->_customerAddressForm)) {
-            $this->_customerAddressForm = $this->_objectManager->create('Magento\Customer\Model\Form')
-                ->setFormCode('adminhtml_customer_address')
-                ->ignoreInvisible(false);
-        }
-        return $this->_customerAddressForm;
+        return $customerForm;
     }
 
     /**
@@ -1121,10 +1172,24 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
      */
     protected function _setQuoteAddress(\Magento\Sales\Model\Quote\Address $address, array $data)
     {
-        $addressForm    = $this->_getCustomerAddressForm()
-            ->setEntity($address)
-            ->setEntityType($this->_objectManager->get('Magento\Eav\Model\Config')->getEntityType('customer_address'))
-            ->setIsAjaxRequest(!$this->getIsValidate());
+        $isAjax = !$this->getIsValidate();
+
+        // Region is a DTO, so it is represented by an array. validateData() doesn't understand arrays, so we need to
+        // merge region data with address data. This is going to be removed when we switch to use address DTO instead
+        // of the address model.
+        // Note: if we use getRegion() here it will pull region from db using the region_id
+        $data = isset($data['region']) && is_array($data['region'])
+            ? array_merge($data, $data['region'])
+            : $data;
+
+        $addressForm = $this->_metadataFormFactory->create(
+            CustomerMetadataServiceInterface::ENTITY_TYPE_ADDRESS,
+            'adminhtml_customer_address',
+            $data,
+            CustomerForm::DONT_IGNORE_INVISIBLE,
+            [],
+            $isAjax
+        );
 
         // prepare request
         // save original request structure for files
@@ -1135,8 +1200,8 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
             $requestData = array('order' => array('billing_address' => $data));
             $requestScope = 'order/billing_address';
         }
-        $request        = $addressForm->prepareRequest($requestData);
-        $addressData    = $addressForm->extractData($request, $requestScope);
+        $request = $addressForm->prepareRequest($requestData);
+        $addressData = $addressForm->extractData($request, $requestScope);
         if ($this->getIsValidate()) {
             $errors = $addressForm->validateData($addressData);
             if ($errors !== true) {
@@ -1148,28 +1213,37 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
                 foreach ($errors as $error) {
                     $this->_errors[] = $typeName . $error;
                 }
-                $addressForm->restoreData($addressData);
+                $address->setData($addressForm->restoreData($addressData));
             } else {
-                $addressForm->compactData($addressData);
+                $address->setData($addressForm->compactData($addressData));
             }
         } else {
-            $addressForm->restoreData($addressData);
+            $address->addData($addressForm->restoreData($addressData));
         }
-
         return $this;
     }
 
+    /**
+     * Set shipping address into quote
+     *
+     * @param \Magento\Sales\Model\Quote\Address|array $address
+     * @return $this
+     */
     public function setShippingAddress($address)
     {
         if (is_array($address)) {
-            $address['save_in_address_book'] = isset($address['save_in_address_book'])
-                && !empty($address['save_in_address_book']);
             $shippingAddress = $this->_objectManager->create('Magento\Sales\Model\Quote\Address')
                 ->setData($address)
                 ->setAddressType(\Magento\Sales\Model\Quote\Address::TYPE_SHIPPING);
             if (!$this->getQuote()->isVirtual()) {
                 $this->_setQuoteAddress($shippingAddress, $address);
             }
+            /**
+             * save_in_address_book is not a valid attribute and is filtered out by _setQuoteAddress,
+             * that is why it should be added after _setQuoteAddress call
+             */
+            $saveInAddressBook = (int)!empty($address['save_in_address_book']);
+            $shippingAddress->setData('save_in_address_book', $saveInAddressBook);
         }
         if ($address instanceof \Magento\Sales\Model\Quote\Address) {
             $shippingAddress = $address;
@@ -1180,6 +1254,13 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
         return $this;
     }
 
+    /**
+     * Set shipping anddress to be same as billing
+     *
+     * @param bool $flag If true - don't save in address book and actually copy data across billing and shipping
+     *                   addresses
+     * @return $this
+     */
     public function setShippingAsBilling($flag)
     {
         if ($flag) {
@@ -1205,28 +1286,45 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
         return $this->getQuote()->getBillingAddress();
     }
 
+    /**
+     * Set billing address into quote
+     *
+     * @param array $address
+     * @return $this
+     */
     public function setBillingAddress($address)
     {
         if (is_array($address)) {
-            $address['save_in_address_book'] = isset($address['save_in_address_book']) ? 1 : 0;
             $billingAddress = $this->_objectManager->create('Magento\Sales\Model\Quote\Address')
                 ->setData($address)
                 ->setAddressType(\Magento\Sales\Model\Quote\Address::TYPE_BILLING);
             $this->_setQuoteAddress($billingAddress, $address);
-        }
+            /**
+             * save_in_address_book is not a valid attribute and is filtered out by _setQuoteAddress,
+             * that is why it should be added after _setQuoteAddress call
+             */
+            $saveInAddressBook = (int)!empty($address['save_in_address_book']);
+            $billingAddress->setData('save_in_address_book', $saveInAddressBook);
+
+            if ($this->getShippingAddress()->getSameAsBilling()) {
+                $shippingAddress = clone $billingAddress;
+                $shippingAddress->setSameAsBilling(true);
+                $shippingAddress->setSaveInAddressBook(false);
+                $address['save_in_address_book'] = 0;
+                $this->setShippingAddress($address);
+            }
 
-        if ($this->getShippingAddress()->getSameAsBilling()) {
-            $shippingAddress = clone $billingAddress;
-            $shippingAddress->setSameAsBilling(true);
-            $shippingAddress->setSaveInAddressBook(false);
-            $address['save_in_address_book'] = 0;
-            $this->setShippingAddress($address);
+            $this->getQuote()->setBillingAddress($billingAddress);
         }
-
-        $this->getQuote()->setBillingAddress($billingAddress);
         return $this;
     }
 
+    /**
+     * Set shipping method
+     *
+     * @param string $method
+     * @return $this
+     */
     public function setShippingMethod($method)
     {
         $this->getShippingAddress()->setShippingMethod($method);
@@ -1234,6 +1332,11 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
         return $this;
     }
 
+    /**
+     * Empty shipping method and clear shipping rates
+     *
+     * @return $this
+     */
     public function resetShippingMethod()
     {
         $this->getShippingAddress()->setShippingMethod(false);
@@ -1251,17 +1354,32 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
         return $this;
     }
 
+    /**
+     * Calculate totals
+     */
     public function collectRates()
     {
         $this->getQuote()->collectTotals();
     }
 
+    /**
+     * Set payment method into quote
+     *
+     * @param string $method
+     * @return $this
+     */
     public function setPaymentMethod($method)
     {
         $this->getQuote()->getPayment()->setMethod($method);
         return $this;
     }
 
+    /**
+     * Set payment data into quote
+     *
+     * @param array $data
+     * @return $this
+     */
     public function setPaymentData($data)
     {
         if (!isset($data['method'])) {
@@ -1271,6 +1389,12 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
         return $this;
     }
 
+    /**
+     * Add coupon code to the quote
+     *
+     * @param string $code
+     * @return $this
+     */
     public function applyCoupon($code)
     {
         $code = trim((string)$code);
@@ -1279,26 +1403,32 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
         return $this;
     }
 
+    /**
+     * Add account data to quote
+     *
+     * @param array $accountData
+     * @return $this
+     */
     public function setAccountData($accountData)
     {
-        $customer   = $this->getQuote()->getCustomer();
-        $form       = $this->_getCustomerForm();
-        $form->setEntity($customer);
+        $customer = $this->getQuote()->getCustomerData();
+        $form = $this->_createCustomerForm($customer);
 
         // emulate request
         $request = $form->prepareRequest($accountData);
-        $data    = $form->extractData($request);
-        $form->restoreData($data);
+        $data = $form->extractData($request);
+        $data = $form->restoreData($data);
+        $this->getQuote()->updateCustomerData($this->_customerBuilder->mergeDtoWithArray($customer, $data));
+        $data = [];
 
-        $data = array();
         foreach ($form->getAttributes() as $attribute) {
             $code = sprintf('customer_%s', $attribute->getAttributeCode());
-            $data[$code] = $customer->getData($attribute->getAttributeCode());
+            $data[$code] = $customer->getAttribute($attribute->getAttributeCode());
         }
 
         if (isset($data['customer_group_id'])) {
-            $groupModel = $this->_objectManager->create('Magento\Customer\Model\Group')->load($data['customer_group_id']);
-            $data['customer_tax_class_id'] = $groupModel->getTaxClassId();
+            $customerGroup = $this->_customerGroupService->getGroup($data['customer_group_id']);
+            $data['customer_tax_class_id'] = $customerGroup->getTaxClassId();
             $this->setRecollect(true);
         }
 
@@ -1358,173 +1488,155 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
     /**
      * Check whether we need to create new customer (for another website) during order creation
      *
-     * @param   \Magento\Core\Model\Store $store
-     * @return  boolean
+     * @param \Magento\Core\Model\Store $store
+     * @return bool
      */
     protected function _customerIsInStore($store)
     {
-        $customer = $this->getSession()->getCustomer();
-        if ($customer->getWebsiteId() == $store->getWebsiteId()) {
-            return true;
-        }
-        return $customer->isInStore($store);
+        $customerId = (int)$this->getSession()->getCustomerId();
+        $customerData = $this->_customerService->getCustomer($customerId);
+        return $customerData->getWebsiteId() == $store->getWebsiteId() ||
+            $this->_customerHelper->isCustomerInStore($customerData->getWebsiteId(), $store->getId());
     }
 
     /**
-     * Set and validate Customer data
+     * Set and validate Customer data. Return the updated DTO merged with the account data
      *
-     * @param \Magento\Customer\Model\Customer $customer
-     * @return \Magento\Sales\Model\AdminOrder\Create
+     * @param CustomerDto $customerDto
+     * @return CustomerDto
      */
-    protected function _setCustomerData(\Magento\Customer\Model\Customer $customer)
+    protected function _validateCustomerData(CustomerDto $customerDto)
     {
-        $form = $this->_getCustomerForm();
-        $form->setEntity($customer);
-
+        $form = $this->_createCustomerForm($customerDto);
         // emulate request
         $request = $form->prepareRequest(array('order' => $this->getData()));
-        $data    = $form->extractData($request, 'order/account');
+        $data = $form->extractData($request, 'order/account');
         if ($this->getIsValidate()) {
             $errors = $form->validateData($data);
-            if ($errors !== true) {
+            if (is_array($errors)) {
                 foreach ($errors as $error) {
                     $this->_errors[] = $error;
                 }
-                $form->restoreData($data);
-            } else {
-                $form->compactData($data);
             }
-        } else {
-            $form->restoreData($data);
         }
-
-        return $this;
+        $data = $form->restoreData($data);
+        foreach($data as $key => $value) {
+            if(!is_null($value)){
+                unset($data[$key]);
+            }
+        }
+        return $this->_customerBuilder->mergeDtoWithArray($customerDto, $data);
     }
 
     /**
-     * Prepare quote customer
+     * Prepare customer data for order creation.
+     *
+     * Create customer if not created using data from customer form.
+     * Create customer billing/shipping address if necessary using data from customer address forms.
+     * Set customer data to quote.
      *
      * @return \Magento\Sales\Model\AdminOrder\Create
      */
     public function _prepareCustomer()
     {
-        /** @var $quote \Magento\Sales\Model\Quote */
-        $quote = $this->getQuote();
-        if ($quote->getCustomerIsGuest()) {
+        if ($this->getQuote()->getCustomerIsGuest()) {
             return $this;
         }
-
-        /** @var $customer \Magento\Customer\Model\Customer */
-        $customer = $this->getSession()->getCustomer();
         /** @var $store \Magento\Core\Model\Store */
         $store = $this->getSession()->getStore();
+        $customerDto = $this->getQuote()->getCustomerData();
+        if ($customerDto->getCustomerId() && !$this->_customerIsInStore($store)) {
+            /** Create a new customer record if it is not available in the specified store */
+            $customerDto = $this->_customerBuilder->mergeDtoWithArray(
+                $customerDto,
+                /** Unset customer ID to ensure that new customer will be created */
+                [CustomerDto::STORE_ID => $store->getId(), CustomerDto::ID => null, CustomerDto::CREATED_AT => null]
+            );
+            $customerDto = $this->_validateCustomerData($customerDto);
+        } else if (!$customerDto->getCustomerId()) {
+            /** Create new customer */
+            $customerBillingAddressDto = $this->getBillingAddress()->exportCustomerAddressData();
+            $customerDto = $this->_customerBuilder->mergeDtos($customerDto, $customerBillingAddressDto);
+            $customerDto = $this->_customerBuilder->mergeDtoWithArray(
+                $customerDto,
+                [CustomerDto::STORE_ID => $store->getId(), CustomerDto::EMAIL => $this->_getNewCustomerEmail()]
+            );
+            $customerDto = $this->_validateCustomerData($customerDto);
+        }
+        if ($this->getBillingAddress()->getSaveInAddressBook()) {
+            $this->_prepareCustomerAddress($customerDto, $this->getBillingAddress());
+        }
+        if (!$this->getQuote()->isVirtual() && $this->getShippingAddress()->getSaveInAddressBook()) {
+            $this->_prepareCustomerAddress($customerDto, $this->getShippingAddress());
+        }
+        $this->getQuote()->updateCustomerData($customerDto);
 
-        $customerIsInStore = $this->_customerIsInStore($store);
-        $customerBillingAddress = null;
-        $customerShippingAddress = null;
-
-        if ($customer->getId()) {
-            // Create new customer if customer is not registered in specified store
-            if (!$customerIsInStore) {
-                $customer->setId(null)
-                    ->setStore($store)
-                    ->setDefaultBilling(null)
-                    ->setDefaultShipping(null)
-                    ->setPassword($customer->generatePassword());
-                $this->_setCustomerData($customer);
-            }
-
-            if ($this->getBillingAddress()->getSaveInAddressBook()) {
-                /** @var $customerBillingAddress \Magento\Customer\Model\Address */
-                $customerBillingAddress = $this->getBillingAddress()->exportCustomerAddress();
-                $customerAddressId = $this->getBillingAddress()->getCustomerAddressId();
-                if ($customerAddressId && $customer->getId()) {
-                    $customer->getAddressItemById($customerAddressId)->addData($customerBillingAddress->getData());
-                } else {
-                    $customer->addAddress($customerBillingAddress);
-                }
-            }
-
-            if (!$this->getQuote()->isVirtual() && $this->getShippingAddress()->getSaveInAddressBook()) {
-                /** @var $customerShippingAddress \Magento\Customer\Model\Address */
-                $customerShippingAddress = $this->getShippingAddress()->exportCustomerAddress();
-                $customerAddressId = $this->getShippingAddress()->getCustomerAddressId();
-                if ($customerAddressId && $customer->getId()) {
-                    $customer->getAddressItemById($customerAddressId)->addData($customerShippingAddress->getData());
-                } elseif (!empty($customerAddressId)
-                    && $customerBillingAddress !== null
-                    && $this->getBillingAddress()->getCustomerAddressId() == $customerAddressId
-                ) {
-                    $customerBillingAddress->setIsDefaultShipping(true);
-                } else {
-                    $customer->addAddress($customerShippingAddress);
-                }
-            }
-
-            if (is_null($customer->getDefaultBilling()) && $customerBillingAddress) {
-                $customerBillingAddress->setIsDefaultBilling(true);
+        foreach ($this->_createCustomerForm($customerDto)->getUserAttributes() as $attribute) {
+            if (!is_null($customerDto->getAttribute($attribute->getAttributeCode()))) {
+                $quoteCode = sprintf('customer_%s', $attribute->getAttributeCode());
+                $this->getQuote()->setData($quoteCode, $customerDto->getAttribute($attribute->getAttributeCode()));
             }
+        }
+        return $this;
+    }
 
-            if (is_null($customer->getDefaultShipping())) {
-                if ($this->getShippingAddress()->getSameAsBilling() && $customerBillingAddress) {
-                    $customerBillingAddress->setIsDefaultShipping(true);
-                } elseif ($customerShippingAddress) {
-                    $customerShippingAddress->setIsDefaultShipping(true);
-                }
-            }
-        } else {
-            // Prepare new customer
-            /** @var $customerBillingAddress \Magento\Customer\Model\Address */
-            $customerBillingAddress = $this->getBillingAddress()->exportCustomerAddress();
-            $customer->addData($customerBillingAddress->getData())
-                ->setPassword($customer->generatePassword())
-                ->setStore($store);
-            $customer->setEmail($this->_getNewCustomerEmail($customer));
-            $this->_setCustomerData($customer);
-
-            if ($this->getBillingAddress()->getSaveInAddressBook()) {
-                $customerBillingAddress->setIsDefaultBilling(true);
-                $customer->addAddress($customerBillingAddress);
+    /**
+     * Create customerAddressDto and save it in the Model\Quote so that it can be used to persist later.
+     *
+     * @param CustomerDto $customerDto
+     * @param \Magento\Sales\Model\Quote\Address $quoteCustomerAddress
+     * @throws \InvalidArgumentException
+     */
+    protected function _prepareCustomerAddress($customerDto, $quoteCustomerAddress)
+    {
+        // Possible that customerId is null for new customers
+        $customerId = $customerDto->getCustomerId();
+        $quoteCustomerAddress->setCustomerId($customerId);
+        $customerAddressDto = $quoteCustomerAddress->exportCustomerAddressData();
+        $quoteAddressId = $quoteCustomerAddress->getCustomerAddressId();
+        $addressType = $quoteCustomerAddress->getAddressType();
+        if ($quoteAddressId) {
+            /** Update existing address */
+            $existingAddressDto = $this->_customerAddressService->getAddressById($quoteAddressId);
+            /** Update customer address data */
+            $customerAddressDto = $this->_customerAddressBuilder->mergeDtos($existingAddressDto, $customerAddressDto);
+        } else if ($addressType == CustomerAddressDto::ADDRESS_TYPE_SHIPPING ) {
+            try {
+                $billingAddressDto = $this->_customerAddressService->getDefaultBillingAddress($customerId);
+            } catch (\Exception $e) {
+                /** Billing address does not exist. */
             }
-
-            /** @var $shippingAddress \Magento\Sales\Model\Quote\Address */
-            $shippingAddress = $this->getShippingAddress();
-            if (!$this->getQuote()->isVirtual()
-                && !$shippingAddress->getSameAsBilling()
-                && $shippingAddress->getSaveInAddressBook()
-            ) {
-                /** @var $customerShippingAddress \Magento\Customer\Model\Address */
-                $customerShippingAddress = $shippingAddress->exportCustomerAddress();
-                $customerShippingAddress->setIsDefaultShipping(true);
-                $customer->addAddress($customerShippingAddress);
-            } else {
-                $customerBillingAddress->setIsDefaultShipping(true);
+            $isShippingAsBilling = $quoteCustomerAddress->getSameAsBilling();
+            if (isset($billingAddressDto) && $isShippingAsBilling) {
+                /** Set existing billing address as default shipping */
+                $customerAddressDto = $this->_customerAddressBuilder->mergeDtoWithArray(
+                    $billingAddressDto,
+                    [CustomerAddressDto::KEY_DEFAULT_SHIPPING => true]
+                );
             }
         }
 
-        // Set quote customer data to customer
-        $this->_setCustomerData($customer);
-
-        // Set customer to quote and convert customer data to quote
-        $quote->setCustomer($customer);
-
-        // Add user defined attributes to quote
-        $form = $this->_getCustomerForm()->setEntity($customer);
-        foreach ($form->getUserAttributes() as $attribute) {
-            $quoteCode = sprintf('customer_%s', $attribute->getAttributeCode());
-            $quote->setData($quoteCode, $customer->getData($attribute->getAttributeCode()));
-        }
-
-        if ($customer->getId()) {
-            // Restore account data for existing customer
-            $this->_getCustomerForm()
-                ->setEntity($customer)
-                ->resetEntityData();
-        } else {
-            $quote->setCustomerId(true);
+        switch ($addressType) {
+            case CustomerAddressDto::ADDRESS_TYPE_BILLING:
+                if (is_null($customerDto->getDefaultBilling())) {
+                    $customerAddressDto = $this->_customerAddressBuilder->mergeDtoWithArray(
+                        $customerAddressDto,
+                        [CustomerAddressDto::KEY_DEFAULT_BILLING => true]
+                    );
+                }
+                break;
+            case CustomerAddressDto::ADDRESS_TYPE_SHIPPING:
+                if (is_null($customerDto->getDefaultShipping())) {
+                    $customerAddressDto = $this->_customerAddressBuilder->mergeDtoWithArray(
+                        $customerAddressDto,
+                        [CustomerAddressDto::KEY_DEFAULT_SHIPPING => true]
+                    );
+                }
+                break;
+            default:
+                throw new \InvalidArgumentException('Customer address type is invalid.');
         }
-
-        return $this;
+        $this->getQuote()->addCustomerAddressData($customerAddressDto);
     }
 
     /**
@@ -1579,22 +1691,13 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
             $service->setOrderData($orderData);
         }
 
-        $order = $service->submitOrder();
-        if ((!$quote->getCustomer()->getId() || !$quote->getCustomer()->isInStore($this->getSession()->getStore()))
-            && !$quote->getCustomerIsGuest()
-        ) {
-            $quote->getCustomer()->setCreatedAt($order->getCreatedAt());
-            $quote->getCustomer()
-                ->save()
-                ->sendNewAccountEmail('registered', '', $quote->getStoreId());;
-        }
+        $order = $service->submitOrderWithDto();
+
         if ($this->getSession()->getOrder()->getId()) {
             $oldOrder = $this->getSession()->getOrder();
-
-            $this->getSession()->getOrder()->setRelationChildId($order->getId());
-            $this->getSession()->getOrder()->setRelationChildRealId($order->getIncrementId());
-            $this->getSession()->getOrder()->cancel()
-                ->save();
+            $oldOrder->setRelationChildId($order->getId());
+            $oldOrder->setRelationChildRealId($order->getIncrementId());
+            $oldOrder->cancel()->save();
             $order->save();
         }
         if ($this->getSendConfirmation()) {
@@ -1610,6 +1713,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
      * Validate quote data before order creation
      *
      * @return \Magento\Sales\Model\AdminOrder\Create
+     * @throws \Magento\Core\Exception
      */
     protected function _validate()
     {
@@ -1658,7 +1762,6 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
                 }
             }
         }
-
         if (!empty($this->_errors)) {
             foreach ($this->_errors as $error) {
                 $this->messageManager->addError($error);
@@ -1669,19 +1772,16 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car
     }
 
     /**
-     * Retrieve new customer email
+     * Retrieve or generate new customer email.
      *
-     * @param   \Magento\Customer\Model\Customer $customer
-     * @return  string
+     * @return string
      */
-    protected function _getNewCustomerEmail($customer)
+    protected function _getNewCustomerEmail()
     {
         $email = $this->getData('account/email');
         if (empty($email)) {
-            $host = $this->getSession()
-                ->getStore()
-                ->getConfig(\Magento\Customer\Model\Customer::XML_PATH_DEFAULT_EMAIL_DOMAIN);
-            $account = $customer->getIncrementId() ? $customer->getIncrementId() : time();
+            $host = $this->getSession()->getStore()->getConfig(self::XML_PATH_DEFAULT_EMAIL_DOMAIN);
+            $account = time();
             $email = $account.'@'. $host;
             $account = $this->getData('account');
             $account['email'] = $email;
diff --git a/app/code/Magento/Sales/Model/AdminOrder/Random.php b/app/code/Magento/Sales/Model/AdminOrder/Random.php
deleted file mode 100644
index 3f159384389..00000000000
--- a/app/code/Magento/Sales/Model/AdminOrder/Random.php
+++ /dev/null
@@ -1,216 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category    Magento
- * @package     Magento_Sales
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Create random order
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- *
- */
-namespace Magento\Sales\Model\AdminOrder;
-
-/**
- * @SuppressWarnings(PHPMD.LongVariable)
- */
-class Random
-{
-    /**
-     * Quote model object
-     *
-     * @var \Magento\Sales\Model\Quote
-     */
-    protected $_quote;
-
-    /**
-     * Order model object
-     *
-     * @var \Magento\Sales\Model\Order
-     */
-    protected $_order;
-    protected $_store;
-    protected $_customer;
-    protected $_productCollection;
-
-    protected static $_storeCollection;
-    protected static $_customerCollection;
-
-    /**
-     * @var \Magento\Core\Model\Resource\Store\CollectionFactory
-     */
-    protected $_storeCollectionFactory;
-
-    /**
-     * @var \Magento\Customer\Model\Resource\Customer\CollectionFactory
-     */
-    protected $_customerCollectionFactory;
-
-    /**
-     * @var \Magento\Catalog\Model\Resource\Product\CollectionFactory
-     */
-    protected $_productCollectionFactory;
-
-    /**
-     * @var \Magento\Catalog\Model\Product\Visibility
-     */
-    protected $_productVisibility;
-
-    /**
-     * @param \Magento\Catalog\Model\Product\Visibility $productVisibility
-     * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory
-     * @param \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerCollectionFactory
-     * @param \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollectionFactory
-     * @param \Magento\Sales\Model\QuoteFactory $quoteFactory
-     * @param \Magento\Sales\Model\OrderFactory $orderFactory
-     */
-    public function __construct(
-        \Magento\Catalog\Model\Product\Visibility $productVisibility,
-        \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory,
-        \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerCollectionFactory,
-        \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollectionFactory,
-        \Magento\Sales\Model\QuoteFactory $quoteFactory,
-        \Magento\Sales\Model\OrderFactory $orderFactory
-    ) {
-        $this->_productVisibility = $productVisibility;
-        $this->_productCollectionFactory = $productCollectionFactory;
-        $this->_customerCollectionFactory = $customerCollectionFactory;
-        $this->_storeCollectionFactory = $storeCollectionFactory;
-        $this->_quote = $quoteFactory->create()->save();
-        $this->_order = $orderFactory->create();
-    }
-
-    protected function _getStores()
-    {
-        if (!self::$_storeCollection) {
-            self::$_storeCollection = $this->_storeCollectionFactory->create()
-                ->load();
-        }
-        return self::$_storeCollection->getItems();
-    }
-
-    protected function _getCustomers()
-    {
-        if (!self::$_customerCollection) {
-            self::$_customerCollection = $this->_customerCollectionFactory->create()
-                ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'inner')
-                ->joinAttribute('shipping_country_id', 'customer_address/country_id', 'default_shipping', null, 'inner')
-                ->load();
-        }
-        return self::$_customerCollection->getItems();
-    }
-
-    protected function _getProducts()
-    {
-        if (!$this->_productCollection) {
-            $this->_productCollection= $this->_productCollectionFactory->create();
-            //$this->_productCollection->getEntity()->setStore($this->_getStore());
-            $this->_productCollection->addAttributeToSelect('name')
-                ->addAttributeToSelect('sku')
-                ->addAttributeToFilter('type_id', \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
-                ->setVisibility($this->_productVisibility->getVisibleInSearchIds())
-                ->load();
-        }
-        return $this->_productCollection->getItems();
-    }
-
-    /**
-     * Retrieve customer model
-     *
-     * @return \Magento\Customer\Model\Customer
-     */
-    protected function _getCustomer()
-    {
-        if (!$this->_customer) {
-            $items = $this->_getCustomers();
-            $randKey = array_rand($items);
-            $this->_customer = $items[$randKey];
-        }
-        return $this->_customer;
-    }
-
-    protected function _getRandomProduct()
-    {
-        $items = $this->_getProducts();
-        $randKey = array_rand($items);
-        return isset($items[$randKey]) ? $items[$randKey] : false;
-    }
-
-    protected function _getStore()
-    {
-        if (!$this->_store) {
-            $items = $this->_getStores();
-            $randKey = array_rand($items);
-            $this->_store = $items[$randKey];
-        }
-        return $this->_store;
-    }
-
-    public function render()
-    {
-        $customer = $this->_getCustomer();
-        $this->_quote->setStore($this->_getStore())
-            ->setCustomer($customer);
-        $this->_quote->getBillingAddress()->importCustomerAddress($customer->getDefaultBillingAddress());
-        $this->_quote->getShippingAddress()->importCustomerAddress($customer->getDefaultShippingAddress());
-
-        $productCount = rand(3, 10);
-        for ($i=0; $i<$productCount; $i++){
-            $product = $this->_getRandomProduct();
-            if ($product) {
-                $product->setQuoteQty(1);
-                $this->_quote->addCatalogProduct($product);
-            }
-        }
-        $this->_quote->getPayment()->setMethod('checkmo');
-
-        $this->_quote->getShippingAddress()->setShippingMethod('freeshipping_freeshipping');//->collectTotals()->save();
-        $this->_quote->getShippingAddress()->setCollectShippingRates(true);
-        $this->_quote->collectTotals()
-            ->save();
-        $this->_quote->save();
-        return $this;
-    }
-
-    protected function _getRandomDate()
-    {
-        $timestamp = mktime(rand(0,23), rand(0,59), 0, rand(1,11), rand(1,28), rand(2006, 2007));
-        return date('Y-m-d H:i:s', $timestamp);
-    }
-
-    public function save()
-    {
-        $this->_order->setStoreId($this->_getStore()->getId());
-        $this->_order->createFromQuoteAddress($this->_quote->getShippingAddress());
-        $this->_order->validate();
-        $this->_order->setInitialStatus();
-        $this->_order->save();
-        $this->_order->setCreatedAt($this->_getRandomDate());
-        $this->_order->save();
-
-        $this->_quote->setIsActive(false);
-        $this->_quote->save();
-        return $this;
-    }
-}
diff --git a/app/code/Magento/Sales/Model/Config/Source/Order/Status.php b/app/code/Magento/Sales/Model/Config/Source/Order/Status.php
index 937c5e339bb..78c5537a80f 100644
--- a/app/code/Magento/Sales/Model/Config/Source/Order/Status.php
+++ b/app/code/Magento/Sales/Model/Config/Source/Order/Status.php
@@ -29,7 +29,7 @@
  */
 namespace Magento\Sales\Model\Config\Source\Order;
 
-class Status implements \Magento\Core\Model\Option\ArrayInterface
+class Status implements \Magento\Option\ArrayInterface
 {
     // set null to enable all possible
     /**
diff --git a/app/code/Magento/Sales/Model/Download.php b/app/code/Magento/Sales/Model/Download.php
new file mode 100644
index 00000000000..49479d56ffa
--- /dev/null
+++ b/app/code/Magento/Sales/Model/Download.php
@@ -0,0 +1,127 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Sales\Model;
+
+class Download
+{
+    /**
+     * @var \Magento\Filesystem\Directory\WriteInterface
+     */
+    protected $_rootDir;
+
+    /**
+     * @var \Magento\Core\Helper\File\Storage\Database
+     */
+    protected $_fileStorageDatabase;
+
+    /**
+     * @var \Magento\Core\Model\File\Storage\DatabaseFactory
+     */
+    protected $_storageDatabaseFactory;
+
+    /**
+     * @var \Magento\App\Response\Http\FileFactory
+     */
+    protected $_fileFactory;
+
+    /**
+     * @param \Magento\App\Filesystem $filesystem
+     * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDatabase
+     * @param \Magento\Core\Model\File\Storage\DatabaseFactory $storageDatabaseFactory
+     * @param \Magento\App\Response\Http\FileFactory $fileFactory
+     */
+    public function __construct(
+        \Magento\App\Filesystem $filesystem,
+        \Magento\Core\Helper\File\Storage\Database $fileStorageDatabase,
+        \Magento\Core\Model\File\Storage\DatabaseFactory $storageDatabaseFactory,
+        \Magento\App\Response\Http\FileFactory $fileFactory
+    ) {
+        $this->_rootDir = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR);
+        $this->_fileStorageDatabase = $fileStorageDatabase;
+        $this->_storageDatabaseFactory = $storageDatabaseFactory;
+        $this->_fileFactory = $fileFactory;
+    }
+
+    /**
+     * Custom options downloader
+     *
+     * @param array $info
+     * @throws \Exception
+     */
+    public function downloadFile($info)
+    {
+        $relativePath = $info['order_path'];
+        if ($this->_isCanProcessed($relativePath)) {
+            //try get file from quote
+            $relativePath = $info['quote_path'];
+            if ($this->_isCanProcessed($relativePath)) {
+                throw new \Exception();
+            }
+        }
+
+        $this->_fileFactory->create(
+            $info['title'],
+            [
+                'value' => $this->_rootDir->getRelativePath($relativePath),
+                'type' => 'filename',
+            ],
+            \Magento\App\Filesystem::ROOT_DIR
+        );
+    }
+
+    /**
+     * @param string $relativePath
+     * @return bool
+     */
+    protected function _isCanProcessed($relativePath)
+    {
+        $filePath = $this->_rootDir->getAbsolutePath($relativePath);
+        return (!$this->_rootDir->isFile($relativePath) || !$this->_rootDir->isReadable($relativePath))
+            && !$this->_processDatabaseFile($filePath);
+    }
+
+    /**
+     * Check file in database storage if needed and place it on file system
+     *
+     * @param string $filePath
+     * @return bool
+     */
+    protected function _processDatabaseFile($filePath)
+    {
+        if (!$this->_fileStorageDatabase->checkDbUsage()) {
+            return false;
+        }
+        $relativePath = $this->_fileStorageDatabase->getMediaRelativePath($filePath);
+        $file = $this->_storageDatabaseFactory->create()->loadByFilename($relativePath);
+        if (!$file->getId()) {
+            return false;
+        }
+        $stream = $this->_rootDir->openFile($filePath, 'w+');
+        $stream->lock();
+        $stream->write($filePath, $file->getContent());
+        $stream->unlock();
+        $stream->close();
+        return true;
+    }
+}
diff --git a/app/code/Magento/Sales/Model/Observer.php b/app/code/Magento/Sales/Model/Observer.php
index d02f977bf3e..46274ea5828 100644
--- a/app/code/Magento/Sales/Model/Observer.php
+++ b/app/code/Magento/Sales/Model/Observer.php
@@ -316,6 +316,7 @@ class Observer
      */
     protected function _getVatRequiredSalesAddress($salesModel, $store = null)
     {
+        /** TODO: References to Magento\Customer\Model\Address will be eliminated in scope of MAGETWO-21105 */
         $configAddressType = $this->_customerAddress->getTaxCalculationAddressType($store);
         $requiredAddress = null;
         switch ($configAddressType) {
@@ -329,28 +330,6 @@ class Observer
         return $requiredAddress;
     }
 
-    /**
-     * Retrieve customer address (default billing or default shipping) ID on which tax calculation must be based
-     *
-     * @param \Magento\Customer\Model\Customer $customer
-     * @param \Magento\Core\Model\Store|string|int|null $store
-     * @return int|string
-     */
-    protected function _getVatRequiredCustomerAddress(\Magento\Customer\Model\Customer $customer, $store = null)
-    {
-        $configAddressType = $this->_customerAddress->getTaxCalculationAddressType($store);
-        $requiredAddress = null;
-        switch ($configAddressType) {
-            case \Magento\Customer\Model\Address\AbstractAddress::TYPE_SHIPPING:
-                $requiredAddress = $customer->getDefaultShipping();
-                break;
-            default:
-                $requiredAddress = $customer->getDefaultBilling();
-                break;
-        }
-        return $requiredAddress;
-    }
-
     /**
      * Restore initial customer group ID in quote if needed on collect_totals_after event of quote address
      *
@@ -358,6 +337,7 @@ class Observer
      */
     public function restoreQuoteCustomerGroupId($observer)
     {
+        /** TODO: References to Magento\Customer\Model\Address will be eliminated in scope of MAGETWO-21105 */
         $quoteAddress = $observer->getQuoteAddress();
         $configAddressType = $this->_customerAddress->getTaxCalculationAddressType();
         // Restore initial customer group ID in quote only if VAT is calculated based on shipping address
diff --git a/app/code/Magento/Sales/Model/Observer/Backend/CustomerQuote.php b/app/code/Magento/Sales/Model/Observer/Backend/CustomerQuote.php
index 17a5eb10de4..d065da808c5 100644
--- a/app/code/Magento/Sales/Model/Observer/Backend/CustomerQuote.php
+++ b/app/code/Magento/Sales/Model/Observer/Backend/CustomerQuote.php
@@ -23,6 +23,8 @@
  */
 namespace Magento\Sales\Model\Observer\Backend;
 
+use Magento\Customer\Service\V1\Dto\Customer as CustomerDto;
+
 class CustomerQuote
 {
     /**
@@ -36,23 +38,23 @@ class CustomerQuote
     protected $_storeManager;
 
     /**
-     * @var \Magento\Sales\Model\Quote
+     * @var \Magento\Sales\Model\QuoteFactory
      */
-    protected $_quote;
+    protected $_quoteFactory;
 
     /**
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Customer\Model\Config\Share $config
-     * @param \Magento\Sales\Model\Quote $quote
+     * @param \Magento\Sales\Model\QuoteFactory $quoteFactory
      */
     public function __construct(
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Customer\Model\Config\Share $config,
-        \Magento\Sales\Model\Quote $quote
+        \Magento\Sales\Model\QuoteFactory $quoteFactory
     ) {
         $this->_storeManager = $storeManager;
         $this->_config = $config;
-        $this->_quote = $quote;
+        $this->_quoteFactory = $quoteFactory;
     }
 
     /**
@@ -62,27 +64,28 @@ class CustomerQuote
      */
     public function dispatch(\Magento\Event\Observer $observer)
     {
-        /** @var $customer \Magento\Customer\Model\Customer */
-        $customer = $observer->getEvent()->getCustomer();
-
-        if ($customer->getGroupId() !== $customer->getOrigData('group_id')) {
+        /** @var CustomerDto $customerDto */
+        $customerDto = $observer->getEvent()->getCustomerDto();
+        /** @var CustomerDto $origCustomerDto */
+        $origCustomerDto = $observer->getEvent()->getOrigCustomerDto();
+        if ($customerDto->getGroupId() !== $origCustomerDto->getGroupId()) {
             /**
              * It is needed to process customer's quotes for all websites
              * if customer accounts are shared between all of them
              */
             /** @var $websites \Magento\Core\Model\Website[] */
-            $websites = $this->_config->isWebsiteScope() ?
-                array($this->_storeManager->getWebsite($customer->getWebsiteId())) :
-                $this->_storeManager->getWebsites();
+            $websites = $this->_config->isWebsiteScope()
+                ? array($this->_storeManager->getWebsite($customerDto->getWebsiteId()))
+                : $this->_storeManager->getWebsites();
 
             foreach ($websites as $website) {
-                $this->_quote->setWebsite($website);
-                $this->_quote->loadByCustomer($customer);
-
-                if ($this->_quote->getId()) {
-                    $this->_quote->setCustomerGroupId($customer->getGroupId());
-                    $this->_quote->collectTotals();
-                    $this->_quote->save();
+                $quote = $this->_quoteFactory->create();
+                $quote->setWebsite($website);
+                $quote->loadByCustomer($customerDto->getCustomerId());
+                if ($quote->getId()) {
+                    $quote->setCustomerGroupId($customerDto->getGroupId());
+                    $quote->collectTotals();
+                    $quote->save();
                 }
             }
         }
diff --git a/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotals.php b/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotals.php
index 5bfcd759f9c..d4d2f4e4dc3 100644
--- a/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotals.php
+++ b/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotals.php
@@ -73,6 +73,7 @@ class CollectTotals
         /** @var \Magento\Sales\Model\Quote $quote */
         $quote = $quoteAddress->getQuote();
 
+        /** TODO: References to Magento\Customer\Model\Customer will be eliminated in scope of MAGETWO-19763 */
         /** @var \Magento\Customer\Model\Customer $customer */
         $customer = $quote->getCustomer();
 
@@ -90,6 +91,7 @@ class CollectTotals
         if (empty($customerVatNumber) || false == $this->customerData->isCountryInEU($customerCountryCode)) {
             $groupId = $customer->getId()
                 ? $this->customerData->getDefaultCustomerGroupId($store)
+                /** TODO: References to Magento\Customer\Model\Group will be eliminated in scope of MAGETWO-19763 */
                 : \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID;
         } else {
             // Magento always has to emulate group even if customer uses default billing/shipping address
diff --git a/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/VatValidator.php b/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/VatValidator.php
index 11559758dd0..6fc0fb70ce1 100644
--- a/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/VatValidator.php
+++ b/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/VatValidator.php
@@ -112,6 +112,10 @@ class VatValidator
     {
         $configAddressType = $this->customerAddress->getTaxCalculationAddressType($store);
 
+        /**
+         * TODO: References to Magento\Customer\Model\Address\AbstractAddress will be eliminated
+         * in scope of MAGETWO-21105
+         */
         // When VAT is based on billing address then Magento have to handle only billing addresses
         $additionalBillingAddressCondition =
             $configAddressType == \Magento\Customer\Model\Address\AbstractAddress::TYPE_BILLING
@@ -125,4 +129,4 @@ class VatValidator
 
         return true;
     }
-} 
+}
diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php
index c22fe82760b..e26a15effe5 100644
--- a/app/code/Magento/Sales/Model/Order.php
+++ b/app/code/Magento/Sales/Model/Order.php
@@ -437,14 +437,9 @@ class Order extends \Magento\Sales\Model\AbstractModel
     protected $_productFactory;
 
     /**
-     * @var \Magento\Email\Model\Template\MailerFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_templateMailerFactory;
-
-    /**
-     * @var \Magento\Email\Model\InfoFactory
-     */
-    protected $_emailInfoFactory;
+    protected $_transportBuilder;
 
     /**
      * @var \Magento\Sales\Model\Resource\Order\Item\CollectionFactory
@@ -522,8 +517,8 @@ class Order extends \Magento\Sales\Model\AbstractModel
     protected $_trackCollectionFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $coreLocale
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Payment\Helper\Data $paymentData
@@ -532,8 +527,7 @@ class Order extends \Magento\Sales\Model\AbstractModel
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param Order\Config $orderConfig
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
-     * @param \Magento\Email\Model\Template\MailerFactory $templateMailerFactory
-     * @param \Magento\Email\Model\InfoFactory $emailInfoFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param Resource\Order\Item\CollectionFactory $orderItemCollectionFactory
      * @param \Magento\Catalog\Model\Product\Visibility $productVisibility
      * @param \Magento\Tax\Model\Calculation $taxCalculation
@@ -554,8 +548,8 @@ class Order extends \Magento\Sales\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $coreLocale,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Payment\Helper\Data $paymentData,
@@ -564,8 +558,7 @@ class Order extends \Magento\Sales\Model\AbstractModel
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Sales\Model\Order\Config $orderConfig,
         \Magento\Catalog\Model\ProductFactory $productFactory,
-        \Magento\Email\Model\Template\MailerFactory $templateMailerFactory,
-        \Magento\Email\Model\InfoFactory $emailInfoFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\Sales\Model\Resource\Order\Item\CollectionFactory $orderItemCollectionFactory,
         \Magento\Catalog\Model\Product\Visibility $productVisibility,
         \Magento\Tax\Model\Calculation $taxCalculation,
@@ -591,8 +584,7 @@ class Order extends \Magento\Sales\Model\AbstractModel
         $this->_storeManager = $storeManager;
         $this->_orderConfig = $orderConfig;
         $this->_productFactory = $productFactory;
-        $this->_templateMailerFactory = $templateMailerFactory;
-        $this->_emailInfoFactory = $emailInfoFactory;
+        $this->_transportBuilder = $transportBuilder;
         $this->_orderItemCollectionFactory = $orderItemCollectionFactory;
         $this->_productVisibility = $productVisibility;
         $this->_taxCalculation = $taxCalculation;
@@ -1449,38 +1441,52 @@ class Order extends \Magento\Sales\Model\AbstractModel
             $customerName = $this->getCustomerName();
         }
 
-        $mailer = $this->_templateMailerFactory->create();
-        $emailInfo = $this->_emailInfoFactory->create();
-        $emailInfo->addTo($this->getCustomerEmail(), $customerName);
+        $this->_transportBuilder
+            ->setTemplateIdentifier($templateId)
+            ->setTemplateOptions(array(
+                'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                'store' => $storeId
+            ))
+            ->setTemplateVars(array(
+                'order'        => $this,
+                'billing'      => $this->getBillingAddress(),
+                'payment_html' => $paymentBlockHtml,
+                'store'        => $this->getStore()
+            ))
+            ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId))
+            ->addTo($this->getCustomerEmail(), $customerName);
         if ($copyTo && $copyMethod == 'bcc') {
             // Add bcc to customer email
             foreach ($copyTo as $email) {
-                $emailInfo->addBcc($email);
+                $this->_transportBuilder->addBcc($email);
             }
         }
-        $mailer->addEmailInfo($emailInfo);
+        /** @var \Magento\Mail\TransportInterface $transport */
+        $transport =  $this->_transportBuilder->getTransport();
+        $transport->sendMessage();
 
         // Email copies are sent as separated emails if their copy method is 'copy'
         if ($copyTo && $copyMethod == 'copy') {
             foreach ($copyTo as $email) {
-                $emailInfo = $this->_emailInfoFactory->create();
-                $emailInfo->addTo($email);
-                $mailer->addEmailInfo($emailInfo);
+                $this->_transportBuilder
+                    ->setTemplateIdentifier($templateId)
+                    ->setTemplateOptions(array(
+                        'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                        'store' => $storeId
+                    ))
+                    ->setTemplateVars(array(
+                        'order'        => $this,
+                        'billing'      => $this->getBillingAddress(),
+                        'payment_html' => $paymentBlockHtml,
+                        'store'        => $this->getStore()
+                    ))
+                    ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId))
+                    ->addTo($email)
+                    ->getTransport()
+                    ->sendMessage();
             }
         }
 
-        // Set all required params and send emails
-        $mailer->setSender($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
-        $mailer->setStoreId($storeId);
-        $mailer->setTemplateId($templateId);
-        $mailer->setTemplateParams(array(
-                'order'        => $this,
-                'billing'      => $this->getBillingAddress(),
-                'payment_html' => $paymentBlockHtml
-            )
-        );
-        $mailer->send();
-
         $this->setEmailSent(true);
         $this->_getResource()->saveAttribute($this, 'email_sent');
 
@@ -1518,41 +1524,55 @@ class Order extends \Magento\Sales\Model\AbstractModel
             $customerName = $this->getCustomerName();
         }
 
-        $mailer = $this->_templateMailerFactory->create();
         if ($notifyCustomer) {
-            $emailInfo = $this->_emailInfoFactory->create();
-            $emailInfo->addTo($this->getCustomerEmail(), $customerName);
+            $this->_transportBuilder
+                ->setTemplateIdentifier($templateId)
+                ->setTemplateOptions(array(
+                    'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                    'store' => $storeId
+                ))
+                ->setTemplateVars(array(
+                    'order'   => $this,
+                    'comment' => $comment,
+                    'billing' => $this->getBillingAddress(),
+                    'store'   => $this->getStore()
+                ))
+                ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId))
+                ->addTo($this->getCustomerEmail(), $customerName);
             if ($copyTo && $copyMethod == 'bcc') {
                 // Add bcc to customer email
                 foreach ($copyTo as $email) {
-                    $emailInfo->addBcc($email);
+                    $this->_transportBuilder->addBcc($email);
                 }
             }
-            $mailer->addEmailInfo($emailInfo);
+            /** @var \Magento\Mail\TransportInterface $transport */
+            $transport =  $this->_transportBuilder->getTransport();
+            $transport->sendMessage();
         }
 
         // Email copies are sent as separated emails if their copy method is
         // 'copy' or a customer should not be notified
         if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
             foreach ($copyTo as $email) {
-                $emailInfo = $this->_emailInfoFactory->create();
-                $emailInfo->addTo($email);
-                $mailer->addEmailInfo($emailInfo);
+                $this->_transportBuilder
+                    ->setTemplateIdentifier($templateId)
+                    ->setTemplateOptions(array(
+                        'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                        'store' => $storeId
+                    ))
+                    ->setTemplateVars(array(
+                        'order'   => $this,
+                        'comment' => $comment,
+                        'billing' => $this->getBillingAddress(),
+                        'store'   => $this->getStore()
+                    ))
+                    ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId))
+                    ->addTo($email)
+                    ->getTransport()
+                    ->sendMessage();
             }
         }
 
-        // Set all required params and send emails
-        $mailer->setSender($this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId));
-        $mailer->setStoreId($storeId);
-        $mailer->setTemplateId($templateId);
-        $mailer->setTemplateParams(array(
-                'order'   => $this,
-                'comment' => $comment,
-                'billing' => $this->getBillingAddress()
-            )
-        );
-        $mailer->send();
-
         return $this;
     }
 
@@ -2268,7 +2288,9 @@ class Order extends \Magento\Sales\Model\AbstractModel
             // Set items count
             $this->setTotalItemCount($itemsCount);
         }
-        if ($this->getCustomer()) {
+        /** TODO refactor getCustomer usage after MAGETWO-20182 and MAGETWO-20258 are done */
+        $isNewCustomer = !$this->getCustomerId() || ($this->getCustomerId() === true);
+        if ($isNewCustomer && $this->getCustomer()) {
             $this->setCustomerId($this->getCustomer()->getId());
         }
 
diff --git a/app/code/Magento/Sales/Model/Order/Address.php b/app/code/Magento/Sales/Model/Order/Address.php
index db251924fbe..f8b4e39b2e9 100644
--- a/app/code/Magento/Sales/Model/Order/Address.php
+++ b/app/code/Magento/Sales/Model/Order/Address.php
@@ -24,6 +24,8 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\Sales\Model\Order;
+
 /**
  * Sales order address model
  *
@@ -33,6 +35,10 @@
  * @method \Magento\Sales\Model\Order\Address setParentId(int $value)
  * @method int getCustomerAddressId()
  * @method \Magento\Sales\Model\Order\Address setCustomerAddressId(int $value)
+ * @method \Magento\Customer\Model\Address getCustomerAddress()
+ * @method \Magento\Sales\Model\Order\Address setCustomerAddress(\Magento\Customer\Model\Address $value)
+ * @method \Magento\Customer\Service\V1\Dto\Address getCustomerAddressData()
+ * @method \Magento\Sales\Model\Order\Address setCustomerAddressData(\Magento\Customer\Service\V1\Dto\Address $value)
  * @method int getQuoteAddressId()
  * @method \Magento\Sales\Model\Order\Address setQuoteAddressId(int $value)
  * @method \Magento\Sales\Model\Order\Address setRegionId(int $value)
@@ -66,8 +72,6 @@
  * @method string getCompany()
  * @method \Magento\Sales\Model\Order\Address setCompany(string $value)
  */
-namespace Magento\Sales\Model\Order;
-
 class Address extends \Magento\Customer\Model\Address\AbstractAddress
 {
     /**
@@ -91,8 +95,8 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
     protected $_orderFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Directory\Helper\Data $directoryData
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Customer\Model\Address\Config $addressConfig
@@ -104,8 +108,8 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Directory\Helper\Data $directoryData,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Customer\Model\Address\Config $addressConfig,
@@ -180,6 +184,8 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
         // Init customer address id if customer address is assigned
         if ($this->getCustomerAddress()) {
             $this->setCustomerAddressId($this->getCustomerAddress()->getId());
+        } else if ($this->getCustomerAddressData()) {
+            $this->setCustomerAddressId($this->getCustomerAddressData()->getId());
         }
 
         return $this;
diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php
index f36e6c94b5a..760e63c9f18 100644
--- a/app/code/Magento/Sales/Model/Order/Creditmemo.php
+++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php
@@ -202,7 +202,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel
     protected $_cmItemCollectionFactory;
 
     /**
-     * @var \Magento\Core\Model\CalculatorFactory
+     * @var \Magento\Math\CalculatorFactory
      */
     protected $_calculatorFactory;
 
@@ -222,18 +222,13 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel
     protected $_commentCollectionFactory;
 
     /**
-     * @var \Magento\Email\Model\Template\MailerFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_templateMailerFactory;
+    protected $_transportBuilder;
 
     /**
-     * @var \Magento\Email\Model\InfoFactory
-     */
-    protected $_emailInfoFactory;
-
-    /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $coreLocale
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Payment\Helper\Data $paymentData
@@ -242,19 +237,18 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel
      * @param \Magento\Sales\Model\Order\Creditmemo\Config $creditmemoConfig
      * @param \Magento\Sales\Model\OrderFactory $orderFactory
      * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollectionFactory
-     * @param \Magento\Core\Model\CalculatorFactory $calculatorFactory
+     * @param \Magento\Math\CalculatorFactory $calculatorFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Sales\Model\Order\Creditmemo\CommentFactory $commentFactory
      * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollectionFactory
-     * @param \Magento\Email\Model\Template\MailerFactory $templateMailerFactory
-     * @param \Magento\Email\Model\InfoFactory $emailInfoFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $coreLocale,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Payment\Helper\Data $paymentData,
@@ -263,12 +257,11 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel
         \Magento\Sales\Model\Order\Creditmemo\Config $creditmemoConfig,
         \Magento\Sales\Model\OrderFactory $orderFactory,
         \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollectionFactory,
-        \Magento\Core\Model\CalculatorFactory $calculatorFactory,
+        \Magento\Math\CalculatorFactory $calculatorFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Sales\Model\Order\Creditmemo\CommentFactory $commentFactory,
         \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollectionFactory,
-        \Magento\Email\Model\Template\MailerFactory $templateMailerFactory,
-        \Magento\Email\Model\InfoFactory $emailInfoFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
@@ -283,8 +276,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel
         $this->_storeManager = $storeManager;
         $this->_commentFactory = $commentFactory;
         $this->_commentCollectionFactory = $commentCollectionFactory;
-        $this->_templateMailerFactory = $templateMailerFactory;
-        $this->_emailInfoFactory = $emailInfoFactory;
+        $this->_transportBuilder = $transportBuilder;
         parent::__construct($context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data);
     }
 
@@ -453,7 +445,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel
     {
         if ($price) {
             if (!isset($this->_calculators[$type])) {
-                $this->_calculators[$type] = $this->_calculatorFactory->create(array('store' => $this->getStore()));
+                $this->_calculators[$type] = $this->_calculatorFactory->create(array('scope' => $this->getStore()));
             }
             $price = $this->_calculators[$type]->deltaRound($price, $negative);
         }
@@ -858,42 +850,58 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel
             $customerName = $order->getCustomerName();
         }
 
-        $mailer = $this->_templateMailerFactory->create();
         if ($notifyCustomer) {
-            $emailInfo = $this->_emailInfoFactory->create();
-            $emailInfo->addTo($order->getCustomerEmail(), $customerName);
+            $this->_transportBuilder
+                ->setTemplateIdentifier($templateId)
+                ->setTemplateOptions(array(
+                    'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                    'store' => $storeId
+                ))
+                ->setTemplateVars(array(
+                    'order'        => $order,
+                    'invoice'      => $this,
+                    'comment'      => $comment,
+                    'billing'      => $order->getBillingAddress(),
+                    'payment_html' => $paymentBlockHtml,
+                    'store'        => $this->getStore()
+                ))
+                ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId))
+                ->addTo($order->getCustomerEmail(), $customerName);
             if ($copyTo && $copyMethod == 'bcc') {
                 // Add bcc to customer email
                 foreach ($copyTo as $email) {
-                    $emailInfo->addBcc($email);
+                    $this->_transportBuilder->addBcc($email);
                 }
             }
-            $mailer->addEmailInfo($emailInfo);
+            /** @var \Magento\Mail\TransportInterface $transport */
+            $transport =  $this->_transportBuilder->getTransport();
+            $transport->sendMessage();
         }
 
         // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
         if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
             foreach ($copyTo as $email) {
-                $emailInfo = $this->_emailInfoFactory->create();
-                $emailInfo->addTo($email);
-                $mailer->addEmailInfo($emailInfo);
+                $this->_transportBuilder
+                    ->setTemplateIdentifier($templateId)
+                    ->setTemplateOptions(array(
+                        'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                        'store' => $storeId
+                    ))
+                    ->setTemplateVars(array(
+                        'order'        => $order,
+                        'invoice'      => $this,
+                        'comment'      => $comment,
+                        'billing'      => $order->getBillingAddress(),
+                        'payment_html' => $paymentBlockHtml,
+                        'store'        => $this->getStore()
+                    ))
+                    ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId))
+                    ->addTo($email)
+                    ->getTransport()
+                    ->sendMessage();
             }
         }
 
-        // Set all required params and send emails
-        $mailer->setSender($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
-        $mailer->setStoreId($storeId);
-        $mailer->setTemplateId($templateId);
-        $mailer->setTemplateParams(array(
-                'order'        => $order,
-                'creditmemo'   => $this,
-                'comment'      => $comment,
-                'billing'      => $order->getBillingAddress(),
-                'payment_html' => $paymentBlockHtml
-            )
-        );
-        $mailer->send();
-
         $this->setEmailSent(true);
         $this->_getResource()->saveAttribute($this, 'email_sent');
 
@@ -932,40 +940,57 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel
             $customerName = $order->getCustomerName();
         }
 
-        $mailer = $this->_templateMailerFactory->create();
         if ($notifyCustomer) {
-            $emailInfo = $this->_emailInfoFactory->create();
-            $emailInfo->addTo($order->getCustomerEmail(), $customerName);
+            $this->_transportBuilder
+                ->setTemplateIdentifier($templateId)
+                ->setTemplateOptions(array(
+                    'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                    'store' => $storeId
+                ))
+                ->setTemplateVars(array(
+                    'order'        => $order,
+                    'creditmemo'      => $this,
+                    'comment'      => $comment,
+                    'billing'      => $order->getBillingAddress(),
+                    'store'        => $this->getStore()
+                ))
+                ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId))
+                ->addTo($order->getCustomerEmail(), $customerName);
             if ($copyTo && $copyMethod == 'bcc') {
                 // Add bcc to customer email
                 foreach ($copyTo as $email) {
-                    $emailInfo->addBcc($email);
+                    $this->_transportBuilder->addBcc($email);
                 }
             }
-            $mailer->addEmailInfo($emailInfo);
+            /** @var \Magento\Mail\TransportInterface $transport */
+            $transport =  $this->_transportBuilder->getTransport();
+            $transport->sendMessage();
         }
 
         // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
         if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
             foreach ($copyTo as $email) {
-                $emailInfo = $this->_emailInfoFactory->create();
-                $emailInfo->addTo($email);
-                $mailer->addEmailInfo($emailInfo);
+                $this->_transportBuilder
+                    ->setTemplateIdentifier($templateId)
+                    ->setTemplateOptions(array(
+                            'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                            'store' => $storeId
+                        )
+                    )
+                    ->setTemplateVars(array(
+                        'order'      => $order,
+                        'creditmemo' => $this,
+                        'comment'    => $comment,
+                        'billing'    => $order->getBillingAddress(),
+                        'store'      => $this->getStore()
+                    ))
+                    ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId))
+                    ->addTo($email)
+                    ->getTransport()
+                    ->sendMessage();
             }
         }
 
-        // Set all required params and send emails
-        $mailer->setSender($this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId));
-        $mailer->setStoreId($storeId);
-        $mailer->setTemplateId($templateId);
-        $mailer->setTemplateParams(array(
-            'order'      => $order,
-            'creditmemo' => $this,
-            'comment'    => $comment,
-            'billing'    => $order->getBillingAddress()
-        ));
-        $mailer->send();
-
         return $this;
     }
 
diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php
index d08c4d16832..e2cb433ace7 100644
--- a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php
+++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php
@@ -55,8 +55,8 @@ class Comment extends \Magento\Sales\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $coreLocale
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -65,8 +65,8 @@ class Comment extends \Magento\Sales\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $coreLocale,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php
index 05c85f1695d..ec0c89d401b 100644
--- a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php
+++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php
@@ -106,16 +106,16 @@ class Item extends \Magento\Core\Model\AbstractModel
     protected $_orderItemFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Sales\Model\Order\ItemFactory $orderItemFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Sales/Model/Order/Invoice.php b/app/code/Magento/Sales/Model/Order/Invoice.php
index d16d3a411e8..dfe122079f1 100644
--- a/app/code/Magento/Sales/Model/Order/Invoice.php
+++ b/app/code/Magento/Sales/Model/Order/Invoice.php
@@ -208,7 +208,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel
     protected $_orderResourceFactory;
 
     /**
-     * @var \Magento\Core\Model\CalculatorFactory
+     * @var \Magento\Math\CalculatorFactory
      */
     protected $_calculatorFactory;
 
@@ -228,18 +228,13 @@ class Invoice extends \Magento\Sales\Model\AbstractModel
     protected $_commentCollectionFactory;
 
     /**
-     * @var \Magento\Email\Model\Template\MailerFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_templateMailerFactory;
+    protected $_transportBuilder;
 
     /**
-     * @var \Magento\Email\Model\InfoFactory
-     */
-    protected $_emailInfoFactory;
-
-    /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $coreLocale
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Payment\Helper\Data $paymentData
@@ -248,19 +243,18 @@ class Invoice extends \Magento\Sales\Model\AbstractModel
      * @param \Magento\Sales\Model\Order\Invoice\Config $invoiceConfig
      * @param \Magento\Sales\Model\OrderFactory $orderFactory
      * @param \Magento\Sales\Model\Resource\OrderFactory $orderResourceFactory
-     * @param \Magento\Core\Model\CalculatorFactory $calculatorFactory
+     * @param \Magento\Math\CalculatorFactory $calculatorFactory
      * @param \Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory $invoiceItemCollectionFactory
      * @param \Magento\Sales\Model\Order\Invoice\CommentFactory $invoiceCommentFactory
      * @param \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $commentCollectionFactory
-     * @param \Magento\Email\Model\Template\MailerFactory $templateMailerFactory
-     * @param \Magento\Email\Model\InfoFactory $emailInfoFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $coreLocale,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Payment\Helper\Data $paymentData,
@@ -269,12 +263,11 @@ class Invoice extends \Magento\Sales\Model\AbstractModel
         \Magento\Sales\Model\Order\Invoice\Config $invoiceConfig,
         \Magento\Sales\Model\OrderFactory $orderFactory,
         \Magento\Sales\Model\Resource\OrderFactory $orderResourceFactory,
-        \Magento\Core\Model\CalculatorFactory $calculatorFactory,
+        \Magento\Math\CalculatorFactory $calculatorFactory,
         \Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory $invoiceItemCollectionFactory,
         \Magento\Sales\Model\Order\Invoice\CommentFactory $invoiceCommentFactory,
         \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $commentCollectionFactory,
-        \Magento\Email\Model\Template\MailerFactory $templateMailerFactory,
-        \Magento\Email\Model\InfoFactory $emailInfoFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
@@ -289,8 +282,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel
         $this->_invoiceItemCollectionFactory = $invoiceItemCollectionFactory;
         $this->_invoiceCommentFactory = $invoiceCommentFactory;
         $this->_commentCollectionFactory = $commentCollectionFactory;
-        $this->_templateMailerFactory = $templateMailerFactory;
-        $this->_emailInfoFactory = $emailInfoFactory;
+        $this->_transportBuilder = $transportBuilder;
         parent::__construct($context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data);
     }
 
@@ -600,7 +592,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel
     {
         if ($price) {
             if (!isset($this->_rounders[$type])) {
-                $this->_rounders[$type] = $this->_calculatorFactory->create(array('store' => $this->getStore()));
+                $this->_rounders[$type] = $this->_calculatorFactory->create(array('scope' => $this->getStore()));
             }
             $price = $this->_rounders[$type]->deltaRound($price, $negative);
         }
@@ -885,41 +877,58 @@ class Invoice extends \Magento\Sales\Model\AbstractModel
             $customerName = $order->getCustomerName();
         }
 
-        $mailer = $this->_templateMailerFactory->create();
         if ($notifyCustomer) {
-            $emailInfo = $this->_emailInfoFactory->create();
-            $emailInfo->addTo($order->getCustomerEmail(), $customerName);
+            $this->_transportBuilder
+                ->setTemplateIdentifier($templateId)
+                ->setTemplateOptions(array(
+                    'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                    'store' => $storeId
+                ))
+                ->setTemplateVars(array(
+                    'order'        => $order,
+                    'invoice'      => $this,
+                    'comment'      => $comment,
+                    'billing'      => $order->getBillingAddress(),
+                    'payment_html' => $paymentBlockHtml,
+                    'store'        => $this->getStore()
+                ))
+                ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId))
+                ->addTo($order->getCustomerEmail(), $customerName);
             if ($copyTo && $copyMethod == 'bcc') {
                 // Add bcc to customer email
                 foreach ($copyTo as $email) {
-                    $emailInfo->addBcc($email);
+                    $this->_transportBuilder->addBcc($email);
                 }
             }
-            $mailer->addEmailInfo($emailInfo);
+            /** @var \Magento\Mail\TransportInterface $transport */
+            $transport =  $this->_transportBuilder->getTransport();
+            $transport->sendMessage();
         }
 
         // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
         if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
             foreach ($copyTo as $email) {
-                $emailInfo = $this->_emailInfoFactory->create();
-                $emailInfo->addTo($email);
-                $mailer->addEmailInfo($emailInfo);
+                $this->_transportBuilder
+                    ->setTemplateIdentifier($templateId)
+                    ->setTemplateOptions(array(
+                        'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                        'store' => $storeId
+                    ))
+                    ->setTemplateVars(array(
+                        'order'        => $order,
+                        'invoice'      => $this,
+                        'comment'      => $comment,
+                        'billing'      => $order->getBillingAddress(),
+                        'payment_html' => $paymentBlockHtml,
+                        'store'        => $this->getStore()
+                    ))
+                    ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId))
+                    ->addTo($email)
+                    ->getTransport()
+                    ->sendMessage();
             }
         }
 
-        // Set all required params and send emails
-        $mailer->setSender($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
-        $mailer->setStoreId($storeId);
-        $mailer->setTemplateId($templateId);
-        $mailer->setTemplateParams(array(
-            'order'        => $order,
-            'invoice'      => $this,
-            'comment'      => $comment,
-            'billing'      => $order->getBillingAddress(),
-            'payment_html' => $paymentBlockHtml
-        ));
-        $mailer->send();
-
         $this->setEmailSent(true);
         $this->_getResource()->saveAttribute($this, 'email_sent');
 
@@ -958,41 +967,58 @@ class Invoice extends \Magento\Sales\Model\AbstractModel
             $customerName = $order->getCustomerName();
         }
 
-        $mailer = $this->_templateMailerFactory->create();
         if ($notifyCustomer) {
-            $emailInfo = $this->_emailInfoFactory->create();
-            $emailInfo->addTo($order->getCustomerEmail(), $customerName);
+            $this->_transportBuilder
+                ->setTemplateIdentifier($templateId)
+                ->setTemplateOptions(array(
+                    'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                    'store' => $storeId
+                ))
+                ->setTemplateVars(array(
+                    'order'        => $order,
+                    'invoice'      => $this,
+                    'comment'      => $comment,
+                    'billing'      => $order->getBillingAddress(),
+                    'store'        => $this->getStore()
+                ))
+                ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId))
+                ->addTo($order->getCustomerEmail(), $customerName);
             if ($copyTo && $copyMethod == 'bcc') {
                 // Add bcc to customer email
                 foreach ($copyTo as $email) {
-                    $emailInfo->addBcc($email);
+                    $this->_transportBuilder->addBcc($email);
                 }
             }
-            $mailer->addEmailInfo($emailInfo);
+            /** @var \Magento\Mail\TransportInterface $transport */
+            $transport =  $this->_transportBuilder->getTransport();
+            $transport->sendMessage();
         }
 
         // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
         if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
             foreach ($copyTo as $email) {
-                $emailInfo = $this->_emailInfoFactory->create();
-                $emailInfo->addTo($email);
-                $mailer->addEmailInfo($emailInfo);
+                $this->_transportBuilder
+                    ->setTemplateIdentifier($templateId)
+                    ->setTemplateOptions(array(
+                            'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                            'store' => $storeId
+                        )
+                    )
+                    ->setTemplateVars(array(
+                            'order'        => $order,
+                            'invoice'      => $this,
+                            'comment'      => $comment,
+                            'billing'      => $order->getBillingAddress(),
+                            'store'        => $this->getStore()
+                        )
+                    )
+                    ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId))
+                    ->addTo($email)
+                    ->getTransport()
+                    ->sendMessage();
             }
         }
 
-        // Set all required params and send emails
-        $mailer->setSender($this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId));
-        $mailer->setStoreId($storeId);
-        $mailer->setTemplateId($templateId);
-        $mailer->setTemplateParams(array(
-                'order'        => $order,
-                'invoice'      => $this,
-                'comment'      => $comment,
-                'billing'      => $order->getBillingAddress()
-            )
-        );
-        $mailer->send();
-
         return $this;
     }
 
diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php
index 50a5157a6be..64628808750 100644
--- a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php
+++ b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php
@@ -55,8 +55,8 @@ class Comment extends \Magento\Sales\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $coreLocale
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -65,8 +65,8 @@ class Comment extends \Magento\Sales\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $coreLocale,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Item.php b/app/code/Magento/Sales/Model/Order/Invoice/Item.php
index 65978f2f289..30d3e4124d6 100644
--- a/app/code/Magento/Sales/Model/Order/Invoice/Item.php
+++ b/app/code/Magento/Sales/Model/Order/Invoice/Item.php
@@ -107,16 +107,16 @@ class Item extends \Magento\Core\Model\AbstractModel
     protected $_orderItemFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Sales\Model\Order\ItemFactory $orderItemFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Sales/Model/Order/Item.php b/app/code/Magento/Sales/Model/Order/Item.php
index 3268e7fe886..95495281070 100644
--- a/app/code/Magento/Sales/Model/Order/Item.php
+++ b/app/code/Magento/Sales/Model/Order/Item.php
@@ -229,8 +229,8 @@ class Item extends \Magento\Core\Model\AbstractModel
     protected $_productFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Model\OrderFactory $orderFactory
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -238,8 +238,8 @@ class Item extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Sales\Model\OrderFactory $orderFactory,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php
index 35685edb651..8db6ead2fe1 100644
--- a/app/code/Magento/Sales/Model/Order/Payment.php
+++ b/app/code/Magento/Sales/Model/Order/Payment.php
@@ -198,8 +198,8 @@ class Payment extends \Magento\Payment\Model\Info
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Payment\Helper\Data $paymentData
      * @param \Magento\Encryption\EncryptorInterface $encryptor
      * @param \Magento\Sales\Model\Service\OrderFactory $serviceOrderFactory
@@ -211,8 +211,8 @@ class Payment extends \Magento\Payment\Model\Info
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Payment\Helper\Data $paymentData,
         \Magento\Encryption\EncryptorInterface $encryptor,
         \Magento\Sales\Model\Service\OrderFactory $serviceOrderFactory,
diff --git a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php
index fa482f8a053..1b06c6758f8 100644
--- a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php
+++ b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php
@@ -161,8 +161,8 @@ class Transaction extends \Magento\Core\Model\AbstractModel
     protected $_dateFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Model\Order\PaymentFactory $paymentFactory
      * @param \Magento\Sales\Model\OrderFactory $orderFactory
      * @param \Magento\Core\Model\DateFactory $dateFactory
@@ -171,8 +171,8 @@ class Transaction extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Sales\Model\Order\PaymentFactory $paymentFactory,
         \Magento\Sales\Model\OrderFactory $orderFactory,
         \Magento\Core\Model\DateFactory $dateFactory,
diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php
index 52700c71af8..568e29ba47a 100644
--- a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php
+++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php
@@ -84,8 +84,8 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel
     protected $filterManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\App\Filesystem $filesystem ,
      * @param \Magento\Filter\FilterManager $filterManager
@@ -94,8 +94,8 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\App\Filesystem $filesystem,
         \Magento\Filter\FilterManager $filterManager,
diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php
index e66e3689e6e..db590a5c9b3 100644
--- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php
+++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php
@@ -39,8 +39,8 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte
     protected $string;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\App\Filesystem $filesystem
      * @param \Magento\Filter\FilterManager $filterManager
@@ -50,8 +50,8 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\App\Filesystem $filesystem,
         \Magento\Filter\FilterManager $filterManager,
diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php
index ea9e408dc51..441900cabc0 100644
--- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php
+++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php
@@ -34,13 +34,13 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems
     /**
      * Core string
      *
-     * @var \Magento\Core\Helper\String
+     * @var \Magento\Stdlib\String
      */
     protected $string;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\App\Filesystem $filesystem
      * @param \Magento\Filter\FilterManager $filterManager
@@ -50,8 +50,8 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\App\Filesystem $filesystem,
         \Magento\Filter\FilterManager $filterManager,
diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php
index b51d13f24fc..08eb72a9e68 100644
--- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php
+++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php
@@ -39,8 +39,8 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems
     protected $string;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\App\Filesystem $filesystem
      * @param \Magento\Filter\FilterManager $filterManager
@@ -50,8 +50,8 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\App\Filesystem $filesystem,
         \Magento\Filter\FilterManager $filterManager,
diff --git a/app/code/Magento/Sales/Model/Order/Shipment.php b/app/code/Magento/Sales/Model/Order/Shipment.php
index 13b39a63e2d..e85d02519d4 100644
--- a/app/code/Magento/Sales/Model/Order/Shipment.php
+++ b/app/code/Magento/Sales/Model/Order/Shipment.php
@@ -147,18 +147,13 @@ class Shipment extends \Magento\Sales\Model\AbstractModel
     protected $_commentCollectionFactory;
 
     /**
-     * @var \Magento\Email\Model\Template\MailerFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_templateMailerFactory;
+    protected $_transportBuilder;
 
     /**
-     * @var \Magento\Email\Model\InfoFactory
-     */
-    protected $_emailInfoFactory;
-
-    /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $coreLocale
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Payment\Helper\Data $paymentData
@@ -169,15 +164,14 @@ class Shipment extends \Magento\Sales\Model\AbstractModel
      * @param \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory
      * @param \Magento\Sales\Model\Order\Shipment\CommentFactory $commentFactory
      * @param \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $commentCollectionFactory
-     * @param \Magento\Email\Model\Template\MailerFactory $templateMailerFactory
-     * @param \Magento\Email\Model\InfoFactory $emailInfoFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $coreLocale,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Payment\Helper\Data $paymentData,
@@ -188,8 +182,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel
         \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory,
         \Magento\Sales\Model\Order\Shipment\CommentFactory $commentFactory,
         \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $commentCollectionFactory,
-        \Magento\Email\Model\Template\MailerFactory $templateMailerFactory,
-        \Magento\Email\Model\InfoFactory $emailInfoFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
@@ -202,8 +195,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel
         $this->_trackCollectionFactory = $trackCollectionFactory;
         $this->_commentFactory = $commentFactory;
         $this->_commentCollectionFactory = $commentCollectionFactory;
-        $this->_templateMailerFactory = $templateMailerFactory;
-        $this->_emailInfoFactory = $emailInfoFactory;
+        $this->_transportBuilder = $transportBuilder;
         parent::__construct($context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data);
     }
 
@@ -540,43 +532,58 @@ class Shipment extends \Magento\Sales\Model\AbstractModel
             $customerName = $order->getCustomerName();
         }
 
-        /** @var $mailer \Magento\Email\Model\Template\Mailer */
-        $mailer = $this->_templateMailerFactory->create();
         if ($notifyCustomer) {
-            $emailInfo = $this->_emailInfoFactory->create();
-            $emailInfo->addTo($order->getCustomerEmail(), $customerName);
+            $this->_transportBuilder
+                ->setTemplateIdentifier($templateId)
+                ->setTemplateOptions(array(
+                    'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                    'store' => $storeId
+                ))
+                ->setTemplateVars(array(
+                    'order'        => $order,
+                    'shipment'     => $this,
+                    'comment'      => $comment,
+                    'billing'      => $order->getBillingAddress(),
+                    'payment_html' => $paymentBlockHtml,
+                    'store'        => $this->getStore()
+                ))
+                ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId))
+                ->addTo($order->getCustomerEmail(), $customerName);
             if ($copyTo && $copyMethod == 'bcc') {
                 // Add bcc to customer email
                 foreach ($copyTo as $email) {
-                    $emailInfo->addBcc($email);
+                    $this->_transportBuilder->addBcc($email);
                 }
             }
-            $mailer->addEmailInfo($emailInfo);
+            /** @var \Magento\Mail\TransportInterface $transport */
+            $transport =  $this->_transportBuilder->getTransport();
+            $transport->sendMessage();
         }
 
         // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
         if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
             foreach ($copyTo as $email) {
-                $emailInfo = $this->_emailInfoFactory->create();
-                $emailInfo->addTo($email);
-                $mailer->addEmailInfo($emailInfo);
+                $this->_transportBuilder
+                    ->setTemplateIdentifier($templateId)
+                    ->setTemplateOptions(array(
+                        'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                        'store' => $storeId
+                    ))
+                    ->setTemplateVars(array(
+                        'order'        => $order,
+                        'shipment'     => $this,
+                        'comment'      => $comment,
+                        'billing'      => $order->getBillingAddress(),
+                        'payment_html' => $paymentBlockHtml,
+                        'store'        => $this->getStore()
+                    ))
+                    ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId))
+                    ->addTo($email)
+                    ->getTransport()
+                    ->sendMessage();
             }
         }
 
-        // Set all required params and send emails
-        $mailer->setSender($this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
-        $mailer->setStoreId($storeId);
-        $mailer->setTemplateId($templateId);
-        $mailer->setTemplateParams(array(
-                'order'        => $order,
-                'shipment'     => $this,
-                'comment'      => $comment,
-                'billing'      => $order->getBillingAddress(),
-                'payment_html' => $paymentBlockHtml
-            )
-        );
-        $mailer->send();
-
         $this->setEmailSent(true);
         $this->_getResource()->saveAttribute($this, 'email_sent');
 
@@ -615,41 +622,56 @@ class Shipment extends \Magento\Sales\Model\AbstractModel
             $customerName = $order->getCustomerName();
         }
 
-        $mailer = $this->_templateMailerFactory->create();
         if ($notifyCustomer) {
-            $emailInfo = $this->_emailInfoFactory->create();
-            $emailInfo->addTo($order->getCustomerEmail(), $customerName);
+            $this->_transportBuilder
+                ->setTemplateIdentifier($templateId)
+                ->setTemplateOptions(array(
+                    'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                    'store' => $storeId
+                ))
+                ->setTemplateVars(array(
+                    'order'    => $order,
+                    'shipment' => $this,
+                    'comment'  => $comment,
+                    'billing'  => $order->getBillingAddress(),
+                    'store'    => $this->getStore()
+                ))
+                ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId))
+                ->addTo($order->getCustomerEmail(), $customerName);
             if ($copyTo && $copyMethod == 'bcc') {
                 // Add bcc to customer email
                 foreach ($copyTo as $email) {
-                    $emailInfo->addBcc($email);
+                    $this->_transportBuilder->addBcc($email);
                 }
             }
-            $mailer->addEmailInfo($emailInfo);
+            /** @var \Magento\Mail\TransportInterface $transport */
+            $transport =  $this->_transportBuilder->getTransport();
+            $transport->sendMessage();
         }
 
         // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
         if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
             foreach ($copyTo as $email) {
-                $emailInfo = $this->_emailInfoFactory->create();
-                $emailInfo->addTo($email);
-                $mailer->addEmailInfo($emailInfo);
+                $this->_transportBuilder
+                    ->setTemplateIdentifier($templateId)
+                    ->setTemplateOptions(array(
+                        'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                        'store' => $storeId
+                    ))
+                    ->setTemplateVars(array(
+                        'order'    => $order,
+                        'shipment' => $this,
+                        'comment'  => $comment,
+                        'billing'  => $order->getBillingAddress(),
+                        'store'    => $this->getStore()
+                    ))
+                    ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId))
+                    ->addTo($email)
+                    ->getTransport()
+                    ->sendMessage();
             }
         }
 
-        // Set all required params and send emails
-        $mailer->setSender($this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId));
-        $mailer->setStoreId($storeId);
-        $mailer->setTemplateId($templateId);
-        $mailer->setTemplateParams(array(
-                'order'    => $order,
-                'shipment' => $this,
-                'comment'  => $comment,
-                'billing'  => $order->getBillingAddress()
-            )
-        );
-        $mailer->send();
-
         return $this;
     }
 
diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php
index 9a3ca642a57..310baef559d 100644
--- a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php
+++ b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php
@@ -55,8 +55,8 @@ class Comment extends \Magento\Sales\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $coreLocale
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -65,8 +65,8 @@ class Comment extends \Magento\Sales\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $coreLocale,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Item.php b/app/code/Magento/Sales/Model/Order/Shipment/Item.php
index 480a0bf1fa5..9be2d395b0c 100644
--- a/app/code/Magento/Sales/Model/Order/Shipment/Item.php
+++ b/app/code/Magento/Sales/Model/Order/Shipment/Item.php
@@ -65,16 +65,16 @@ class Item extends \Magento\Core\Model\AbstractModel
     protected $_orderItemFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Sales\Model\Order\ItemFactory $orderItemFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Track.php b/app/code/Magento/Sales/Model/Order/Shipment/Track.php
index 9a16ef629bc..fc03636c548 100644
--- a/app/code/Magento/Sales/Model/Order/Shipment/Track.php
+++ b/app/code/Magento/Sales/Model/Order/Shipment/Track.php
@@ -75,8 +75,8 @@ class Track extends \Magento\Sales\Model\AbstractModel
     protected $_shipmentFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $coreLocale
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -86,8 +86,8 @@ class Track extends \Magento\Sales\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $coreLocale,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
diff --git a/app/code/Magento/Sales/Model/Order/Status.php b/app/code/Magento/Sales/Model/Order/Status.php
index e349ce87f58..ab381556aab 100644
--- a/app/code/Magento/Sales/Model/Order/Status.php
+++ b/app/code/Magento/Sales/Model/Order/Status.php
@@ -34,16 +34,16 @@ class Status extends \Magento\Core\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Sales/Model/Order/Status/History.php b/app/code/Magento/Sales/Model/Order/Status/History.php
index 51005bc149d..b595e72ca1a 100644
--- a/app/code/Magento/Sales/Model/Order/Status/History.php
+++ b/app/code/Magento/Sales/Model/Order/Status/History.php
@@ -63,8 +63,8 @@ class History extends \Magento\Sales\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $coreLocale
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -73,8 +73,8 @@ class History extends \Magento\Sales\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $coreLocale,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
diff --git a/app/code/Magento/Sales/Model/Quote.php b/app/code/Magento/Sales/Model/Quote.php
index d93d1bca627..f7c75f0be7b 100644
--- a/app/code/Magento/Sales/Model/Quote.php
+++ b/app/code/Magento/Sales/Model/Quote.php
@@ -18,12 +18,16 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Sales
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\Sales\Model;
+
+use Magento\Sales\Model\Quote\Address;
+use Magento\Customer\Service\V1\Dto\Address as AddressDto;
+use Magento\Customer\Service\V1\Dto\Customer as CustomerDto;
+
 /**
  * Quote model
  *
@@ -34,106 +38,102 @@
  *  sales_quote_delete_before
  *  sales_quote_delete_after
  *
- * @method \Magento\Sales\Model\Resource\Quote _getResource()
- * @method \Magento\Sales\Model\Resource\Quote getResource()
- * @method \Magento\Sales\Model\Quote setStoreId(int $value)
+ * @method Quote setStoreId(int $value)
  * @method string getCreatedAt()
- * @method \Magento\Sales\Model\Quote setCreatedAt(string $value)
+ * @method Quote setCreatedAt(string $value)
  * @method string getUpdatedAt()
- * @method \Magento\Sales\Model\Quote setUpdatedAt(string $value)
+ * @method Quote setUpdatedAt(string $value)
  * @method string getConvertedAt()
- * @method \Magento\Sales\Model\Quote setConvertedAt(string $value)
+ * @method Quote setConvertedAt(string $value)
  * @method int getIsActive()
- * @method \Magento\Sales\Model\Quote setIsActive(int $value)
- * @method \Magento\Sales\Model\Quote setIsVirtual(int $value)
+ * @method Quote setIsActive(int $value)
+ * @method Quote setIsVirtual(int $value)
  * @method int getIsMultiShipping()
- * @method \Magento\Sales\Model\Quote setIsMultiShipping(int $value)
+ * @method Quote setIsMultiShipping(int $value)
  * @method int getItemsCount()
- * @method \Magento\Sales\Model\Quote setItemsCount(int $value)
+ * @method Quote setItemsCount(int $value)
  * @method float getItemsQty()
- * @method \Magento\Sales\Model\Quote setItemsQty(float $value)
+ * @method Quote setItemsQty(float $value)
  * @method int getOrigOrderId()
- * @method \Magento\Sales\Model\Quote setOrigOrderId(int $value)
+ * @method Quote setOrigOrderId(int $value)
  * @method float getStoreToBaseRate()
- * @method \Magento\Sales\Model\Quote setStoreToBaseRate(float $value)
+ * @method Quote setStoreToBaseRate(float $value)
  * @method float getStoreToQuoteRate()
- * @method \Magento\Sales\Model\Quote setStoreToQuoteRate(float $value)
+ * @method Quote setStoreToQuoteRate(float $value)
  * @method string getBaseCurrencyCode()
- * @method \Magento\Sales\Model\Quote setBaseCurrencyCode(string $value)
+ * @method Quote setBaseCurrencyCode(string $value)
  * @method string getStoreCurrencyCode()
- * @method \Magento\Sales\Model\Quote setStoreCurrencyCode(string $value)
+ * @method Quote setStoreCurrencyCode(string $value)
  * @method string getQuoteCurrencyCode()
- * @method \Magento\Sales\Model\Quote setQuoteCurrencyCode(string $value)
+ * @method Quote setQuoteCurrencyCode(string $value)
  * @method float getGrandTotal()
- * @method \Magento\Sales\Model\Quote setGrandTotal(float $value)
+ * @method Quote setGrandTotal(float $value)
  * @method float getBaseGrandTotal()
- * @method \Magento\Sales\Model\Quote setBaseGrandTotal(float $value)
- * @method \Magento\Sales\Model\Quote setCheckoutMethod(string $value)
+ * @method Quote setBaseGrandTotal(float $value)
+ * @method Quote setCheckoutMethod(string $value)
  * @method int getCustomerId()
- * @method \Magento\Sales\Model\Quote setCustomerId(int $value)
- * @method \Magento\Sales\Model\Quote setCustomerTaxClassId(int $value)
- * @method \Magento\Sales\Model\Quote setCustomerGroupId(int $value)
+ * @method Quote setCustomerId(int $value)
+ * @method Quote setCustomerTaxClassId(int $value)
+ * @method Quote setCustomerGroupId(int $value)
  * @method string getCustomerEmail()
- * @method \Magento\Sales\Model\Quote setCustomerEmail(string $value)
+ * @method Quote setCustomerEmail(string $value)
  * @method string getCustomerPrefix()
- * @method \Magento\Sales\Model\Quote setCustomerPrefix(string $value)
+ * @method Quote setCustomerPrefix(string $value)
  * @method string getCustomerFirstname()
- * @method \Magento\Sales\Model\Quote setCustomerFirstname(string $value)
+ * @method Quote setCustomerFirstname(string $value)
  * @method string getCustomerMiddlename()
- * @method \Magento\Sales\Model\Quote setCustomerMiddlename(string $value)
+ * @method Quote setCustomerMiddlename(string $value)
  * @method string getCustomerLastname()
- * @method \Magento\Sales\Model\Quote setCustomerLastname(string $value)
+ * @method Quote setCustomerLastname(string $value)
  * @method string getCustomerSuffix()
- * @method \Magento\Sales\Model\Quote setCustomerSuffix(string $value)
+ * @method Quote setCustomerSuffix(string $value)
  * @method string getCustomerDob()
- * @method \Magento\Sales\Model\Quote setCustomerDob(string $value)
+ * @method Quote setCustomerDob(string $value)
  * @method string getCustomerNote()
- * @method \Magento\Sales\Model\Quote setCustomerNote(string $value)
+ * @method Quote setCustomerNote(string $value)
  * @method int getCustomerNoteNotify()
- * @method \Magento\Sales\Model\Quote setCustomerNoteNotify(int $value)
+ * @method Quote setCustomerNoteNotify(int $value)
  * @method int getCustomerIsGuest()
- * @method \Magento\Sales\Model\Quote setCustomerIsGuest(int $value)
+ * @method Quote setCustomerIsGuest(int $value)
  * @method string getRemoteIp()
- * @method \Magento\Sales\Model\Quote setRemoteIp(string $value)
+ * @method Quote setRemoteIp(string $value)
  * @method string getAppliedRuleIds()
- * @method \Magento\Sales\Model\Quote setAppliedRuleIds(string $value)
+ * @method Quote setAppliedRuleIds(string $value)
  * @method string getReservedOrderId()
- * @method \Magento\Sales\Model\Quote setReservedOrderId(string $value)
+ * @method Quote setReservedOrderId(string $value)
  * @method string getPasswordHash()
- * @method \Magento\Sales\Model\Quote setPasswordHash(string $value)
+ * @method Quote setPasswordHash(string $value)
  * @method string getCouponCode()
- * @method \Magento\Sales\Model\Quote setCouponCode(string $value)
+ * @method Quote setCouponCode(string $value)
  * @method string getGlobalCurrencyCode()
- * @method \Magento\Sales\Model\Quote setGlobalCurrencyCode(string $value)
+ * @method Quote setGlobalCurrencyCode(string $value)
  * @method float getBaseToGlobalRate()
- * @method \Magento\Sales\Model\Quote setBaseToGlobalRate(float $value)
+ * @method Quote setBaseToGlobalRate(float $value)
  * @method float getBaseToQuoteRate()
- * @method \Magento\Sales\Model\Quote setBaseToQuoteRate(float $value)
+ * @method Quote setBaseToQuoteRate(float $value)
  * @method string getCustomerTaxvat()
- * @method \Magento\Sales\Model\Quote setCustomerTaxvat(string $value)
+ * @method Quote setCustomerTaxvat(string $value)
  * @method string getCustomerGender()
- * @method \Magento\Sales\Model\Quote setCustomerGender(string $value)
+ * @method Quote setCustomerGender(string $value)
  * @method float getSubtotal()
- * @method \Magento\Sales\Model\Quote setSubtotal(float $value)
+ * @method Quote setSubtotal(float $value)
  * @method float getBaseSubtotal()
- * @method \Magento\Sales\Model\Quote setBaseSubtotal(float $value)
+ * @method Quote setBaseSubtotal(float $value)
  * @method float getSubtotalWithDiscount()
- * @method \Magento\Sales\Model\Quote setSubtotalWithDiscount(float $value)
+ * @method Quote setSubtotalWithDiscount(float $value)
  * @method float getBaseSubtotalWithDiscount()
- * @method \Magento\Sales\Model\Quote setBaseSubtotalWithDiscount(float $value)
+ * @method Quote setBaseSubtotalWithDiscount(float $value)
  * @method int getIsChanged()
- * @method \Magento\Sales\Model\Quote setIsChanged(int $value)
+ * @method Quote setIsChanged(int $value)
  * @method int getTriggerRecollect()
- * @method \Magento\Sales\Model\Quote setTriggerRecollect(int $value)
+ * @method Quote setTriggerRecollect(int $value)
  * @method string getExtShippingInfo()
- * @method \Magento\Sales\Model\Quote setExtShippingInfo(string $value)
+ * @method Quote setExtShippingInfo(string $value)
  * @method int getGiftMessageId()
- * @method \Magento\Sales\Model\Quote setGiftMessageId(int $value)
+ * @method Quote setGiftMessageId(int $value)
  * @method bool|null getIsPersistent()
- * @method \Magento\Sales\Model\Quote setIsPersistent(bool $value)
+ * @method Quote setIsPersistent(bool $value)
  */
-namespace Magento\Sales\Model;
-
 class Quote extends \Magento\Core\Model\AbstractModel
 {
     /**
@@ -275,18 +275,27 @@ class Quote extends \Magento\Core\Model\AbstractModel
     protected $_quotePaymentCollectionFactory;
 
     /**
-     * @var \Magento\RecurringProfile\Model\Profile
+     * @var \Magento\Object\Copy
      */
-    protected $_recurringProfileFactory;
+    protected $_objectCopyService;
 
     /**
-     * @var \Magento\Object\Copy
+     * @var CustomerDto
      */
-    protected $_objectCopyService;
+    protected $_customerData;
+
+    /** @var \Magento\Customer\Model\Converter */
+    protected $_converter;
+
+    /** @var \Magento\Customer\Service\V1\CustomerAddressService */
+    protected $_addressService;
+
+    /** @var \Magento\Customer\Model\Address\Converter */
+    protected $_addressConverter;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Helper\Data $salesData
      * @param \Magento\Catalog\Helper\Product $catalogProduct
      * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig
@@ -302,15 +311,17 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\Sales\Model\Quote\PaymentFactory $quotePaymentFactory
      * @param \Magento\Sales\Model\Resource\Quote\Payment\CollectionFactory $quotePaymentCollectionFactory
-     * @param \Magento\RecurringProfile\Model\ProfileFactory $recurringProfileFactory
      * @param \Magento\Object\Copy $objectCopyService
+     * @param \Magento\Customer\Model\Converter $converter
+     * @param \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService
+     * @param \Magento\Customer\Model\Address\Converter $addressConverter
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Sales\Helper\Data $salesData,
         \Magento\Catalog\Helper\Product $catalogProduct,
         \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig,
@@ -326,8 +337,10 @@ class Quote extends \Magento\Core\Model\AbstractModel
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\Sales\Model\Quote\PaymentFactory $quotePaymentFactory,
         \Magento\Sales\Model\Resource\Quote\Payment\CollectionFactory $quotePaymentCollectionFactory,
-        \Magento\RecurringProfile\Model\ProfileFactory $recurringProfileFactory,
         \Magento\Object\Copy $objectCopyService,
+        \Magento\Customer\Model\Converter $converter,
+        \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService,
+        \Magento\Customer\Model\Address\Converter $addressConverter,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
@@ -347,8 +360,10 @@ class Quote extends \Magento\Core\Model\AbstractModel
         $this->_productFactory = $productFactory;
         $this->_quotePaymentFactory = $quotePaymentFactory;
         $this->_quotePaymentCollectionFactory = $quotePaymentCollectionFactory;
-        $this->_recurringProfileFactory = $recurringProfileFactory;
         $this->_objectCopyService = $objectCopyService;
+        $this->_converter = $converter;
+        $this->_addressService = $addressService;
+        $this->_addressConverter = $addressConverter;
         parent::__construct($context, $registry, $resource, $resourceCollection, $data);
     }
 
@@ -386,8 +401,8 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Declare quote store model
      *
-     * @param   \Magento\Core\Model\Store $store
-     * @return  \Magento\Sales\Model\Quote
+     * @param \Magento\Core\Model\Store $store
+     * @return $this
      */
     public function setStore(\Magento\Core\Model\Store $store)
     {
@@ -416,7 +431,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Prepare data before save
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     protected function _beforeSave()
     {
@@ -469,7 +484,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Save related items
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     protected function _afterSave()
     {
@@ -493,10 +508,11 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * Loading quote data by customer
      *
      * @param \Magento\Customer\Model\Customer|int $customer
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function loadByCustomer($customer)
     {
+        /* @TODO: remove this if after external usages of loadByCustomer are refactored in MAGETWO-19935 */
         if ($customer instanceof \Magento\Customer\Model\Customer) {
             $customerId = $customer->getId();
         } else {
@@ -511,7 +527,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * Loading only active quote
      *
      * @param int $quoteId
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function loadActive($quoteId)
     {
@@ -524,7 +540,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * Loading quote by identifier
      *
      * @param int $quoteId
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function loadByIdWithoutStore($quoteId)
     {
@@ -536,27 +552,33 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Assign customer model object data to quote
      *
-     * @param   \Magento\Customer\Model\Customer $customer
-     * @return  \Magento\Sales\Model\Quote
+     * @param   CustomerDto|\Magento\Customer\Model\Customer $customer
+     * @return $this
      */
-    public function assignCustomer(\Magento\Customer\Model\Customer $customer)
+    public function assignCustomer($customer)
     {
+        /* @TODO: refactor input type hint after external usages of assignCustomer are refactored in MAGETWO-19930 */
         return $this->assignCustomerWithAddressChange($customer);
     }
 
     /**
      * Assign customer model to quote with billing and shipping address change
      *
-     * @param  \Magento\Customer\Model\Customer    $customer
-     * @param  \Magento\Sales\Model\Quote\Address  $billingAddress
-     * @param  \Magento\Sales\Model\Quote\Address  $shippingAddress
-     * @return \Magento\Sales\Model\Quote
+     * @param  CustomerDto|\Magento\Customer\Model\Customer $customer
+     * @param  Address $billingAddress
+     * @param  Address $shippingAddress
+     * @return $this
      */
     public function assignCustomerWithAddressChange(
-        \Magento\Customer\Model\Customer    $customer,
-        \Magento\Sales\Model\Quote\Address  $billingAddress  = null,
-        \Magento\Sales\Model\Quote\Address  $shippingAddress = null
+        $customer,
+        Address $billingAddress = null,
+        Address $shippingAddress = null
     ) {
+        /* @TODO: refactor this once all the usages of assignCustomerWithAddressChange are refactored MAGETWO-19930 */
+        if ($customer instanceof CustomerDto) {
+            $customer = $this->_converter->createCustomerModel($customer);
+        }
+
         if ($customer->getId()) {
             $this->setCustomer($customer);
 
@@ -590,10 +612,11 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * Define customer object
      *
      * @param   \Magento\Customer\Model\Customer $customer
-     * @return  \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function setCustomer(\Magento\Customer\Model\Customer $customer)
     {
+        /* @TODO: Remove the method after all external usages are refactored in MAGETWO-19930 */
         $this->_customer = $customer;
         $this->setCustomerId($customer->getId());
         $this->_objectCopyService->copyFieldsetToTarget('customer_account', 'to_quote', $customer, $this);
@@ -607,6 +630,10 @@ class Quote extends \Magento\Core\Model\AbstractModel
      */
     public function getCustomer()
     {
+        /**
+         * @TODO: Remove the method after all external usages are refactored in MAGETWO-19930
+         * _customer and _customerFactory variables should be eliminated as well
+         */
         if (null === $this->_customer) {
             $this->_customer = $this->_customerFactory->create();
             $customerId = $this->getCustomerId();
@@ -620,6 +647,102 @@ class Quote extends \Magento\Core\Model\AbstractModel
         return $this->_customer;
     }
 
+    /**
+     * Retrieve customer data object
+     *
+     * @return CustomerDto
+     */
+    public function getCustomerData()
+    {
+        /* @TODO: remove this code in favor of setCustomerData usage MAGETWO-19930 */
+        $customerModel = $this->getCustomer();
+        return $this->_converter->createCustomerFromModel($customerModel);
+    }
+
+    /**
+     * Set customer data object
+     *
+     * @param CustomerDto $customerData
+     * @return $this
+     */
+    public function setCustomerData(CustomerDto $customerData)
+    {
+        /* @TODO: remove model usage in favor of DTO in scope of MAGETWO-19930 */
+        $customer = $this->_customerFactory->create();
+        $customer->setData($customerData->getAttributes());
+        $customer->setId($customerData->getCustomerId());
+        $this->setCustomer($customer);
+        return $this;
+    }
+
+    /**
+     * Substitute customer addresses
+     *
+     * @param AddressDto[] $addresses
+     * @return $this
+     */
+    public function setCustomerAddressData(array $addresses)
+    {
+        $this->getCustomer()->getAddressesCollection()->removeAllItems();
+        foreach ($addresses as $address) {
+            $this->addCustomerAddressData($address);
+        }
+
+        return $this;
+    }
+
+    /**
+     * Add address to the customer, created out of a DTO
+     *
+     * TODO refactor in scope of MAGETWO-19930
+     *
+     * @param AddressDto $address
+     * @return $this
+     */
+    public function addCustomerAddressData(AddressDto $address)
+    {
+        $this->getCustomer()->addAddress($this->_addressConverter->createAddressModel($address));
+
+        return $this;
+    }
+
+    /**
+     * Get DTO addresses of the customer
+     *
+     * TODO: Refactor to use addressDto property is used insead of customer model MAGETWO-19930
+     *
+     * @return AddressDto[]
+     */
+    public function getCustomerAddressData()
+    {
+        $customer = $this->getCustomerData();
+        $addresses = $this->getCustomer()->getAddresses();
+        $addressDtos = [];
+        foreach ($addresses as $address) {
+            $addressDtos[] = $this->_addressConverter->createAddressFromModel(
+                $address,
+                $customer->getDefaultBilling(),
+                $customer->getDefaultShipping()
+            );
+        }
+        return $addressDtos;
+    }
+
+    /**
+     * Update customer data object
+     *
+     * @param CustomerDto $customerData
+     * @return $this
+     */
+    public function updateCustomerData(CustomerDto $customerData)
+    {
+        $customer = $this->getCustomer();
+        /* @TODO: remove this code in favor of customer DTO usage MAGETWO-19930 */
+        $this->_converter->updateCustomerModel($customer, $customerData);
+        $this->setCustomer($customer);
+        return $this;
+    }
+
     /**
      * Retrieve customer group id
      *
@@ -632,6 +755,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
         } elseif ($this->getCustomerId()) {
             return $this->getCustomer()->getGroupId();
         } else {
+            /** TODO: Magento\Customer\Model\Group usage should be eliminated in scope of MAGETWO-21105 */
             return \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID;
         }
     }
@@ -646,6 +770,10 @@ class Quote extends \Magento\Core\Model\AbstractModel
          * we need to retrieve from db every time to get the correct tax class
          */
         //if (!$this->getData('customer_group_id') && !$this->getData('customer_tax_class_id')) {
+        /**
+         * TODO: Magento\Customer\Model\GroupFactory usage should be eliminated in scope of MAGETWO-21105
+         * _customerGroupFactory should be removed as well
+         */
         $classId = $this->_customerGroupFactory->create()->getTaxClassId($this->getCustomerGroupId());
         $this->setCustomerTaxClassId($classId);
         //}
@@ -677,7 +805,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * Retrieve quote address by type
      *
      * @param   string $type
-     * @return  \Magento\Sales\Model\Quote\Address
+     * @return  Address
      */
     protected function _getAddressByType($type)
     {
@@ -695,21 +823,21 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Retrieve quote billing address
      *
-     * @return \Magento\Sales\Model\Quote\Address
+     * @return Address
      */
     public function getBillingAddress()
     {
-        return $this->_getAddressByType(\Magento\Sales\Model\Quote\Address::TYPE_BILLING);
+        return $this->_getAddressByType(Address::TYPE_BILLING);
     }
 
     /**
      * Retrieve quote shipping address
      *
-     * @return \Magento\Sales\Model\Quote\Address
+     * @return Address
      */
     public function getShippingAddress()
     {
-        return $this->_getAddressByType(\Magento\Sales\Model\Quote\Address::TYPE_SHIPPING);
+        return $this->_getAddressByType(Address::TYPE_SHIPPING);
     }
 
     /**
@@ -719,7 +847,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     {
         $addresses = array();
         foreach ($this->getAddressesCollection() as $address) {
-            if ($address->getAddressType() == \Magento\Sales\Model\Quote\Address::TYPE_SHIPPING
+            if ($address->getAddressType() == Address::TYPE_SHIPPING
                 && !$address->isDeleted()
             ) {
                 $addresses[] = $address;
@@ -745,7 +873,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      *
      * @param int $addressId
-     * @return \Magento\Sales\Model\Quote\Address
+     * @return Address
      */
     public function getAddressById($addressId)
     {
@@ -772,13 +900,16 @@ class Quote extends \Magento\Core\Model\AbstractModel
     }
 
     /**
+     * Get quote address by customer address ID.
+     *
      * @param int|string $addressId
-     * @return bool
+     * @return \Magento\Sales\Model\Quote\Address|bool
      */
     public function getShippingAddressByCustomerAddressId($addressId)
     {
+        /** @var \Magento\Sales\Model\Quote\Address $address */
         foreach ($this->getAddressesCollection() as $address) {
-            if (!$address->isDeleted() && $address->getAddressType() == \Magento\Sales\Model\Quote\Address::TYPE_SHIPPING
+            if (!$address->isDeleted() && $address->getAddressType() == Address::TYPE_SHIPPING
                 && $address->getCustomerAddressId() == $addressId
             ) {
                 return $address;
@@ -805,7 +936,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Leave no more than one billing and one shipping address, fill them with default data
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function removeAllAddresses()
     {
@@ -840,10 +971,10 @@ class Quote extends \Magento\Core\Model\AbstractModel
     }
 
     /**
-     * @param \Magento\Sales\Model\Quote\Address $address
+     * @param Address $address
      * @return $this
      */
-    public function addAddress(\Magento\Sales\Model\Quote\Address $address)
+    public function addAddress(Address $address)
     {
         $address->setQuote($this);
         if (!$address->getId()) {
@@ -853,17 +984,17 @@ class Quote extends \Magento\Core\Model\AbstractModel
     }
 
     /**
-     * @param \Magento\Sales\Model\Quote\Address $address
-     * @return \Magento\Sales\Model\Quote
+     * @param Address $address
+     * @return $this
      */
-    public function setBillingAddress(\Magento\Sales\Model\Quote\Address $address)
+    public function setBillingAddress(Address $address)
     {
         $old = $this->getBillingAddress();
 
         if (!empty($old)) {
             $old->addData($address->getData());
         } else {
-            $this->addAddress($address->setAddressType(\Magento\Sales\Model\Quote\Address::TYPE_BILLING));
+            $this->addAddress($address->setAddressType(Address::TYPE_BILLING));
         }
         return $this;
     }
@@ -871,29 +1002,29 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Set shipping address
      *
-     * @param \Magento\Sales\Model\Quote\Address $address
-     * @return \Magento\Sales\Model\Quote
+     * @param Address $address
+     * @return $this
      */
-    public function setShippingAddress(\Magento\Sales\Model\Quote\Address $address)
+    public function setShippingAddress(Address $address)
     {
         if ($this->getIsMultiShipping()) {
-            $this->addAddress($address->setAddressType(\Magento\Sales\Model\Quote\Address::TYPE_SHIPPING));
+            $this->addAddress($address->setAddressType(Address::TYPE_SHIPPING));
         } else {
             $old = $this->getShippingAddress();
             if (!empty($old)) {
                 $old->addData($address->getData());
             } else {
-                $this->addAddress($address->setAddressType(\Magento\Sales\Model\Quote\Address::TYPE_SHIPPING));
+                $this->addAddress($address->setAddressType(Address::TYPE_SHIPPING));
             }
         }
         return $this;
     }
 
     /**
-     * @param \Magento\Sales\Model\Quote\Address $address
+     * @param Address $address
      * @return $this
      */
-    public function addShippingAddress(\Magento\Sales\Model\Quote\Address $address)
+    public function addShippingAddress(Address $address)
     {
         $this->setShippingAddress($address);
         return $this;
@@ -936,7 +1067,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Get array of all items what can be display directly
      *
-     * @return array
+     * @return \Magento\Sales\Model\Quote\Item[]
      */
     public function getAllVisibleItems()
     {
@@ -1008,7 +1139,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * Delete quote item. If it does not have identifier then it will be only removed from collection
      *
      * @param   \Magento\Sales\Model\Quote\Item $item
-     * @return  \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function deleteItem(\Magento\Sales\Model\Quote\Item $item)
     {
@@ -1038,7 +1169,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * Remove quote item by item identifier
      *
      * @param   int $itemId
-     * @return  \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function removeItem($itemId)
     {
@@ -1071,7 +1202,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Mark all quote items as deleted (empty quote)
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function removeAllItems()
     {
@@ -1089,7 +1220,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * Adding new item to quote
      *
      * @param   \Magento\Sales\Model\Quote\Item $item
-     * @return  \Magento\Sales\Model\Quote
+     * @return $this
      * @throws \Magento\Core\Exception
      */
     public function addItem(\Magento\Sales\Model\Quote\Item $item)
@@ -1497,7 +1628,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Collect totals
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function collectTotals()
     {
@@ -1558,7 +1689,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Collect items qty
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     protected function _collectItemsQtys()
     {
@@ -1624,7 +1755,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
 
         $sortedTotals = array();
         foreach ($this->getBillingAddress()->getTotalCollector()->getRetrievers() as $total) {
-            /* @var $total \Magento\Sales\Model\Quote\Address\Total\AbstractTotal */
+            /* @var $total Address\Total\AbstractTotal */
             if (isset($totals[$total->getCode()])) {
                 $sortedTotals[$total->getCode()] = $totals[$total->getCode()];
             }
@@ -1693,7 +1824,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * Sets flag, whether this quote has some error associated with it.
      *
      * @param bool $flag
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     protected function _setHasError($flag)
     {
@@ -1707,7 +1838,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * It's recommended to use addErrorInfo() instead - to be able to remove error statuses later.
      *
      * @param bool $flag
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      * @see addErrorInfo()
      */
     public function setHasError($flag)
@@ -1724,7 +1855,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * Clears list of errors, associated with this quote.
      * Also automatically removes error-flag from oneself.
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     protected function _clearErrorInfo()
     {
@@ -1742,7 +1873,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
      * @param int|null $code Error code, unique for origin, that sets it
      * @param string|null $message Error message
      * @param \Magento\Object|null $additionalData Any additional data, that caller would like to store
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function addErrorInfo($type = 'error', $origin = null, $code = null, $message = null, $additionalData = null)
     {
@@ -1767,7 +1898,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
      *
      * @param string $type An internal error type ('error', 'qty', etc.), passed then to adding messages routine
      * @param array $params
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function removeErrorInfosByParams($type, $params)
     {
@@ -1810,7 +1941,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
      *
      * @param string $type
      * @param string $text
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function removeMessageByText($type, $text)
     {
@@ -1839,7 +1970,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Generate new increment order id and associate it with current quote
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function reserveOrderId()
     {
@@ -1885,7 +2016,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
             } else {
                 $baseTotal = 0;
                 foreach ($addresses as $address) {
-                    /* @var $address \Magento\Sales\Model\Quote\Address */
+                    /* @var $address Address */
                     $baseTotal += $address->getBaseSubtotalWithDiscount();
                 }
                 if ($baseTotal < $minAmount) {
@@ -1894,7 +2025,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
             }
         } else {
             foreach ($addresses as $address) {
-                /* @var $address \Magento\Sales\Model\Quote\Address */
+                /* @var $address Address */
                 if (!$address->validateMinimumAmount()) {
                     return false;
                 }
@@ -1958,10 +2089,10 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Merge quotes
      *
-     * @param   \Magento\Sales\Model\Quote $quote
-     * @return  \Magento\Sales\Model\Quote
+     * @param   Quote $quote
+     * @return $this
      */
-    public function merge(\Magento\Sales\Model\Quote $quote)
+    public function merge(Quote $quote)
     {
         $this->_eventManager->dispatch($this->_eventPrefix . '_merge_before', array(
             $this->_eventObject => $this,
@@ -2011,21 +2142,6 @@ class Quote extends \Magento\Core\Model\AbstractModel
         return $this;
     }
 
-    /**
-     * Whether there are recurring items
-     *
-     * @return bool
-     */
-    public function hasRecurringItems()
-    {
-        foreach ($this->getAllVisibleItems() as $item) {
-            if ($item->getProduct() && $item->getProduct()->isRecurring()) {
-                return true;
-            }
-        }
-        return false;
-    }
-
     /**
      * Getter whether quote has nominal items
      * Can bypass treating virtual items as nominal
@@ -2061,33 +2177,6 @@ class Quote extends \Magento\Core\Model\AbstractModel
         return true;
     }
 
-    /**
-     * Create recurring payment profiles basing on the current items
-     *
-     * @return array
-     * @throws \Exception
-     */
-    public function prepareRecurringPaymentProfiles()
-    {
-        if (!$this->getTotalsCollectedFlag()) {
-            // Whoops! Make sure nominal totals must be calculated here.
-            throw new \Exception('Quote totals must be collected before this operation.');
-        }
-
-        $result = array();
-        foreach ($this->getAllVisibleItems() as $item) {
-            $product = $item->getProduct();
-            if (is_object($product) && ($product->isRecurring())
-                && $profile = $this->_recurringProfileFactory->create()->importProduct($product)
-            ) {
-                $profile->importQuote($this);
-                $profile->importQuoteItem($item);
-                $result[] = $profile;
-            }
-        }
-        return $result;
-    }
-
     /**
      * @return $this
      */
@@ -2114,7 +2203,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Trigger collect totals after loading, if required
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     protected function _afterLoad()
     {
@@ -2126,7 +2215,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     }
 
     /**
-     * Return quote checkout method code
+     * Return checkout method code
      *
      * @param boolean $originalMethod if true return defined method from beginning
      * @return string
@@ -2142,7 +2231,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Prevent quote from saving
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function preventSaving()
     {
@@ -2153,7 +2242,7 @@ class Quote extends \Magento\Core\Model\AbstractModel
     /**
      * Save quote with prevention checking
      *
-     * @return \Magento\Sales\Model\Quote
+     * @return $this
      */
     public function save()
     {
diff --git a/app/code/Magento/Sales/Model/Quote/Address.php b/app/code/Magento/Sales/Model/Quote/Address.php
index 96346165848..6bf990d6609 100644
--- a/app/code/Magento/Sales/Model/Quote/Address.php
+++ b/app/code/Magento/Sales/Model/Quote/Address.php
@@ -24,118 +24,115 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\Sales\Model\Quote;
+
+use Magento\Customer\Service\V1\Dto\AddressBuilder as CustomerAddressBuilder;
+use Magento\Customer\Service\V1\Dto\Address as AddressDto;
+use Magento\Customer\Service\V1\CustomerAddressServiceInterface;
+
 /**
  * Sales Quote address model
  *
- * @method \Magento\Sales\Model\Resource\Quote\Address _getResource()
- * @method \Magento\Sales\Model\Resource\Quote\Address getResource()
  * @method int getQuoteId()
- * @method \Magento\Sales\Model\Quote\Address setQuoteId(int $value)
+ * @method Address setQuoteId(int $value)
  * @method string getCreatedAt()
- * @method \Magento\Sales\Model\Quote\Address setCreatedAt(string $value)
+ * @method Address setCreatedAt(string $value)
  * @method string getUpdatedAt()
- * @method \Magento\Sales\Model\Quote\Address setUpdatedAt(string $value)
+ * @method Address setUpdatedAt(string $value)
  * @method int getCustomerId()
- * @method \Magento\Sales\Model\Quote\Address setCustomerId(int $value)
+ * @method Address setCustomerId(int $value)
  * @method int getSaveInAddressBook()
- * @method \Magento\Sales\Model\Quote\Address setSaveInAddressBook(int $value)
+ * @method Address setSaveInAddressBook(int $value)
  * @method int getCustomerAddressId()
- * @method \Magento\Sales\Model\Quote\Address setCustomerAddressId(int $value)
+ * @method Address setCustomerAddressId(int $value)
+ * @method \Magento\Customer\Model\Address getCustomerAddress()
+ * @method Address setCustomerAddress(\Magento\Customer\Model\Address $value)
  * @method string getAddressType()
- * @method \Magento\Sales\Model\Quote\Address setAddressType(string $value)
+ * @method Address setAddressType(string $value)
  * @method string getEmail()
- * @method \Magento\Sales\Model\Quote\Address setEmail(string $value)
- * @method string getPrefix()
- * @method \Magento\Sales\Model\Quote\Address setPrefix(string $value)
- * @method string getFirstname()
- * @method \Magento\Sales\Model\Quote\Address setFirstname(string $value)
- * @method string getMiddlename()
- * @method \Magento\Sales\Model\Quote\Address setMiddlename(string $value)
- * @method string getLastname()
- * @method \Magento\Sales\Model\Quote\Address setLastname(string $value)
- * @method string getSuffix()
- * @method \Magento\Sales\Model\Quote\Address setSuffix(string $value)
+ * @method Address setEmail(string $value)
+ * @method Address setPrefix(string $value)
+ * @method Address setFirstname(string $value)
+ * @method Address setMiddlename(string $value)
+ * @method Address setLastname(string $value)
+ * @method Address setSuffix(string $value)
  * @method string getCompany()
- * @method \Magento\Sales\Model\Quote\Address setCompany(string $value)
- * @method string getCity()
- * @method \Magento\Sales\Model\Quote\Address setCity(string $value)
- * @method \Magento\Sales\Model\Quote\Address setRegion(string $value)
- * @method \Magento\Sales\Model\Quote\Address setRegionId(int $value)
- * @method string getPostcode()
- * @method \Magento\Sales\Model\Quote\Address setPostcode(string $value)
- * @method string getCountryId()
- * @method \Magento\Sales\Model\Quote\Address setCountryId(string $value)
- * @method string getTelephone()
- * @method \Magento\Sales\Model\Quote\Address setTelephone(string $value)
+ * @method Address setCompany(string $value)
+ * @method Address setCity(string $value)
+ * @method Address setRegion(string $value)
+ * @method Address setRegionId(int $value)
+ * @method Address setPostcode(string $value)
+ * @method Address setCountryId(string $value)
+ * @method Address setTelephone(string $value)
  * @method string getFax()
- * @method \Magento\Sales\Model\Quote\Address setFax(string $value)
+ * @method Address setFax(string $value)
  * @method int getSameAsBilling()
- * @method \Magento\Sales\Model\Quote\Address setSameAsBilling(int $value)
+ * @method Address setSameAsBilling(int $value)
  * @method int getFreeShipping()
- * @method \Magento\Sales\Model\Quote\Address setFreeShipping(int $value)
+ * @method Address setFreeShipping(int $value)
  * @method int getCollectShippingRates()
- * @method \Magento\Sales\Model\Quote\Address setCollectShippingRates(int $value)
+ * @method Address setCollectShippingRates(int $value)
  * @method string getShippingMethod()
- * @method \Magento\Sales\Model\Quote\Address setShippingMethod(string $value)
+ * @method Address setShippingMethod(string $value)
  * @method string getShippingDescription()
- * @method \Magento\Sales\Model\Quote\Address setShippingDescription(string $value)
+ * @method Address setShippingDescription(string $value)
  * @method float getWeight()
- * @method \Magento\Sales\Model\Quote\Address setWeight(float $value)
+ * @method Address setWeight(float $value)
  * @method float getSubtotal()
- * @method \Magento\Sales\Model\Quote\Address setSubtotal(float $value)
+ * @method Address setSubtotal(float $value)
  * @method float getBaseSubtotal()
- * @method \Magento\Sales\Model\Quote\Address setBaseSubtotal(float $value)
- * @method \Magento\Sales\Model\Quote\Address setSubtotalWithDiscount(float $value)
- * @method \Magento\Sales\Model\Quote\Address setBaseSubtotalWithDiscount(float $value)
+ * @method Address setBaseSubtotal(float $value)
+ * @method Address setSubtotalWithDiscount(float $value)
+ * @method Address setBaseSubtotalWithDiscount(float $value)
  * @method float getTaxAmount()
- * @method \Magento\Sales\Model\Quote\Address setTaxAmount(float $value)
+ * @method Address setTaxAmount(float $value)
  * @method float getBaseTaxAmount()
- * @method \Magento\Sales\Model\Quote\Address setBaseTaxAmount(float $value)
+ * @method Address setBaseTaxAmount(float $value)
  * @method float getShippingAmount()
  * @method float getBaseShippingAmount()
  * @method float getShippingTaxAmount()
- * @method \Magento\Sales\Model\Quote\Address setShippingTaxAmount(float $value)
+ * @method Address setShippingTaxAmount(float $value)
  * @method float getBaseShippingTaxAmount()
- * @method \Magento\Sales\Model\Quote\Address setBaseShippingTaxAmount(float $value)
+ * @method Address setBaseShippingTaxAmount(float $value)
  * @method float getDiscountAmount()
- * @method \Magento\Sales\Model\Quote\Address setDiscountAmount(float $value)
+ * @method Address setDiscountAmount(float $value)
  * @method float getBaseDiscountAmount()
- * @method \Magento\Sales\Model\Quote\Address setBaseDiscountAmount(float $value)
+ * @method Address setBaseDiscountAmount(float $value)
  * @method float getGrandTotal()
- * @method \Magento\Sales\Model\Quote\Address setGrandTotal(float $value)
+ * @method Address setGrandTotal(float $value)
  * @method float getBaseGrandTotal()
- * @method \Magento\Sales\Model\Quote\Address setBaseGrandTotal(float $value)
+ * @method Address setBaseGrandTotal(float $value)
  * @method string getCustomerNotes()
- * @method \Magento\Sales\Model\Quote\Address setCustomerNotes(string $value)
+ * @method Address setCustomerNotes(string $value)
  * @method string getDiscountDescription()
- * @method \Magento\Sales\Model\Quote\Address setDiscountDescription(string $value)
+ * @method Address setDiscountDescription(string $value)
  * @method null|array getDiscountDescriptionArray()
- * @method \Magento\Sales\Model\Quote\Address setDiscountDescriptionArray(array $value)
+ * @method Address setDiscountDescriptionArray(array $value)
  * @method float getShippingDiscountAmount()
- * @method \Magento\Sales\Model\Quote\Address setShippingDiscountAmount(float $value)
+ * @method Address setShippingDiscountAmount(float $value)
  * @method float getBaseShippingDiscountAmount()
- * @method \Magento\Sales\Model\Quote\Address setBaseShippingDiscountAmount(float $value)
+ * @method Address setBaseShippingDiscountAmount(float $value)
  * @method float getSubtotalInclTax()
- * @method \Magento\Sales\Model\Quote\Address setSubtotalInclTax(float $value)
+ * @method Address setSubtotalInclTax(float $value)
  * @method float getBaseSubtotalTotalInclTax()
- * @method \Magento\Sales\Model\Quote\Address setBaseSubtotalTotalInclTax(float $value)
+ * @method Address setBaseSubtotalTotalInclTax(float $value)
  * @method int getGiftMessageId()
- * @method \Magento\Sales\Model\Quote\Address setGiftMessageId(int $value)
+ * @method Address setGiftMessageId(int $value)
  * @method float getHiddenTaxAmount()
- * @method \Magento\Sales\Model\Quote\Address setHiddenTaxAmount(float $value)
+ * @method Address setHiddenTaxAmount(float $value)
  * @method float getBaseHiddenTaxAmount()
- * @method \Magento\Sales\Model\Quote\Address setBaseHiddenTaxAmount(float $value)
+ * @method Address setBaseHiddenTaxAmount(float $value)
  * @method float getShippingHiddenTaxAmount()
- * @method \Magento\Sales\Model\Quote\Address setShippingHiddenTaxAmount(float $value)
+ * @method Address setShippingHiddenTaxAmount(float $value)
  * @method float getBaseShippingHiddenTaxAmnt()
- * @method \Magento\Sales\Model\Quote\Address setBaseShippingHiddenTaxAmnt(float $value)
+ * @method Address setBaseShippingHiddenTaxAmnt(float $value)
  * @method float getShippingInclTax()
- * @method \Magento\Sales\Model\Quote\Address setShippingInclTax(float $value)
+ * @method Address setShippingInclTax(float $value)
  * @method float getBaseShippingInclTax()
- * @method \Magento\Sales\Model\Quote\Address setBaseShippingInclTax(float $value)
+ * @method \Magento\SalesRule\Model\Rule[] getCartFixedRules()
+ * @method int[] getAppliedRuleIds()
+ * @method Address setBaseShippingInclTax(float $value)
  */
-namespace Magento\Sales\Model\Quote;
-
 class Address extends \Magento\Customer\Model\Address\AbstractAddress
 {
     const RATES_FETCH = 1;
@@ -250,8 +247,22 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
     protected $_addressTotalFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @var CustomerAddressBuilder
+     */
+    protected $_customerAddressBuilder;
+
+    /**
+     * @var CustomerAddressServiceInterface
+     */
+    protected $_customerAdressService;
+    /**
+     * @var \Magento\Customer\Model\Address\Converter
+     */
+    private $addressConverter;
+
+    /**
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Directory\Helper\Data $directoryData
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Customer\Model\Address\Config $addressConfig
@@ -269,13 +280,16 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
      * @param \Magento\Sales\Model\Quote\Address\TotalFactory $addressTotalFactory
      * @param \Magento\Object\Copy $objectCopyService
      * @param \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory
+     * @param CustomerAddressBuilder $customerAddressBuilder
+     * @param CustomerAddressServiceInterface $customerAddressService
+     * @param \Magento\Customer\Model\Address\Converter $addressConverter
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Directory\Helper\Data $directoryData,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Customer\Model\Address\Config $addressConfig,
@@ -293,6 +307,9 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
         \Magento\Sales\Model\Quote\Address\TotalFactory $addressTotalFactory,
         \Magento\Object\Copy $objectCopyService,
         \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory,
+        CustomerAddressBuilder $customerAddressBuilder,
+        CustomerAddressServiceInterface $customerAddressService,
+        \Magento\Customer\Model\Address\Converter $addressConverter,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
@@ -309,6 +326,8 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
         $this->_addressTotalFactory = $addressTotalFactory;
         $this->_objectCopyService = $objectCopyService;
         $this->_carrierFactory = $carrierFactory;
+        $this->_customerAddressBuilder = $customerAddressBuilder;
+        $this->_customerAdressService = $customerAddressService;
         parent::__construct(
             $context,
             $registry,
@@ -321,6 +340,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
             $resourceCollection,
             $data
         );
+        $this->addressConverter = $addressConverter;
     }
 
     /**
@@ -359,8 +379,8 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
             /**
              * Init customer address id if customer address is assigned
              */
-            if ($this->getCustomerAddress()) {
-                $this->setCustomerAddressId($this->getCustomerAddress()->getId());
+            if ($this->getCustomerAddressData()) {
+                $this->setCustomerAddressId($this->getCustomerAddressData()->getId());
             }
 
             if (!$this->getId()) {
@@ -397,10 +417,24 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
      */
     protected function _isDefaultShippingNullOrSameAsBillingAddress()
     {
-        $customer = $this->getQuote()->getCustomer();
-        return !$customer->getDefaultShippingAddress()
-            || $customer->getDefaultBillingAddress() && $customer->getDefaultShippingAddress()
-                && $customer->getDefaultBillingAddress()->getId() == $customer->getDefaultShippingAddress()->getId();
+        $customerData = $this->getQuote()->getCustomerData();
+        $customerId = $customerData->getCustomerId();
+        $defaultBillingAddress = null;
+        $defaultShippingAddress = null;
+
+        if ($customerId) {
+            /* we should load data from the service once customer is saved */
+            $defaultBillingAddress = $this->_customerAdressService->getDefaultBillingAddress($customerId);
+            $defaultShippingAddress = $this->_customerAdressService->getDefaultShippingAddress($customerId);
+        } else {
+            /* we should load data from the quote if customer is not saved yet */
+            $defaultBillingAddress = $customerData->getDefaultBilling();
+            $defaultShippingAddress = $customerData->getDefaultShipping();
+        }
+
+        return !$defaultShippingAddress
+        || $defaultBillingAddress && $defaultShippingAddress
+        && $defaultBillingAddress->getId() == $defaultShippingAddress->getId();
     }
 
     /**
@@ -446,15 +480,20 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
     /**
      * Import quote address data from customer address object
      *
-     * @param   \Magento\Customer\Model\Address $address
-     * @return  \Magento\Sales\Model\Quote\Address
+     * @deprecated Use \Magento\Sales\Model\Quote\Address::importCustomerAddressData() instead
+     * @param \Magento\Customer\Model\Address $address
+     * @return \Magento\Sales\Model\Quote\Address
      */
     public function importCustomerAddress(\Magento\Customer\Model\Address $address)
     {
+        /**
+         * TODO: Remove this method when all dependencies are refactored to use
+         * importCustomerAddressData() - MAGETWO-20858
+         */
         $this->_objectCopyService->copyFieldsetToTarget('customer_address', 'to_quote_address', $address, $this);
         $email = null;
         if ($address->hasEmail()) {
-            $email =  $address->getEmail();
+            $email = $address->getEmail();
         } elseif ($address->getCustomer()) {
             $email = $address->getCustomer()->getEmail();
         }
@@ -464,13 +503,45 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
         return $this;
     }
 
+    /**
+     * Import quote address data from customer address DTO.
+     *
+     * @param \Magento\Customer\Service\V1\Dto\Address $address
+     * @return \Magento\Sales\Model\Quote\Address
+     */
+    public function importCustomerAddressData(\Magento\Customer\Service\V1\Dto\Address $address)
+    {
+        $this->_objectCopyService->copyFieldsetToTarget(
+            'customer_address',
+            'to_quote_address',
+            $address->getAttributes(),
+            $this
+        );
+        $region = $this->getRegion();
+        if (isset($region['region_id']) && isset($region['region'])) {
+            $this->setRegionId($region['region_id']);
+            $this->setRegion($region['region']);
+        }
+        $quote = $this->getQuote();
+        if ($address->getCustomerId() && (!empty($quote) && ($address->getCustomerId() == $quote->getCustomerId()))) {
+            $customer = $quote->getCustomerData();
+            $this->setEmail($customer->getEmail());
+        }
+        return $this;
+    }
+
     /**
      * Export data to customer address object
      *
+     * @deprecated Use \Magento\Sales\Model\Quote\Address::exportCustomerAddressData() instead
      * @return \Magento\Customer\Model\Address
      */
     public function exportCustomerAddress()
     {
+        /**
+         * TODO: Remove this method when all dependencies are refactored to use exportCustomerAddressData()
+         * _addressFactory variable should be removed in scope of MAGETWO-21105 as well
+         */
         $address = $this->_addressFactory->create();
         $this->_objectCopyService->copyFieldsetToTarget(
             'sales_convert_quote_address', 'to_customer_address', $this, $address
@@ -478,6 +549,24 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
         return $address;
     }
 
+    /**
+     * Export data to customer address DTO.
+     *
+     * @return \Magento\Customer\Service\V1\Dto\Address
+     */
+    public function exportCustomerAddressData()
+    {
+        $customerAddressData = $this->_objectCopyService->getDataFromFieldset(
+            'sales_convert_quote_address',
+            'to_customer_address',
+            $this
+        );
+        $customerAddressDataWithRegion = [];
+        $customerAddressDataWithRegion['region']['region'] = $customerAddressData['region'];
+        $customerAddressData = array_merge($customerAddressData, $customerAddressDataWithRegion);
+        return $this->_customerAddressBuilder->populateWithArray($customerAddressData)->create();
+    }
+
     /**
      * Import address data from order address
      *
@@ -1340,4 +1429,37 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
     {
         return $this->getSubtotal() + $this->getDiscountAmount();
     }
+
+    /**
+     * Keep customer address
+     * @todo refactor in scope of MAGETWO-20857
+     *
+     * @param AddressDto $address
+     * @return $this
+     */
+    public function setCustomerAddressData(AddressDto $address)
+    {
+        return $this->setCustomerAddress($this->addressConverter->createAddressModel($address));
+    }
+
+    /**
+     * Get previously set customer address
+     * @todo refactor in scope of MAGETWO-20857
+     *
+     * @return AddressDto|null
+     */
+    public function getCustomerAddressData()
+    {
+        $address = $this->getCustomerAddress();
+
+        if ($address) {
+            return $this->addressConverter->createAddressFromModel(
+                $address,
+                $address->getIsDefaultBilling(),
+                $address->getIsDefaultShipping()
+            );
+        }
+
+        return null;
+    }
 }
diff --git a/app/code/Magento/Sales/Model/Quote/Item.php b/app/code/Magento/Sales/Model/Quote/Item.php
index 515dfb21b48..03d7a137fef 100644
--- a/app/code/Magento/Sales/Model/Quote/Item.php
+++ b/app/code/Magento/Sales/Model/Quote/Item.php
@@ -201,8 +201,8 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem
     protected $_itemOptionFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\Sales\Model\Status\ListFactory $statusListFactory
      * @param \Magento\Core\Model\LocaleInterface $locale
@@ -214,8 +214,8 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\Sales\Model\Status\ListFactory $statusListFactory,
         \Magento\Core\Model\LocaleInterface $locale,
diff --git a/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php b/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php
index 8ef248d3179..1090550d987 100644
--- a/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php
+++ b/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php
@@ -24,6 +24,8 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\Sales\Model\Quote\Item;
+
 /**
  * Quote item abstract model
  *
@@ -34,12 +36,23 @@
  *  - custom_price - new price that can be declared by user and recalculated during calculation process
  *  - original_custom_price - original defined value of custom price without any convertion
  *
- * @category   Magento
- * @package    Magento_Sales
- * @author      Magento Core Team <core@magentocommerce.com>
+ * @method float getDiscountAmount()
+ * @method \Magento\Sales\Model\Quote\Item\AbstractItem setDiscountAmount(float $amount)
+ * @method float getBaseDiscountAmount()
+ * @method \Magento\Sales\Model\Quote\Item\AbstractItem setBaseDiscountAmount(float $amount)
+ * @method float getDiscountPercent()
+ * @method \Magento\Sales\Model\Quote\Item\AbstractItem setDiscountPercent()
+ * @method float getOriginalDiscountAmount()
+ * @method \Magento\Sales\Model\Quote\Item\AbstractItem setOriginalDiscountAmount()
+ * @method float getBaseOriginalDiscountAmount()
+ * @method \Magento\Sales\Model\Quote\Item\AbstractItem setBaseOriginalDiscountAmount()
+ * @method float getDiscountCalculationPrice()
+ * @method \Magento\Sales\Model\Quote\Item\AbstractItem setDiscountCalculationPrice()
+ * @method float getBaseDiscountCalculationPrice()
+ * @method \Magento\Sales\Model\Quote\Item\AbstractItem setBaseDiscountCalculationPrice($price)
+ * @method int[] getAppliedRuleIds()
+ * @method \Magento\Sales\Model\Quote\Item\AbstractItem setAppliedRuleIds(array $ruleIds)
  */
-namespace Magento\Sales\Model\Quote\Item;
-
 abstract class AbstractItem extends \Magento\Core\Model\AbstractModel
     implements \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface
 {
@@ -60,16 +73,16 @@ abstract class AbstractItem extends \Magento\Core\Model\AbstractModel
     protected $_productFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Model\ProductFactory $productFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
@@ -150,7 +163,6 @@ abstract class AbstractItem extends \Magento\Core\Model\AbstractModel
         return $this;
     }
 
-
     /**
      * Set parent item
      *
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Collection.php
index 699d699cc84..5634f8e9acd 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Collection.php
@@ -230,6 +230,24 @@ class Collection extends \Magento\Sales\Model\Resource\Collection\AbstractCollec
         return $this;
     }
 
+    /**
+     * Add filter by specified billing agreements
+     *
+     * @param int|array $agreements
+     * @return \Magento\Sales\Model\Resource\Order\Collection
+     */
+    public function addBillingAgreementsFilter($agreements)
+    {
+        $agreements = (is_array($agreements)) ? $agreements : array($agreements);
+        $this->getSelect()
+            ->joinInner(
+                array('sbao' => $this->getTable('sales_billing_agreement_order')),
+                'main_table.entity_id = sbao.order_id',
+                array())
+            ->where('sbao.agreement_id IN(?)', $agreements);
+        return $this;
+    }
+
     /**
      * Add filter by specified recurring profile id(s)
      *
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Grid/StatusesArray.php b/app/code/Magento/Sales/Model/Resource/Order/Grid/StatusesArray.php
index 1fab8d5cb91..08831e298b5 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Grid/StatusesArray.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Grid/StatusesArray.php
@@ -29,7 +29,7 @@
  */
 namespace Magento\Sales\Model\Resource\Order\Grid;
 
-class StatusesArray implements \Magento\Core\Model\Option\ArrayInterface
+class StatusesArray implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Sales\Model\Resource\Order\Status\CollectionFactory
diff --git a/app/code/Magento/Sales/Model/Resource/Sale/Collection.php b/app/code/Magento/Sales/Model/Resource/Sale/Collection.php
index 90a44fbb5dc..7db5eaf18c9 100644
--- a/app/code/Magento/Sales/Model/Resource/Sale/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Sale/Collection.php
@@ -44,11 +44,9 @@ class Collection extends \Magento\Data\Collection\Db
     );
 
     /**
-     * Customer model
-     *
-     * @var \Magento\Customer\Model\Customer
+     * @var int
      */
-    protected $_customer;
+    protected $_customerId;
 
     /**
      * Order state value
@@ -106,12 +104,12 @@ class Collection extends \Magento\Data\Collection\Db
     /**
      * Set filter by customer
      *
-     * @param \Magento\Customer\Model\Customer $customer
+     * @param int $customerId
      * @return \Magento\Sales\Model\Resource\Sale\Collection
      */
-    public function setCustomerFilter(\Magento\Customer\Model\Customer $customer)
+    public function setCustomerFilter($customerId)
     {
-        $this->_customer = $customer;
+        $this->_customerId = (int)$customerId;
         return $this;
     }
 
@@ -136,7 +134,7 @@ class Collection extends \Magento\Data\Collection\Db
     public function setOrderStateFilter($state, $exclude = false)
     {
         $this->_orderStateCondition = ($exclude) ? 'NOT IN' : 'IN';
-        $this->_orderStateValue     = (!is_array($state)) ? array($state) : $state;
+        $this->_state = (!is_array($state)) ? array($state) : $state;
         return $this;
     }
 
@@ -161,11 +159,11 @@ class Collection extends \Magento\Data\Collection\Db
             )
             ->group('sales.store_id');
 
-        if ($this->_customer instanceof \Magento\Customer\Model\Customer) {
-            $this->addFieldToFilter('sales.customer_id', $this->_customer->getId());
+        if ($this->_customerId) {
+            $this->addFieldToFilter('sales.customer_id', $this->_customerId);
         }
 
-        if (!is_null($this->_orderStateValue)) {
+        if (!is_null($this->_state)) {
             $condition = '';
             switch ($this->_orderStateCondition) {
                 case 'IN' :
@@ -175,7 +173,7 @@ class Collection extends \Magento\Data\Collection\Db
                     $condition = 'nin';
                     break;
             }
-            $this->addFieldToFilter('state', array($condition => $this->_orderStateValue));
+            $this->addFieldToFilter('state', array($condition => $this->_state));
         }
 
         $this->_eventManager->dispatch('sales_sale_collection_query_before', array('collection' => $this));
diff --git a/app/code/Magento/Sales/Model/Service/Quote.php b/app/code/Magento/Sales/Model/Service/Quote.php
index 9f71b42a172..32bc1f1bad1 100644
--- a/app/code/Magento/Sales/Model/Service/Quote.php
+++ b/app/code/Magento/Sales/Model/Service/Quote.php
@@ -18,17 +18,22 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Sales
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\Sales\Model\Service;
+
+use Magento\Customer\Service\V1\CustomerServiceInterface;
+use Magento\Customer\Service\V1\CustomerAddressServiceInterface;
+use Magento\Customer\Service\V1\CustomerAccountServiceInterface;
+use Magento\Customer\Service\V1\Dto\AddressBuilder;
+use Magento\Customer\Service\V1\Dto\Customer as CustomerDto;
+use Magento\Customer\Service\V1\Dto\Response\CreateCustomerAccountResponse;
+
 /**
  * Quote submit service model
  */
-namespace Magento\Sales\Model\Service;
-
 class Quote
 {
     /**
@@ -52,13 +57,6 @@ class Quote
      */
     protected $_orderData = array();
 
-    /**
-     * List of recurring payment profiles that may have been generated before placing the order
-     *
-     * @var array
-     */
-    protected $_recurringPaymentProfiles = array();
-
     /**
      * Order that may be created during submission
      *
@@ -90,6 +88,31 @@ class Quote
      */
     protected $_transactionFactory;
 
+    /**
+     * @var CustomerServiceInterface
+     */
+    protected $_customerService;
+
+    /**
+     * @var CustomerAccountServiceInterface
+     */
+    protected $_customerAccountService;
+
+    /**
+     * @var CustomerAddressServiceInterface
+     */
+    protected $_customerAddressService;
+
+    /**
+     * @var AddressBuilder
+     */
+    protected $_customerAddressBuilder;
+
+    /**
+     * @var CreateCustomerAccountResponse
+     */
+    protected $_createCustomerResponse;
+
     /**
      * Class constructor
      *
@@ -98,19 +121,31 @@ class Quote
      * @param \Magento\Sales\Model\Convert\QuoteFactory $convertQuoteFactory
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Core\Model\Resource\TransactionFactory $transactionFactory
+     * @param CustomerServiceInterface $customerService
+     * @param CustomerAccountServiceInterface $customerAccountService
+     * @param CustomerAddressServiceInterface $customerAddressService
+     * @param AddressBuilder $customerAddressBuilder
      */
     public function __construct(
         \Magento\Event\ManagerInterface $eventManager,
         \Magento\Sales\Model\Quote $quote,
         \Magento\Sales\Model\Convert\QuoteFactory $convertQuoteFactory,
         \Magento\Customer\Model\Session $customerSession,
-        \Magento\Core\Model\Resource\TransactionFactory $transactionFactory
+        \Magento\Core\Model\Resource\TransactionFactory $transactionFactory,
+        CustomerServiceInterface $customerService,
+        CustomerAccountServiceInterface $customerAccountService,
+        CustomerAddressServiceInterface $customerAddressService,
+        AddressBuilder $customerAddressBuilder
     ) {
         $this->_eventManager = $eventManager;
         $this->_quote = $quote;
         $this->_convertor = $convertQuoteFactory->create();
         $this->_customerSession = $customerSession;
         $this->_transactionFactory = $transactionFactory;
+        $this->_customerService = $customerService;
+        $this->_customerAccountService = $customerAccountService;
+        $this->_customerAddressService = $customerAddressService;
+        $this->_customerAddressBuilder = $customerAddressBuilder;
     }
 
     /**
@@ -150,6 +185,7 @@ class Quote
     /**
      * Submit the quote. Quote submit process will create the order based on quote data
      *
+     * @deprecated
      * @return \Magento\Sales\Model\Order
      * @throws \Exception
      */
@@ -234,6 +270,154 @@ class Quote
                 $item->setItemId(null);
             }
 
+            $this->_eventManager->dispatch('sales_model_service_quote_submit_failure', array(
+                    'order' => $order,
+                    'quote' => $quote
+                ));
+            throw $e;
+        }
+        $this->_eventManager->dispatch('sales_model_service_quote_submit_after', array(
+                'order' => $order,
+                'quote' => $quote
+            ));
+        $this->_order = $order;
+        return $order;
+    }
+
+    /**
+     * Submit the quote. Quote submit process will create the order based on quote data
+     *
+     * @return \Magento\Sales\Model\Order
+     * @throws \Exception
+     */
+    public function submitOrderWithDto()
+    {
+        $this->_deleteNominalItems();
+        $this->_validate();
+        $quote = $this->_quote;
+        $isVirtual = $quote->isVirtual();
+
+        $transaction = $this->_transactionFactory->create();
+
+        $originalCustomerDto = null;
+        $customerDto = null;
+        if (!$quote->getCustomerIsGuest()) {
+            $customerDto = $quote->getCustomerData();
+            $addresses = $quote->getCustomerAddressData();
+            if ($customerDto->getCustomerId()) {
+                //cache the original customer data for rollback if needed
+                $originalCustomerDto = $this->_customerService->getCustomer($customerDto->getCustomerId());
+                $originalAddresses = $this->_customerAddressService->getAddresses($customerDto->getCustomerId());
+                //Save updated data
+                $this->_customerService->saveCustomer($customerDto);
+                $this->_customerAddressService->saveAddresses($customerDto->getCustomerId(), $addresses);
+            } else { //for new customers
+                $this->_createCustomerResponse = $this->_customerAccountService->createAccount(
+                    $customerDto,
+                    $addresses,
+                    null,
+                    '',
+                    '',
+                    $quote->getStoreId()
+                );
+                $customerDto = $this->_customerService->getCustomer($this->_createCustomerResponse->getCustomerId());
+                $addresses = $this->_customerAddressService->getAddresses(
+                    $this->_createCustomerResponse->getCustomerId()
+                );
+                //Update quote address information
+                foreach ($addresses as $address) {
+                    if ($address->isDefaultBilling()) {
+                        $quote->getBillingAddress()->setCustomerAddressData($address);
+                    } else if ($address->isDefaultShipping()) {
+                        $quote->getShippingAddress()->setCustomerAddressData($address);
+                    }
+                }
+                if ($quote->getShippingAddress() && $quote->getShippingAddress()->getSameAsBilling()) {
+                    $quote->getShippingAddress()->setCustomerAddressData(
+                        $quote->getBillingAddress()->getCustomerAddressData());
+                }
+            }
+
+            $quote->setCustomerData($customerDto)->setCustomerAddressData($addresses);
+        }
+        $transaction->addObject($quote);
+
+        $quote->reserveOrderId();
+        if ($isVirtual) {
+            $order = $this->_convertor->addressToOrder($quote->getBillingAddress());
+        } else {
+            $order = $this->_convertor->addressToOrder($quote->getShippingAddress());
+        }
+        $order->setBillingAddress($this->_convertor->addressToOrderAddress($quote->getBillingAddress()));
+        if ($quote->getBillingAddress()->getCustomerAddressData()) {
+            $order->getBillingAddress()->setCustomerAddressData($quote->getBillingAddress()->getCustomerAddressData());
+        }
+        if (!$isVirtual) {
+            $order->setShippingAddress($this->_convertor->addressToOrderAddress($quote->getShippingAddress()));
+            if ($quote->getShippingAddress()->getCustomerAddressData()) {
+                $order->getShippingAddress()->setCustomerAddressData(
+                    $quote->getShippingAddress()->getCustomerAddressData());
+            }
+        }
+        $order->setPayment($this->_convertor->paymentToOrderPayment($quote->getPayment()));
+
+        foreach ($this->_orderData as $key => $value) {
+            $order->setData($key, $value);
+        }
+
+        foreach ($quote->getAllItems() as $item) {
+            $orderItem = $this->_convertor->itemToOrderItem($item);
+            if ($item->getParentItem()) {
+                $orderItem->setParentItem($order->getItemByQuoteItemId($item->getParentItem()->getId()));
+            }
+            $order->addItem($orderItem);
+        }
+
+        if ($customerDto) {
+            $order->setCustomerId($customerDto->getCustomerId());
+        }
+        $order->setQuote($quote);
+
+        $transaction->addObject($order);
+        $transaction->addCommitCallback(array($order, 'place'));
+        $transaction->addCommitCallback(array($order, 'save'));
+
+        /**
+         * We can use configuration data for declare new order status
+         */
+        $this->_eventManager->dispatch('checkout_type_onepage_save_order', array(
+            'order' => $order,
+            'quote' => $quote
+        ));
+        $this->_eventManager->dispatch('sales_model_service_quote_submit_before', array(
+            'order' => $order,
+            'quote' => $quote
+        ));
+        try {
+            $transaction->save();
+            $this->_inactivateQuote();
+            $this->_eventManager->dispatch('sales_model_service_quote_submit_success', array(
+                'order' => $order,
+                'quote' => $quote
+            ));
+        } catch (\Exception $e) {
+            if ($originalCustomerDto) { //Restore original customer data if existing customer was updated
+                $this->_customerService->saveCustomer($originalCustomerDto);
+                $this->_customerAddressService->saveAddresses($customerDto->getCustomerId(), $originalAddresses);
+            } else if ($customerDto->getCustomerId()) { // Delete if new customer created
+                $this->_customerService->deleteCustomer($customerDto->getCustomerId());
+                $order->setCustomerId(null);
+                $quote->setCustomerData(new CustomerDto([]));
+            }
+
+            //reset order ID's on exception, because order not saved
+            $order->setId(null);
+            /** @var $item \Magento\Sales\Model\Order\Item */
+            foreach ($order->getItemsCollection() as $item) {
+                $item->setOrderId(null);
+                $item->setItemId(null);
+            }
+
             $this->_eventManager->dispatch('sales_model_service_quote_submit_failure', array(
                 'order' => $order,
                 'quote' => $quote
@@ -256,7 +440,7 @@ class Quote
     public function submitNominalItems()
     {
         $this->_validate();
-        $this->_submitRecurringPaymentProfiles();
+        $this->_eventManager->dispatch('sales_model_service_quote_submit_nominal_items', ['quote' => $this->_quote]);
         $this->_inactivateQuote();
         $this->_deleteNominalItems();
     }
@@ -286,13 +470,27 @@ class Quote
     }
 
     /**
-     * Return recurring payment profiles
-     *
-     * @return array
+     * Submit all available items
+     * All created items will be set to the object
      */
-    public function getRecurringPaymentProfiles()
+    public function submitAllWithDto()
     {
-        return $this->_recurringPaymentProfiles;
+        // don't allow submitNominalItems() to inactivate quote
+        $inactivateQuoteOld = $this->_shouldInactivateQuote;
+        $this->_shouldInactivateQuote = false;
+        try {
+            $this->submitNominalItems();
+            $this->_shouldInactivateQuote = $inactivateQuoteOld;
+        } catch (\Exception $e) {
+            $this->_shouldInactivateQuote = $inactivateQuoteOld;
+            throw $e;
+        }
+        // no need to submit the order if there are no normal items remained
+        if (!$this->_quote->getAllVisibleItems()) {
+            $this->_inactivateQuote();
+            return;
+        }
+        $this->submitOrderWithDto();
     }
 
     /**
@@ -305,6 +503,16 @@ class Quote
         return $this->_order;
     }
 
+    /**
+     * Get response when CustomerAccountService was invoked to create a new customer account
+     *
+     * @return CreateCustomerAccountResponse
+     */
+    public function getCreateCustomerResponse()
+    {
+        return $this->_createCustomerResponse;
+    }
+
     /**
      * Inactivate quote
      *
@@ -355,23 +563,6 @@ class Quote
         return $this;
     }
 
-    /**
-     * Submit recurring payment profiles
-     *
-     * @throws \Magento\Core\Exception
-     */
-    protected function _submitRecurringPaymentProfiles()
-    {
-        $profiles = $this->_quote->prepareRecurringPaymentProfiles();
-        foreach ($profiles as $profile) {
-            if (!$profile->isValid()) {
-                throw new \Magento\Core\Exception($profile->getValidationErrors());
-            }
-            $profile->submit();
-        }
-        $this->_recurringPaymentProfiles = $profiles;
-    }
-
     /**
      * Get rid of all nominal items
      */
diff --git a/app/code/Magento/Sales/etc/adminhtml/events.xml b/app/code/Magento/Sales/etc/adminhtml/events.xml
index 15b1da6be0f..14208c0c533 100644
--- a/app/code/Magento/Sales/etc/adminhtml/events.xml
+++ b/app/code/Magento/Sales/etc/adminhtml/events.xml
@@ -42,7 +42,7 @@
     <event name="catalog_product_status_update">
         <observer name="sales_quote" instance="Magento\Sales\Model\Observer\Backend\CatalogProductQuote" method="catalogProductStatusUpdate" />
     </event>
-    <event name="customer_save_after">
+    <event name="customer_save_after_dto">
         <observer name="customer" instance="Magento\Sales\Model\Observer\Backend\CustomerQuote" method="dispatch" />
     </event>
 </config>
diff --git a/app/code/Magento/Sales/etc/fieldset.xml b/app/code/Magento/Sales/etc/fieldset.xml
index 878e5c67a2c..237b770b2af 100644
--- a/app/code/Magento/Sales/etc/fieldset.xml
+++ b/app/code/Magento/Sales/etc/fieldset.xml
@@ -325,8 +325,8 @@
                 <aspect name="to_order_address" />
                 <aspect name="to_customer_address" />
             </field>
-            <field name="street_full">
-                <aspect name="to_order_address" targetField="street" />
+            <field name="street">
+                <aspect name="to_order_address" />
             </field>
             <field name="street">
                 <aspect name="to_customer_address" />
@@ -670,8 +670,8 @@
             <field name="company">
                 <aspect name="to_quote_address" />
             </field>
-            <field name="street_full">
-                <aspect name="to_quote_address" targetField="street" />
+            <field name="street">
+                <aspect name="to_quote_address" />
             </field>
             <field name="city">
                 <aspect name="to_quote_address" />
@@ -875,8 +875,8 @@
             <field name="company">
                 <aspect name="to_quote_address" />
             </field>
-            <field name="street_full">
-                <aspect name="to_quote_address" targetField="street" />
+            <field name="street">
+                <aspect name="to_quote_address" />
             </field>
             <field name="city">
                 <aspect name="to_quote_address" />
diff --git a/app/code/Magento/Sales/etc/frontend/page_types.xml b/app/code/Magento/Sales/etc/frontend/page_types.xml
index a67bb6fdeda..8c69b1e6622 100644
--- a/app/code/Magento/Sales/etc/frontend/page_types.xml
+++ b/app/code/Magento/Sales/etc/frontend/page_types.xml
@@ -44,6 +44,4 @@
     <type id="sales_order_reorder" label="Sales Reorder"/>
     <type id="sales_order_shipment" label="Customer My Account Order Shipment View"/>
     <type id="sales_order_view" label="Customer My Account Order View"/>
-    <type id="sales_recurringprofile_index" label="Recurring Profile"/>
-    <type id="sales_recurringprofile_view" label="Recurring Profile View"/>
 </page_types>
diff --git a/app/code/Magento/Sales/etc/module.xml b/app/code/Magento/Sales/etc/module.xml
index b1b4d2dfdc8..6f7a570a720 100755
--- a/app/code/Magento/Sales/etc/module.xml
+++ b/app/code/Magento/Sales/etc/module.xml
@@ -51,7 +51,6 @@
             <module name="Magento_CatalogInventory"/>
             <module name="Magento_Wishlist"/>
             <module name="Magento_Email"/>
-            <module name="Magento_RecurringProfile"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/Sales/etc/sales.xml b/app/code/Magento/Sales/etc/sales.xml
index e488d13dc6b..176c8cbd3f4 100644
--- a/app/code/Magento/Sales/etc/sales.xml
+++ b/app/code/Magento/Sales/etc/sales.xml
@@ -33,8 +33,6 @@
             <item name="grand_total" instance="Magento\Sales\Model\Quote\Address\Total\Grand" sort_order="550"/>
         </group>
         <group name="nominal_totals">
-            <item name="recurring_initial_fee" instance="Magento\Sales\Model\Quote\Address\Total\Nominal\Recurring\Initial" sort_order="10"/>
-            <item name="recurring_trial_payment" instance="Magento\Sales\Model\Quote\Address\Total\Nominal\Recurring\Trial" sort_order="50"/>
             <item name="nominal_subtotal" instance="Magento\Sales\Model\Quote\Address\Total\Nominal\Subtotal" sort_order="250"/>
             <item name="nominal_shipping" instance="Magento\Sales\Model\Quote\Address\Total\Nominal\Shipping" sort_order="1250"/>
         </group>
diff --git a/app/code/Magento/Sales/i18n/de_DE.csv b/app/code/Magento/Sales/i18n/de_DE.csv
index 8722d77720d..ee82e2390cc 100644
--- a/app/code/Magento/Sales/i18n/de_DE.csv
+++ b/app/code/Magento/Sales/i18n/de_DE.csv
@@ -184,7 +184,7 @@
 "Customer My Account Order Invoice View","Kundenbestellung My Account Ansicht der Rechnung"
 "Customer My Account Order Shipment View","Kundenbestellung My Account Ansicht der Lieferung"
 "Customer My Account Order View","Kundenbestellung My Account Ansicht"
-"Customer\'s Current Activities","Aktuelle Aktionen des Kunden"
+"Customer's Current Activities","Aktuelle Aktionen des Kunden"
 "Customs Value","Zollwert"
 "Date","Datum"
 "Default Status","Standardstatus"
@@ -317,7 +317,7 @@
 "Key","Schlüssel"
 "Last Name","Nachname des Kunden"
 "Last Ordered Items","Zuletzte bestellte Artikel"
-"Last status can\'t be unassigned from state.","Letzter Status kann vom Zustand nicht entfernt werden."
+"Last status can't be unassigned from state.","Letzter Status kann vom Zustand nicht entfernt werden."
 "Length","Länge"
 "Link to the New Order","Link zu neuer Bestellung"
 "Link to the Previous Order","Link zu vorheriger Bestellung"
@@ -802,8 +802,8 @@
 "Unknown Status","Unbekannter Status"
 "Unsupported transaction type ""%s"".","Nicht unterstützter Transaktionstyp ""%s""."
 "Update Changes","Änderungen aktualisieren"
-"Update Items and Qty\'s","Artikel und Mengen aktualisieren"
-"Update Qty\'s","Anzahl aktualisieren"
+"Update Items and Qty's","Artikel und Mengen aktualisieren"
+"Update Qty's","Anzahl aktualisieren"
 "Updated","Aktualisiert am"
 "Updated:","Aktualisiert:"
 "Use Aggregated Data (beta)","Gesamtdaten (Beta) verwenden"
@@ -826,7 +826,7 @@
 "Wrong quote item id to update configuration.","Falsche Angebotskennnummer zur Aktualisierung der Konfiguration."
 "Wrong state: ""%s"".","Falscher Zustand: ""%s""."
 "Yes","Ja"
-"You can leave a box blank if you don\'t wish to add a gift message for whole order","Sie können ein Eingabefeld leer lassen, wenn Sie keine Geschenkmitteilung für die gesamte Bestellung hinzufügen möchten."
+"You can leave a box blank if you don't wish to add a gift message for whole order","Sie können ein Eingabefeld leer lassen, wenn Sie keine Geschenkmitteilung für die gesamte Bestellung hinzufügen möchten."
 "You have placed no orders.","Sie haben keine Bestellungen aufgegeben."
 "You will be redirected to the payment system website.","Sie werden zu der Zahlungssystem-Website weitergeleitet."
 "Your credit card will be charged for","Ihre Kreditkarte wird belastet mit"
diff --git a/app/code/Magento/Sales/i18n/en_US.csv b/app/code/Magento/Sales/i18n/en_US.csv
index 8a2e9ffcc2e..48775059282 100644
--- a/app/code/Magento/Sales/i18n/en_US.csv
+++ b/app/code/Magento/Sales/i18n/en_US.csv
@@ -185,7 +185,7 @@
 "Customer My Account Order Invoice View","Customer My Account Order Invoice View"
 "Customer My Account Order Shipment View","Customer My Account Order Shipment View"
 "Customer My Account Order View","Customer My Account Order View"
-"Customer\'s Current Activities","Customer\'s Current Activities"
+"Customer's Current Activities","Customer's Current Activities"
 "Customs Value","Customs Value"
 "Date","Date"
 "Default Status","Default Status"
@@ -319,7 +319,7 @@
 "Key","Key"
 "Last Name","Last Name"
 "Last Ordered Items","Last Ordered Items"
-"Last status can\'t be unassigned from state.","Last status can\'t be unassigned from state."
+"Last status can't be unassigned from state.","Last status can't be unassigned from state."
 "Length","Length"
 "Link to the New Order","Link to the New Order"
 "Link to the Previous Order","Link to the Previous Order"
@@ -805,8 +805,8 @@
 "Unknown Status","Unknown Status"
 "Unsupported transaction type ""%s"".","Unsupported transaction type ""%s""."
 "Update Changes","Update Changes"
-"Update Items and Qty\'s","Update Items and Qty\'s"
-"Update Qty\'s","Update Qty\'s"
+"Update Items and Qty's","Update Items and Qty's"
+"Update Qty's","Update Qty's"
 "Updated","Updated"
 "Updated:","Updated:"
 "Use Aggregated Data (beta)","Use Aggregated Data (beta)"
@@ -829,7 +829,7 @@
 "Wrong quote item id to update configuration.","Wrong quote item id to update configuration."
 "Wrong state: ""%s"".","Wrong state: ""%s""."
 "Yes","Yes"
-"You can leave a box blank if you don\'t wish to add a gift message for whole order","You can leave a box blank if you don\'t wish to add a gift message for whole order"
+"You can leave a box blank if you don't wish to add a gift message for whole order","You can leave a box blank if you don't wish to add a gift message for whole order"
 "You have placed no orders.","You have placed no orders."
 "You will be redirected to the payment system website.","You will be redirected to the payment system website."
 "Your credit card will be charged for","Your credit card will be charged for"
diff --git a/app/code/Magento/Sales/i18n/es_ES.csv b/app/code/Magento/Sales/i18n/es_ES.csv
index 03b03053b27..2d3fd7df75d 100644
--- a/app/code/Magento/Sales/i18n/es_ES.csv
+++ b/app/code/Magento/Sales/i18n/es_ES.csv
@@ -184,7 +184,7 @@
 "Customer My Account Order Invoice View","Vista de la factura del pedido de «mi cuenta» del cliente"
 "Customer My Account Order Shipment View","Vista del envío del pedido de «mi cuenta» del cliente"
 "Customer My Account Order View","Vista del pedido de «mi cuenta» del cliente"
-"Customer\'s Current Activities","Actividades actuales del cliente"
+"Customer's Current Activities","Actividades actuales del cliente"
 "Customs Value","Valor en Aduana"
 "Date","Fecha"
 "Default Status","Estado por defecto"
@@ -317,7 +317,7 @@
 "Key","Clave"
 "Last Name","Apellido del cliente"
 "Last Ordered Items","Últimos Artículos Pedidos"
-"Last status can\'t be unassigned from state.","El último estado no puede estar sin asignar desde estado."
+"Last status can't be unassigned from state.","El último estado no puede estar sin asignar desde estado."
 "Length","Longitud"
 "Link to the New Order","Enlace al Nuevo Pedido"
 "Link to the Previous Order","Enlace al Pedido Anterior"
@@ -803,8 +803,8 @@ No hay etiquetas de envío para las %s seleccionadas. [[[if %s is feminine]]]"
 "Unknown Status","Estados desconocidos"
 "Unsupported transaction type ""%s"".","Tipo de transacción no admitida""%s""."
 "Update Changes","Actualizar Cambios"
-"Update Items and Qty\'s","Actualizar artículos y cantidades"
-"Update Qty\'s","Actualizar Cantidad/es"
+"Update Items and Qty's","Actualizar artículos y cantidades"
+"Update Qty's","Actualizar Cantidad/es"
 "Updated","Hora de actualización"
 "Updated:","Actualizado:"
 "Use Aggregated Data (beta)","Utilizar datos agregados (beta)"
@@ -827,7 +827,7 @@ No hay etiquetas de envío para las %s seleccionadas. [[[if %s is feminine]]]"
 "Wrong quote item id to update configuration.","Número identificativo del artículo incorrecto para actualizar la configuración."
 "Wrong state: ""%s"".","Estado incorrecto: ""%s""."
 "Yes","Sí"
-"You can leave a box blank if you don\'t wish to add a gift message for whole order","Puedes dejar un campo en blanco si no deseas añadir un mensaje de regalo con el pedido"
+"You can leave a box blank if you don't wish to add a gift message for whole order","Puedes dejar un campo en blanco si no deseas añadir un mensaje de regalo con el pedido"
 "You have placed no orders.","No has hecho ningún pedido."
 "You will be redirected to the payment system website.","Usted será redirigido a la página web del sistema de pago."
 "Your credit card will be charged for","Se cargará en tu tarjeta de crédito"
diff --git a/app/code/Magento/Sales/i18n/fr_FR.csv b/app/code/Magento/Sales/i18n/fr_FR.csv
index 49ac8d5789d..a0665240cfc 100644
--- a/app/code/Magento/Sales/i18n/fr_FR.csv
+++ b/app/code/Magento/Sales/i18n/fr_FR.csv
@@ -184,7 +184,7 @@
 "Customer My Account Order Invoice View","Client Mon Compte Commande Facture Affichage"
 "Customer My Account Order Shipment View","Client Mon Compte Commande Livraison Affichage"
 "Customer My Account Order View","Client Mon Compte Commande Affichage"
-"Customer\'s Current Activities","Activités en cours du client"
+"Customer's Current Activities","Activités en cours du client"
 "Customs Value","Valeurs personnalisées"
 "Date","Date"
 "Default Status","État pas défaut"
@@ -317,7 +317,7 @@
 "Key","Clé"
 "Last Name","Nom du client"
 "Last Ordered Items","Derniers articles commandés"
-"Last status can\'t be unassigned from state.","Le dernier statut ne peut pas être retiré de l'État."
+"Last status can't be unassigned from state.","Le dernier statut ne peut pas être retiré de l'État."
 "Length","Longueur"
 "Link to the New Order","Lien vers la nouvelle commande"
 "Link to the Previous Order","Lien vers la commande précédente"
@@ -802,8 +802,8 @@
 "Unknown Status","Statut inconnu"
 "Unsupported transaction type ""%s"".","Type de transaction inconnu ""%s""."
 "Update Changes","Mettre à jour les changements"
-"Update Items and Qty\'s","Mettre à jour les articles et quantités"
-"Update Qty\'s","Mettre à jour la/les Qté(s)"
+"Update Items and Qty's","Mettre à jour les articles et quantités"
+"Update Qty's","Mettre à jour la/les Qté(s)"
 "Updated","Mis à jour à"
 "Updated:","Mis à jour :"
 "Use Aggregated Data (beta)","Utiliser données agrégées (beta)"
@@ -826,7 +826,7 @@
 "Wrong quote item id to update configuration.","L'identification du produit sélectionné est incorrecte et la configuration ne peut pas être mise à jour."
 "Wrong state: ""%s"".","État incorrect : ""%s""."
 "Yes","oui"
-"You can leave a box blank if you don\'t wish to add a gift message for whole order","Vous pouvez laisser une case vide si vous ne voulez pas ajouter un message de cadeau pour l'ensemble de la commande"
+"You can leave a box blank if you don't wish to add a gift message for whole order","Vous pouvez laisser une case vide si vous ne voulez pas ajouter un message de cadeau pour l'ensemble de la commande"
 "You have placed no orders.","Vous n'avez pas de commande."
 "You will be redirected to the payment system website.","Vous allez être redirigé vers le site de paiement en ligne."
 "Your credit card will be charged for","Votre carte de crédit sera débitée pour"
diff --git a/app/code/Magento/Sales/i18n/nl_NL.csv b/app/code/Magento/Sales/i18n/nl_NL.csv
index 1c4961b6037..d881fdfbc96 100644
--- a/app/code/Magento/Sales/i18n/nl_NL.csv
+++ b/app/code/Magento/Sales/i18n/nl_NL.csv
@@ -184,7 +184,7 @@
 "Customer My Account Order Invoice View","Klant mijn rekening bestelling factuur weergave"
 "Customer My Account Order Shipment View","Klant mijn rekening bestelling verzending weergave"
 "Customer My Account Order View","Klant mijn rekening bestelling weergave"
-"Customer\'s Current Activities","Recente bezigheden van de klant"
+"Customer's Current Activities","Recente bezigheden van de klant"
 "Customs Value","Douanewaarde"
 "Date","Datum"
 "Default Status","Standaard Status"
@@ -317,7 +317,7 @@
 "Key","sleutel"
 "Last Name","Klant Achternaam"
 "Last Ordered Items","laatst bestelde items"
-"Last status can\'t be unassigned from state.","Laatste status kan niet vanuit staat herbenoemd worden."
+"Last status can't be unassigned from state.","Laatste status kan niet vanuit staat herbenoemd worden."
 "Length","Lengte"
 "Link to the New Order","link naar de nieuwe bestelling"
 "Link to the Previous Order","link naar de vorige bestelling"
@@ -802,8 +802,8 @@
 "Unknown Status","Onbekende Status"
 "Unsupported transaction type ""%s"".","Niet ondersteund transactie type ""%s""."
 "Update Changes","Bijwerken Veranderingen"
-"Update Items and Qty\'s","aanpassen items en hoeveelheden"
-"Update Qty\'s","Aantal(en) bijwerken"
+"Update Items and Qty's","aanpassen items en hoeveelheden"
+"Update Qty's","Aantal(en) bijwerken"
 "Updated","Geüpdate op"
 "Updated:","Bijgewerkt:"
 "Use Aggregated Data (beta)","Gebruik Verzamelde Data (beta)"
@@ -826,7 +826,7 @@
 "Wrong quote item id to update configuration.","Verkeerde quote artikel id voor update configuratie."
 "Wrong state: ""%s"".","Verkeerde status: ""%s""."
 "Yes","Ja"
-"You can leave a box blank if you don\'t wish to add a gift message for whole order","U kunt een doos leeg laten als u geen cadeauboodschap voor de hele bestelling wilt toevoegen"
+"You can leave a box blank if you don't wish to add a gift message for whole order","U kunt een doos leeg laten als u geen cadeauboodschap voor de hele bestelling wilt toevoegen"
 "You have placed no orders.","U heeft geen bestellingen geplaatst."
 "You will be redirected to the payment system website.","U zal worden omgeleid naar de website van het betalingssysteem."
 "Your credit card will be charged for","Uw creditcard zal in rekening gebracht worden voor"
diff --git a/app/code/Magento/Sales/i18n/pt_BR.csv b/app/code/Magento/Sales/i18n/pt_BR.csv
index 1db1b6174aa..5c6df9024fb 100644
--- a/app/code/Magento/Sales/i18n/pt_BR.csv
+++ b/app/code/Magento/Sales/i18n/pt_BR.csv
@@ -184,7 +184,7 @@
 "Customer My Account Order Invoice View","Ver Faturamento do Pedido do Cliente"
 "Customer My Account Order Shipment View","Ver Pedidos Pagos do Cliente"
 "Customer My Account Order View","Ver Pedido do Cliente"
-"Customer\'s Current Activities","Atividades Atuais do Cliente"
+"Customer's Current Activities","Atividades Atuais do Cliente"
 "Customs Value","Valores Aduaneiros"
 "Date","Data"
 "Default Status","Status Padrão"
@@ -317,7 +317,7 @@
 "Key","Senha"
 "Last Name","Último Nome do Cliente"
 "Last Ordered Items","Últimos itens pedidos"
-"Last status can\'t be unassigned from state.","O último estado não pode ser revertido."
+"Last status can't be unassigned from state.","O último estado não pode ser revertido."
 "Length","Comprimento"
 "Link to the New Order","Link para o Novo Pedido"
 "Link to the Previous Order","Link para o Pedido Anterior"
@@ -802,8 +802,8 @@
 "Unknown Status","Status desconhecido"
 "Unsupported transaction type ""%s"".","O tipo de transação ""%s"" não é suportado."
 "Update Changes","Atualizar alterações"
-"Update Items and Qty\'s","Atualizar Itens e Quantidades"
-"Update Qty\'s","Atualizar qtde."
+"Update Items and Qty's","Atualizar Itens e Quantidades"
+"Update Qty's","Atualizar qtde."
 "Updated","Atualizado Em"
 "Updated:","Atualizado:"
 "Use Aggregated Data (beta)","Usar dados agregados (beta)"
@@ -826,7 +826,7 @@
 "Wrong quote item id to update configuration.","ID da cotação do item errada para atualizar configuração."
 "Wrong state: ""%s"".","Estado inadequado: ""%s""."
 "Yes","Sim"
-"You can leave a box blank if you don\'t wish to add a gift message for whole order","Você pode deixar um quadro em branco se não desejar adicionar uma mensagem pessoal para todo o pedido"
+"You can leave a box blank if you don't wish to add a gift message for whole order","Você pode deixar um quadro em branco se não desejar adicionar uma mensagem pessoal para todo o pedido"
 "You have placed no orders.","Não há pedidos feitos."
 "You will be redirected to the payment system website.","Você será redirecionado para o site de sistema de pagamentos."
 "Your credit card will be charged for","O seu cartão de crédito será cobrado por"
diff --git a/app/code/Magento/Sales/i18n/zh_CN.csv b/app/code/Magento/Sales/i18n/zh_CN.csv
index 535be8dcca5..a4b95be64c3 100644
--- a/app/code/Magento/Sales/i18n/zh_CN.csv
+++ b/app/code/Magento/Sales/i18n/zh_CN.csv
@@ -184,7 +184,7 @@
 "Customer My Account Order Invoice View","客户我的帐户订单发票视图"
 "Customer My Account Order Shipment View","客户我的帐户订单发货视图"
 "Customer My Account Order View","客户我的帐户订单视图"
-"Customer\'s Current Activities","客户的当前活动"
+"Customer's Current Activities","客户的当前活动"
 "Customs Value","自定义值"
 "Date","日期"
 "Default Status","默认状态"
@@ -317,7 +317,7 @@
 "Key","密钥"
 "Last Name","客户姓氏"
 "Last Ordered Items","上次订购的商品"
-"Last status can\'t be unassigned from state.","上次状态无法被取消分配。"
+"Last status can't be unassigned from state.","上次状态无法被取消分配。"
 "Length","长度"
 "Link to the New Order","链接到新订单"
 "Link to the Previous Order","连接到前一订单"
@@ -802,8 +802,8 @@
 "Unknown Status","位置状态"
 "Unsupported transaction type ""%s"".","不支持的交易类型""%s""。"
 "Update Changes","更新更改"
-"Update Items and Qty\'s","更新项目与数量"
-"Update Qty\'s","更新数量"
+"Update Items and Qty's","更新项目与数量"
+"Update Qty's","更新数量"
 "Updated","更新于"
 "Updated:","更新时间:"
 "Use Aggregated Data (beta)","使用聚合数据(测试版)"
@@ -826,7 +826,7 @@
 "Wrong quote item id to update configuration.","更新配置的报价项目ID错误。"
 "Wrong state: ""%s"".","州错误:""%s"""
 "Yes","是"
-"You can leave a box blank if you don\'t wish to add a gift message for whole order","如果不希望为整个订单添加礼品信息,即可在这里留空"
+"You can leave a box blank if you don't wish to add a gift message for whole order","如果不希望为整个订单添加礼品信息,即可在这里留空"
 "You have placed no orders.","您没有下订单。"
 "You will be redirected to the payment system website.","您将被重定向到支付系统网站。"
 "Your credit card will be charged for","您的信用卡将被收取"
diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit.php
index a688a137a2d..ec9ee97ec9a 100644
--- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit.php
+++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit.php
@@ -35,18 +35,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Actions.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Actions.php
index b0f66bc8acf..b1725fcc90a 100644
--- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Actions.php
+++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Actions.php
@@ -49,7 +49,7 @@ class Actions
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Backend\Model\Config\Source\Yesno $sourceYesno
      * @param \Magento\Rule\Block\Actions $ruleActions
@@ -58,7 +58,7 @@ class Actions
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Backend\Model\Config\Source\Yesno $sourceYesno,
         \Magento\Rule\Block\Actions $ruleActions,
diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php
index 8eda9026e69..8bebe422b71 100644
--- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php
+++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php
@@ -44,7 +44,7 @@ class Conditions
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Rule\Block\Conditions $conditions
      * @param \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset
@@ -52,7 +52,7 @@ class Conditions
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Rule\Block\Conditions $conditions,
         \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset,
diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons.php
index 91ba7cbf264..47369de617b 100644
--- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons.php
+++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons.php
@@ -40,18 +40,18 @@ class Coupons
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\View\Element\Context $context
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Form.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Form.php
index 3be37751cff..7c4f41896ea 100644
--- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Form.php
+++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Form.php
@@ -46,14 +46,14 @@ class Form
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\SalesRule\Helper\Coupon $salesRuleCoupon
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\SalesRule\Helper\Coupon $salesRuleCoupon,
         array $data = array()
diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid.php
index 35da87ab0f2..55fba8af09f 100644
--- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid.php
+++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid.php
@@ -39,7 +39,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -52,14 +52,14 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\SalesRule\Model\Resource\Coupon\CollectionFactory $salesRuleCoupon
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\SalesRule\Model\Resource\Coupon\CollectionFactory $salesRuleCoupon,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php
index 8e6a54f6d06..111f2fd2e44 100644
--- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php
+++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php
@@ -54,7 +54,7 @@ class Main
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\SalesRule\Model\RuleFactory $salesRule
      * @param \Magento\Customer\Model\Resource\Group\CollectionFactory $customerGroup
@@ -63,7 +63,7 @@ class Main
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\SalesRule\Model\RuleFactory $salesRule,
         \Magento\Customer\Model\Resource\Group\CollectionFactory $customerGroup,
diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php
index f7c88fa3de7..38e4b7b5192 100644
--- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php
+++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php
@@ -31,7 +31,7 @@ class Quote extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -47,13 +47,13 @@ class Quote extends \Magento\Backend\App\Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\App\Response\Http\FileFactory $fileFactory
      * @param \Magento\Core\Filter\Date $dateFilter
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\App\Response\Http\FileFactory $fileFactory,
         \Magento\Core\Filter\Date $dateFilter
     ) {
diff --git a/app/code/Magento/SalesRule/Model/Coupon.php b/app/code/Magento/SalesRule/Model/Coupon.php
index 36b685d2152..248a12c4824 100644
--- a/app/code/Magento/SalesRule/Model/Coupon.php
+++ b/app/code/Magento/SalesRule/Model/Coupon.php
@@ -24,6 +24,7 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\SalesRule\Model;
 
 /**
  * SalesRule Coupon Model
@@ -46,13 +47,7 @@
  * @method \Magento\SalesRule\Model\Coupon setIsPrimary(int $value)
  * @method int getType()
  * @method \Magento\SalesRule\Model\Coupon setType(int $value)
- *
- * @category    Magento
- * @package     Magento_SalesRule
- * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\SalesRule\Model;
-
 class Coupon extends \Magento\Core\Model\AbstractModel
 {
     /**
diff --git a/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php b/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php
index e86ccc31a38..bae822660e9 100644
--- a/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php
+++ b/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php
@@ -74,8 +74,8 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel
     protected $dateTime;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\SalesRule\Helper\Coupon $salesRuleCoupon
      * @param \Magento\SalesRule\Model\CouponFactory $couponFactory
      * @param \Magento\Core\Model\Date $date
@@ -85,8 +85,8 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\SalesRule\Helper\Coupon $salesRuleCoupon,
         \Magento\SalesRule\Model\CouponFactory $couponFactory,
         \Magento\Core\Model\Date $date,
diff --git a/app/code/Magento/SalesRule/Model/Quote/Discount.php b/app/code/Magento/SalesRule/Model/Quote/Discount.php
index fa4f2e77884..9e3d5bd6ad4 100644
--- a/app/code/Magento/SalesRule/Model/Quote/Discount.php
+++ b/app/code/Magento/SalesRule/Model/Quote/Discount.php
@@ -93,6 +93,7 @@ class Discount extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal
 
         $address->setDiscountDescription(array());
 
+        $items = $this->_calculator->sortItemsByPriority($items);
         foreach ($items as $item) {
             if ($item->getNoDiscount()) {
                 $item->setDiscountAmount(0);
diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php b/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php
index 0e108fc7da0..842b37aae9d 100644
--- a/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php
+++ b/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php
@@ -114,20 +114,33 @@ class Collection extends \Magento\Rule\Model\Resource\Rule\Collection\AbstractCo
             $this->addWebsiteGroupDateFilter($websiteId, $customerGroupId, $now);
             $select = $this->getSelect();
 
+            $connection = $this->getConnection();
             if (strlen($couponCode)) {
                 $select->joinLeft(
                     array('rule_coupons' => $this->getTable('salesrule_coupon')),
-                    'main_table.rule_id = rule_coupons.rule_id ',
+                    $connection->quoteInto(
+                        'main_table.rule_id = rule_coupons.rule_id AND main_table.coupon_type != ?',
+                        \Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON
+                    ),
                     array('code')
                 );
-            $select->where('(main_table.coupon_type = ? ', \Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON)
-                ->orWhere('(main_table.coupon_type = ? AND rule_coupons.type = 0',
-                    \Magento\SalesRule\Model\Rule::COUPON_TYPE_AUTO)
-                ->orWhere('main_table.coupon_type = ? AND main_table.use_auto_generation = 1 ' .
-                    'AND rule_coupons.type = 1', \Magento\SalesRule\Model\Rule::COUPON_TYPE_SPECIFIC)
-                ->orWhere('main_table.coupon_type = ? AND main_table.use_auto_generation = 0 ' .
-                    'AND rule_coupons.type = 0)', \Magento\SalesRule\Model\Rule::COUPON_TYPE_SPECIFIC)
-                ->where('rule_coupons.code = ?)', $couponCode);
+                $select->where('main_table.coupon_type = ? ', \Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON);
+                $orWhereConditions = array(
+                    $connection->quoteInto(
+                        '(main_table.coupon_type = ? AND rule_coupons.type = 0)',
+                        \Magento\SalesRule\Model\Rule::COUPON_TYPE_AUTO
+                    ),
+                    $connection->quoteInto(
+                        '(main_table.coupon_type = ? AND main_table.use_auto_generation = 1 AND rule_coupons.type = 1)',
+                        \Magento\SalesRule\Model\Rule::COUPON_TYPE_SPECIFIC
+                    ),
+                    $connection->quoteInto(
+                        '(main_table.coupon_type = ? AND main_table.use_auto_generation = 0 AND rule_coupons.type = 0)',
+                        \Magento\SalesRule\Model\Rule::COUPON_TYPE_SPECIFIC
+                    ),
+                );
+                $orWhereCondition = implode(' OR ', $orWhereConditions);
+                $select->orWhere('(' . $orWhereCondition . ') AND rule_coupons.code = ?', $couponCode);
             } else {
                 $this->addFieldToFilter('main_table.coupon_type', \Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON);
             }
diff --git a/app/code/Magento/SalesRule/Model/Rule.php b/app/code/Magento/SalesRule/Model/Rule.php
index 7b23e8c21db..7e399929555 100644
--- a/app/code/Magento/SalesRule/Model/Rule.php
+++ b/app/code/Magento/SalesRule/Model/Rule.php
@@ -24,6 +24,7 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\SalesRule\Model;
 
 /**
  * Shopping Cart Rule data model
@@ -81,13 +82,9 @@
  * @method \Magento\SalesRule\Model\Rule setUseAutoGeneration(int $value)
  * @method string getCouponCode()
  * @method \Magento\SalesRule\Model\Rule setCouponCode(string $value)
- *
- * @category    Magento
- * @package     Magento_SalesRule
- * @author      Magento Core Team <core@magentocommerce.com>
+ * @method int getRuleId()
+ * @method \Magento\SalesRule\Model\Rule setRuleId(int $ruleId)
  */
-namespace Magento\SalesRule\Model;
-
 class Rule extends \Magento\Rule\Model\AbstractModel
 {
     /**
@@ -208,8 +205,8 @@ class Rule extends \Magento\Rule\Model\AbstractModel
     protected $_storeManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param \Magento\SalesRule\Model\CouponFactory $couponFactory
@@ -223,8 +220,8 @@ class Rule extends \Magento\Rule\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\LocaleInterface $locale,
         \Magento\SalesRule\Model\CouponFactory $couponFactory,
diff --git a/app/code/Magento/SalesRule/Model/Rule/Action/Discount/AbstractDiscount.php b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/AbstractDiscount.php
new file mode 100644
index 00000000000..05eef8ffe18
--- /dev/null
+++ b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/AbstractDiscount.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+abstract class AbstractDiscount implements DiscountInterface
+{
+    /**
+     * @var \Magento\SalesRule\Model\Rule\Action\Discount\DataFactory
+     */
+    protected $discountFactory;
+
+    /**
+     * @var \Magento\SalesRule\Model\Validator
+     */
+    protected $validator;
+
+    /**
+     * @param \Magento\SalesRule\Model\Validator $validator
+     * @param \Magento\SalesRule\Model\Rule\Action\Discount\DataFactory $discountDataFactory
+     */
+    public function __construct(
+        \Magento\SalesRule\Model\Validator $validator,
+        \Magento\SalesRule\Model\Rule\Action\Discount\DataFactory $discountDataFactory
+    ) {
+        $this->validator = $validator;
+        $this->discountFactory = $discountDataFactory;
+    }
+
+    /**
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param float $qty
+     * @return \Magento\SalesRule\Model\Rule\Action\Discount\Data
+     */
+    abstract public function calculate($rule, $item, $qty);
+
+    /**
+     * @param float $qty
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @return float
+     */
+    public function fixQuantity($qty, $rule)
+    {
+        return $qty;
+    }
+}
diff --git a/app/code/Magento/SalesRule/Model/Rule/Action/Discount/BuyXGetY.php b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/BuyXGetY.php
new file mode 100644
index 00000000000..02ee578653c
--- /dev/null
+++ b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/BuyXGetY.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+class BuyXGetY extends AbstractDiscount
+{
+    /**
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param float $qty
+     * @return \Magento\SalesRule\Model\Rule\Action\Discount\Data
+     */
+    public function calculate($rule, $item, $qty)
+    {
+        /** @var \Magento\SalesRule\Model\Rule\Action\Discount\Data $discountData */
+        $discountData = $this->discountFactory->create();
+
+        $itemPrice              = $this->validator->getItemPrice($item);
+        $baseItemPrice          = $this->validator->getItemBasePrice($item);
+        $itemOriginalPrice      = $this->validator->getItemOriginalPrice($item);
+        $baseItemOriginalPrice  = $this->validator->getItemBaseOriginalPrice($item);
+
+        $x = $rule->getDiscountStep();
+        $y = $rule->getDiscountAmount();
+        if (!$x || $y > $x) {
+            return $discountData;
+        }
+        $buyAndDiscountQty = $x + $y;
+
+        $fullRuleQtyPeriod = floor($qty / $buyAndDiscountQty);
+        $freeQty  = $qty - $fullRuleQtyPeriod * $buyAndDiscountQty;
+
+        $discountQty = $fullRuleQtyPeriod * $y;
+        if ($freeQty > $x) {
+            $discountQty += $freeQty - $x;
+        }
+
+        $discountData->setAmount($discountQty * $itemPrice);
+        $discountData->setBaseAmount($discountQty * $baseItemPrice);
+        $discountData->setOriginalAmount($discountQty * $itemOriginalPrice);
+        $discountData->setBaseOriginalAmount($discountQty * $baseItemOriginalPrice);
+
+        return $discountData;
+    }
+}
diff --git a/app/code/Magento/SalesRule/Model/Rule/Action/Discount/ByFixed.php b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/ByFixed.php
new file mode 100644
index 00000000000..cfba0e29828
--- /dev/null
+++ b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/ByFixed.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+class ByFixed extends AbstractDiscount
+{
+    /**
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param float $qty
+     * @return \Magento\SalesRule\Model\Rule\Action\Discount\Data
+     */
+    public function calculate($rule, $item, $qty)
+    {
+        /** @var \Magento\SalesRule\Model\Rule\Action\Discount\Data $discountData */
+        $discountData = $this->discountFactory->create();
+
+        $quoteAmount = $item->getQuote()->getStore()->convertPrice($rule->getDiscountAmount());
+        $discountData->setAmount($qty * $quoteAmount);
+        $discountData->setBaseAmount($qty * $rule->getDiscountAmount());
+
+        return $discountData;
+    }
+
+    /**
+     * @param float $qty
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @return float
+     */
+    public function fixQuantity($qty, $rule)
+    {
+        $step = $rule->getDiscountStep();
+        if ($step) {
+            $qty = floor($qty / $step) * $step;
+        }
+
+        return $qty;
+    }
+}
diff --git a/app/code/Magento/SalesRule/Model/Rule/Action/Discount/ByPercent.php b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/ByPercent.php
new file mode 100644
index 00000000000..8c869917594
--- /dev/null
+++ b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/ByPercent.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+class ByPercent extends AbstractDiscount
+{
+    /**
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param float $qty
+     * @return Data
+     */
+    public function calculate($rule, $item, $qty)
+    {
+        $rulePercent = min(100, $rule->getDiscountAmount());
+        $discountData = $this->_calculate($rule, $item, $qty, $rulePercent);
+
+        return $discountData;
+    }
+
+    /**
+     * @param float $qty
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @return float
+     */
+    public function fixQuantity($qty, $rule)
+    {
+        $step = $rule->getDiscountStep();
+        if ($step) {
+            $qty = floor($qty / $step) * $step;
+        }
+
+        return $qty;
+    }
+
+    /**
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param float $qty
+     * @param $rulePercent
+     * @return Data
+     */
+    protected function _calculate($rule, $item, $qty, $rulePercent)
+    {
+        /** @var \Magento\SalesRule\Model\Rule\Action\Discount\Data $discountData */
+        $discountData = $this->discountFactory->create();
+
+        $itemPrice              = $this->validator->getItemPrice($item);
+        $baseItemPrice          = $this->validator->getItemBasePrice($item);
+        $itemOriginalPrice      = $this->validator->getItemOriginalPrice($item);
+        $baseItemOriginalPrice  = $this->validator->getItemBaseOriginalPrice($item);
+
+        $_rulePct = $rulePercent / 100;
+        $discountData->setAmount(($qty * $itemPrice - $item->getDiscountAmount()) * $_rulePct);
+        $discountData->setBaseAmount(($qty * $baseItemPrice - $item->getBaseDiscountAmount()) * $_rulePct);
+        $discountData->setOriginalAmount(
+            ($qty * $itemOriginalPrice - $item->getDiscountAmount()) * $_rulePct
+        );
+        $discountData->setBaseOriginalAmount(
+            ($qty * $baseItemOriginalPrice - $item->getDiscountAmount()) * $_rulePct
+        );
+
+        if (!$rule->getDiscountQty() || $rule->getDiscountQty() > $qty) {
+            $discountPercent = min(100, $item->getDiscountPercent() + $rulePercent);
+            $item->setDiscountPercent($discountPercent);
+        }
+
+        return $discountData;
+    }
+}
diff --git a/app/code/Magento/SalesRule/Model/Rule/Action/Discount/CalculatorFactory.php b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/CalculatorFactory.php
new file mode 100644
index 00000000000..bd86e1a57a4
--- /dev/null
+++ b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/CalculatorFactory.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+class CalculatorFactory
+{
+    /**
+     * Object manager
+     *
+     * @var \Magento\ObjectManager
+     */
+    private $_objectManager;
+
+    protected $classByType = array(
+        \Magento\SalesRule\Model\Rule::TO_PERCENT_ACTION  => 'Magento\SalesRule\Model\Rule\Action\Discount\ToPercent',
+        \Magento\SalesRule\Model\Rule::BY_PERCENT_ACTION  => 'Magento\SalesRule\Model\Rule\Action\Discount\ByPercent',
+        \Magento\SalesRule\Model\Rule::TO_FIXED_ACTION    => 'Magento\SalesRule\Model\Rule\Action\Discount\ToFixed',
+        \Magento\SalesRule\Model\Rule::BY_FIXED_ACTION    => 'Magento\SalesRule\Model\Rule\Action\Discount\ByFixed',
+        \Magento\SalesRule\Model\Rule::CART_FIXED_ACTION  => 'Magento\SalesRule\Model\Rule\Action\Discount\CartFixed',
+        \Magento\SalesRule\Model\Rule::BUY_X_GET_Y_ACTION => 'Magento\SalesRule\Model\Rule\Action\Discount\BuyXGetY',
+    );
+
+    /**
+     * @param \Magento\ObjectManager $objectManager
+     * @param array $discountRules
+     */
+    public function __construct(\Magento\ObjectManager $objectManager, array $discountRules = array())
+    {
+        $this->classByType = array_merge($this->classByType, $discountRules);
+        $this->_objectManager = $objectManager;
+    }
+
+    /**
+     * @param string $type
+     * @return \Magento\SalesRule\Model\Rule\Action\Discount\DiscountInterface
+     * @throws \InvalidArgumentException
+     */
+    public function create($type)
+    {
+        if (!isset($this->classByType[$type])) {
+            throw new \InvalidArgumentException($type . ' is unknown type');
+        }
+
+        return $this->_objectManager->create($this->classByType[$type]);
+    }
+}
diff --git a/app/code/Magento/SalesRule/Model/Rule/Action/Discount/CartFixed.php b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/CartFixed.php
new file mode 100644
index 00000000000..2d3c5d3d3cd
--- /dev/null
+++ b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/CartFixed.php
@@ -0,0 +1,128 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+class CartFixed extends AbstractDiscount
+{
+    /**
+     * Store information about addresses which cart fixed rule applied for
+     *
+     * @var int[]
+     */
+    protected $_cartFixedRuleUsedForAddress = array();
+
+    /**
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param float $qty
+     * @return \Magento\SalesRule\Model\Rule\Action\Discount\Data
+     */
+    public function calculate($rule, $item, $qty)
+    {
+        /** @var \Magento\SalesRule\Model\Rule\Action\Discount\Data $discountData */
+        $discountData = $this->discountFactory->create();
+
+        $ruleTotals = $this->validator->getRuleItemTotalsInfo($rule->getId());
+
+        $quote = $item->getQuote();
+        $address = $item->getAddress();
+
+        $itemPrice              = $this->validator->getItemPrice($item);
+        $baseItemPrice          = $this->validator->getItemBasePrice($item);
+        $itemOriginalPrice      = $this->validator->getItemOriginalPrice($item);
+        $baseItemOriginalPrice  = $this->validator->getItemBaseOriginalPrice($item);
+
+        /**
+         * prevent applying whole cart discount for every shipping order, but only for first order
+         */
+        if ($quote->getIsMultiShipping()) {
+            $usedForAddressId = $this->getCartFixedRuleUsedForAddress($rule->getId());
+            if ($usedForAddressId && $usedForAddressId != $address->getId()) {
+                return $discountData;
+            } else {
+                $this->setCartFixedRuleUsedForAddress($rule->getId(), $address->getId());
+            }
+        }
+        $cartRules = $address->getCartFixedRules();
+        if (!isset($cartRules[$rule->getId()])) {
+            $cartRules[$rule->getId()] = $rule->getDiscountAmount();
+        }
+
+        if ($cartRules[$rule->getId()] > 0) {
+            $store = $quote->getStore();
+            if ($ruleTotals['items_count'] <= 1) {
+                $quoteAmount = $store->convertPrice($cartRules[$rule->getId()]);
+                $baseDiscountAmount = min($baseItemPrice * $qty, $cartRules[$rule->getId()]);
+            } else {
+                $discountRate = $baseItemPrice * $qty / $ruleTotals['base_items_price'];
+                $maximumItemDiscount = $rule->getDiscountAmount() * $discountRate;
+                $quoteAmount = $store->convertPrice($maximumItemDiscount);
+
+                $baseDiscountAmount = min($baseItemPrice * $qty, $maximumItemDiscount);
+                $this->validator->decrementRuleItemTotalsCount($rule->getId());
+            }
+
+            $baseDiscountAmount = $store->roundPrice($baseDiscountAmount);
+
+            $cartRules[$rule->getId()] -= $baseDiscountAmount;
+
+            $discountData->setAmount($store->roundPrice(min($itemPrice * $qty, $quoteAmount)));
+            $discountData->setBaseAmount($baseDiscountAmount);
+            $discountData->setOriginalAmount(min($itemOriginalPrice * $qty, $quoteAmount));
+            $discountData->setBaseOriginalAmount($store->roundPrice($baseItemOriginalPrice));
+        }
+        $address->setCartFixedRules($cartRules);
+
+        return $discountData;
+    }
+
+    /**
+     * Set information about usage cart fixed rule by quote address
+     *
+     * @param int $ruleId
+     * @param int $itemId
+     * @return void
+     */
+    protected function setCartFixedRuleUsedForAddress($ruleId, $itemId)
+    {
+        $this->_cartFixedRuleUsedForAddress[$ruleId] = $itemId;
+    }
+
+    /**
+     * Retrieve information about usage cart fixed rule by quote address
+     *
+     * @param int $ruleId
+     * @return int|null
+     */
+    protected function getCartFixedRuleUsedForAddress($ruleId)
+    {
+        if (isset($this->_cartFixedRuleUsedForAddress[$ruleId])) {
+            return $this->_cartFixedRuleUsedForAddress[$ruleId];
+        }
+        return null;
+    }
+}
diff --git a/app/code/Magento/SalesRule/Model/Rule/Action/Discount/Data.php b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/Data.php
new file mode 100644
index 00000000000..ab2b25a029f
--- /dev/null
+++ b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/Data.php
@@ -0,0 +1,134 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+class Data
+{
+    /**
+     * @var float
+     */
+    protected $amount;
+
+    /**
+     * @var float
+     */
+    protected $baseAmount;
+
+    /**
+     * @var float
+     */
+    protected $originalAmount;
+
+    /**
+     * @var float
+     */
+    protected $baseOriginalAmount;
+
+    public function __construct()
+    {
+        $this->setAmount(0);
+        $this->setBaseAmount(0);
+        $this->setOriginalAmount(0);
+        $this->setBaseOriginalAmount(0);
+    }
+
+    /**
+     * @param float $amount
+     * @return $this
+     */
+    public function setAmount($amount)
+    {
+        $this->amount = $amount;
+        return $this;
+    }
+
+    /**
+     * @return float
+     */
+    public function getAmount()
+    {
+        return $this->amount;
+    }
+
+    /**
+     * @param float $baseAmount
+     * @return $this
+     */
+    public function setBaseAmount($baseAmount)
+    {
+        $this->baseAmount = $baseAmount;
+        return $this;
+    }
+
+    /**
+     * @return float
+     */
+    public function getBaseAmount()
+    {
+        return $this->baseAmount;
+    }
+
+    /**
+     * @param float $originalAmount
+     * @return $this
+     */
+    public function setOriginalAmount($originalAmount)
+    {
+        $this->originalAmount = $originalAmount;
+        return $this;
+    }
+
+    /**
+     * Get discount for original price
+     *
+     * @return float
+     */
+    public function getOriginalAmount()
+    {
+        return $this->originalAmount;
+    }
+
+    /**
+     * @param float $baseOriginalAmount
+     * @return $this
+     */
+    public function setBaseOriginalAmount($baseOriginalAmount)
+    {
+        $this->baseOriginalAmount = $baseOriginalAmount;
+        return $this;
+    }
+
+    /**
+     * Get discount for original price
+     *
+     * @return float
+     */
+    public function getBaseOriginalAmount()
+    {
+        return $this->baseOriginalAmount;
+    }
+}
diff --git a/app/code/Magento/SalesRule/Model/Rule/Action/Discount/DiscountInterface.php b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/DiscountInterface.php
new file mode 100644
index 00000000000..62005361ca1
--- /dev/null
+++ b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/DiscountInterface.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+interface DiscountInterface
+{
+    /**
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param float $qty
+     * @return \Magento\SalesRule\Model\Rule\Action\Discount\Data
+     */
+    public function calculate($rule, $item, $qty);
+
+    /**
+     * @param float $qty
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @return float
+     */
+    public function fixQuantity($qty, $rule);
+}
diff --git a/app/code/Magento/SalesRule/Model/Rule/Action/Discount/ToFixed.php b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/ToFixed.php
new file mode 100644
index 00000000000..486ac981ae5
--- /dev/null
+++ b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/ToFixed.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+class ToFixed extends AbstractDiscount
+{
+    /**
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param float $qty
+     * @return \Magento\SalesRule\Model\Rule\Action\Discount\Data
+     */
+    public function calculate($rule, $item, $qty)
+    {
+        /** @var \Magento\SalesRule\Model\Rule\Action\Discount\Data $discountData */
+        $discountData = $this->discountFactory->create();
+
+        $store = $item->getQuote()->getStore();
+
+        $itemPrice              = $this->validator->getItemPrice($item);
+        $baseItemPrice          = $this->validator->getItemBasePrice($item);
+        $itemOriginalPrice      = $this->validator->getItemOriginalPrice($item);
+        $baseItemOriginalPrice  = $this->validator->getItemBaseOriginalPrice($item);
+
+        $quoteAmount = $store->convertPrice($rule->getDiscountAmount());
+
+        $discountData->setAmount($qty * ($itemPrice - $quoteAmount));
+        $discountData->setBaseAmount($qty * ($baseItemPrice - $rule->getDiscountAmount()));
+        $discountData->setOriginalAmount($qty * ($itemOriginalPrice - $quoteAmount));
+        $discountData->setBaseOriginalAmount($qty * ($baseItemOriginalPrice - $rule->getDiscountAmount()));
+
+        return $discountData;
+
+    }
+}
diff --git a/app/code/Magento/SalesRule/Model/Rule/Action/Discount/ToPercent.php b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/ToPercent.php
new file mode 100644
index 00000000000..e1fe609f52f
--- /dev/null
+++ b/app/code/Magento/SalesRule/Model/Rule/Action/Discount/ToPercent.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+class ToPercent extends ByPercent
+{
+    /**
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param float $qty
+     * @return Data
+     */
+    public function calculate($rule, $item, $qty)
+    {
+        $rulePercent = max(0, 100 - $rule->getDiscountAmount());
+        $discountData = $this->_calculate($rule, $item, $qty, $rulePercent);
+
+        return $discountData;
+    }
+}
diff --git a/app/code/Magento/SalesRule/Model/System/Config/Source/Coupon/Format.php b/app/code/Magento/SalesRule/Model/System/Config/Source/Coupon/Format.php
index 1ce3047cf28..00255b04768 100644
--- a/app/code/Magento/SalesRule/Model/System/Config/Source/Coupon/Format.php
+++ b/app/code/Magento/SalesRule/Model/System/Config/Source/Coupon/Format.php
@@ -33,7 +33,7 @@
  */
 namespace Magento\SalesRule\Model\System\Config\Source\Coupon;
 
-class Format implements \Magento\Core\Model\Option\ArrayInterface
+class Format implements \Magento\Option\ArrayInterface
 {
     /**
      * Sales rule coupon
diff --git a/app/code/Magento/SalesRule/Model/Validator.php b/app/code/Magento/SalesRule/Model/Validator.php
index 3c75516e831..9a36d3423fc 100644
--- a/app/code/Magento/SalesRule/Model/Validator.php
+++ b/app/code/Magento/SalesRule/Model/Validator.php
@@ -24,18 +24,20 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\SalesRule\Model;
 
 /**
  * SalesRule Validator Model
  *
  * Allows dispatching before and after events for each controller action
  *
- * @category   Magento
- * @package    Magento_SalesRule
- * @author     Magento Core Team <core@magentocommerce.com>
+ * @method mixed getCouponCode()
+ * @method \Magento\SalesRule\Model\Validator setCouponCode($code)
+ * @method mixed getWebsiteId()
+ * @method \Magento\SalesRule\Model\Validator setWebsiteId($id)
+ * @method mixed getCustomerGroupId()
+ * @method \Magento\SalesRule\Model\Validator setCustomerGroupId($id)
  */
-namespace Magento\SalesRule\Model;
-
 class Validator extends \Magento\Core\Model\AbstractModel
 {
     /**
@@ -63,13 +65,6 @@ class Validator extends \Magento\Core\Model\AbstractModel
      */
     protected $_rulesItemTotals = array();
 
-    /**
-     * Store information about addresses which cart fixed rule applied for
-     *
-     * @var array
-     */
-    protected $_cartFixedRuleUsedForAddress = array();
-
     /**
      * Skip action rules validation flag
      *
@@ -104,25 +99,39 @@ class Validator extends \Magento\Core\Model\AbstractModel
     protected $_customerFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @var \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory
+     */
+    protected $calculatorFactory;
+
+    /**
+     * Defines if rule with stop further rules is already applied
+     *
+     * @var bool
+     */
+    protected $_stopFurtherRules = false;
+
+    /**
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\SalesRule\Model\Resource\Coupon\UsageFactory $usageFactory
      * @param \Magento\SalesRule\Model\Resource\Rule\CollectionFactory $collectionFactory
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\SalesRule\Model\CouponFactory $couponFactory
      * @param \Magento\SalesRule\Model\Rule\CustomerFactory $customerFactory
+     * @param \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\SalesRule\Model\Resource\Coupon\UsageFactory $usageFactory,
         \Magento\SalesRule\Model\Resource\Rule\CollectionFactory $collectionFactory,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\SalesRule\Model\CouponFactory $couponFactory,
         \Magento\SalesRule\Model\Rule\CustomerFactory $customerFactory,
+        \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
@@ -132,6 +141,7 @@ class Validator extends \Magento\Core\Model\AbstractModel
         $this->_taxData = $taxData;
         $this->_couponFactory = $couponFactory;
         $this->_customerFactory = $customerFactory;
+        $this->calculatorFactory = $calculatorFactory;
         parent::__construct($context, $registry, $resource, $resourceCollection, $data);
     }
 
@@ -190,6 +200,7 @@ class Validator extends \Magento\Core\Model\AbstractModel
         if ($rule->getCouponType() != \Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON) {
             $couponCode = $address->getQuote()->getCouponCode();
             if (strlen($couponCode)) {
+                /** @var \Magento\SalesRule\Model\Coupon $coupon */
                 $coupon = $this->_couponFactory->create();
                 $coupon->load($couponCode, 'code');
                 if ($coupon->getId()) {
@@ -335,228 +346,22 @@ class Validator extends \Magento\Core\Model\AbstractModel
     /**
      * Quote item discount calculation process
      *
-     * @param   \Magento\Sales\Model\Quote\Item\AbstractItem $item
-     * @return  \Magento\SalesRule\Model\Validator
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @return \Magento\SalesRule\Model\Validator
      */
     public function process(\Magento\Sales\Model\Quote\Item\AbstractItem $item)
     {
         $item->setDiscountAmount(0);
         $item->setBaseDiscountAmount(0);
         $item->setDiscountPercent(0);
-        $quote      = $item->getQuote();
-        $address    = $item->getAddress();
-
-        $itemPrice              = $this->_getItemPrice($item);
-        $baseItemPrice          = $this->_getItemBasePrice($item);
-        $itemOriginalPrice      = $this->_getItemOriginalPrice($item);
-        $baseItemOriginalPrice  = $this->_getItemBaseOriginalPrice($item);
 
+        $itemPrice = $this->getItemPrice($item);
         if ($itemPrice < 0) {
             return $this;
         }
 
-        $appliedRuleIds = array();
-        foreach ($this->_getRules() as $rule) {
-            /* @var $rule \Magento\SalesRule\Model\Rule */
-            if (!$this->_canProcessRule($rule, $address)) {
-                continue;
-            }
-
-            if (!$this->_skipActionsValidation && !$rule->getActions()->validate($item)) {
-                continue;
-            }
-
-            $qty = $this->_getItemQty($item, $rule);
-            $rulePercent = min(100, $rule->getDiscountAmount());
-
-            $discountAmount = 0;
-            $baseDiscountAmount = 0;
-            //discount for original price
-            $originalDiscountAmount = 0;
-            $baseOriginalDiscountAmount = 0;
-
-            switch ($rule->getSimpleAction()) {
-                case \Magento\SalesRule\Model\Rule::TO_PERCENT_ACTION:
-                    $rulePercent = max(0, 100-$rule->getDiscountAmount());
-                //no break;
-                case \Magento\SalesRule\Model\Rule::BY_PERCENT_ACTION:
-                    $step = $rule->getDiscountStep();
-                    if ($step) {
-                        $qty = floor($qty/$step)*$step;
-                    }
-                    $_rulePct = $rulePercent/100;
-                    $discountAmount    = ($qty*$itemPrice - $item->getDiscountAmount()) * $_rulePct;
-                    $baseDiscountAmount= ($qty*$baseItemPrice - $item->getBaseDiscountAmount()) * $_rulePct;
-                    //get discount for original price
-                    $originalDiscountAmount    = ($qty*$itemOriginalPrice - $item->getDiscountAmount()) * $_rulePct;
-                    $baseOriginalDiscountAmount= ($qty*$baseItemOriginalPrice - $item->getDiscountAmount()) * $_rulePct;
-
-                    if (!$rule->getDiscountQty() || $rule->getDiscountQty()>$qty) {
-                        $discountPercent = min(100, $item->getDiscountPercent()+$rulePercent);
-                        $item->setDiscountPercent($discountPercent);
-                    }
-                    break;
-                case \Magento\SalesRule\Model\Rule::TO_FIXED_ACTION:
-                    $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
-                    $discountAmount    = $qty*($itemPrice-$quoteAmount);
-                    $baseDiscountAmount= $qty*($baseItemPrice-$rule->getDiscountAmount());
-                    //get discount for original price
-                    $originalDiscountAmount    = $qty*($itemOriginalPrice-$quoteAmount);
-                    $baseOriginalDiscountAmount= $qty*($baseItemOriginalPrice-$rule->getDiscountAmount());
-                    break;
-
-                case \Magento\SalesRule\Model\Rule::BY_FIXED_ACTION:
-                    $step = $rule->getDiscountStep();
-                    if ($step) {
-                        $qty = floor($qty/$step)*$step;
-                    }
-                    $quoteAmount        = $quote->getStore()->convertPrice($rule->getDiscountAmount());
-                    $discountAmount     = $qty*$quoteAmount;
-                    $baseDiscountAmount = $qty*$rule->getDiscountAmount();
-                    break;
-
-                case \Magento\SalesRule\Model\Rule::CART_FIXED_ACTION:
-                    if (empty($this->_rulesItemTotals[$rule->getId()])) {
-                        throw new \Magento\Core\Exception(__('Item totals are not set for the rule.'));
-                    }
-
-                    /**
-                     * prevent applying whole cart discount for every shipping order, but only for first order
-                     */
-                    if ($quote->getIsMultiShipping()) {
-                        $usedForAddressId = $this->getCartFixedRuleUsedForAddress($rule->getId());
-                        if ($usedForAddressId && $usedForAddressId != $address->getId()) {
-                            break;
-                        } else {
-                            $this->setCartFixedRuleUsedForAddress($rule->getId(), $address->getId());
-                        }
-                    }
-                    $cartRules = $address->getCartFixedRules();
-                    if (!isset($cartRules[$rule->getId()])) {
-                        $cartRules[$rule->getId()] = $rule->getDiscountAmount();
-                    }
-
-                    if ($cartRules[$rule->getId()] > 0) {
-                        if ($this->_rulesItemTotals[$rule->getId()]['items_count'] <= 1) {
-                            $quoteAmount = $quote->getStore()->convertPrice($cartRules[$rule->getId()]);
-                            $baseDiscountAmount = min($baseItemPrice * $qty, $cartRules[$rule->getId()]);
-                        } else {
-                            $discountRate = $baseItemPrice * $qty /
-                                            $this->_rulesItemTotals[$rule->getId()]['base_items_price'];
-                            $maximumItemDiscount = $rule->getDiscountAmount() * $discountRate;
-                            $quoteAmount = $quote->getStore()->convertPrice($maximumItemDiscount);
-
-                            $baseDiscountAmount = min($baseItemPrice * $qty, $maximumItemDiscount);
-                            $this->_rulesItemTotals[$rule->getId()]['items_count']--;
-                        }
-
-                        $discountAmount = min($itemPrice * $qty, $quoteAmount);
-                        $discountAmount = $quote->getStore()->roundPrice($discountAmount);
-                        $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
-
-                        //get discount for original price
-                        $originalDiscountAmount = min($itemOriginalPrice * $qty, $quoteAmount);
-                        $baseOriginalDiscountAmount = $quote->getStore()->roundPrice($baseItemOriginalPrice);
-
-                        $cartRules[$rule->getId()] -= $baseDiscountAmount;
-                    }
-                    $address->setCartFixedRules($cartRules);
-
-                    break;
-
-                case \Magento\SalesRule\Model\Rule::BUY_X_GET_Y_ACTION:
-                    $x = $rule->getDiscountStep();
-                    $y = $rule->getDiscountAmount();
-                    if (!$x || $y > $x) {
-                        break;
-                    }
-                    $buyAndDiscountQty = $x + $y;
-
-                    $fullRuleQtyPeriod = floor($qty / $buyAndDiscountQty);
-                    $freeQty  = $qty - $fullRuleQtyPeriod * $buyAndDiscountQty;
-
-                    $discountQty = $fullRuleQtyPeriod * $y;
-                    if ($freeQty > $x) {
-                        $discountQty += $freeQty - $x;
-                    }
-
-                    $discountAmount    = $discountQty * $itemPrice;
-                    $baseDiscountAmount= $discountQty * $baseItemPrice;
-                    //get discount for original price
-                    $originalDiscountAmount    = $discountQty * $itemOriginalPrice;
-                    $baseOriginalDiscountAmount= $discountQty * $baseItemOriginalPrice;
-                    break;
-            }
-
-            $result = new \Magento\Object(array(
-                'discount_amount'      => $discountAmount,
-                'base_discount_amount' => $baseDiscountAmount,
-            ));
-            $this->_eventManager->dispatch('salesrule_validator_process', array(
-                'rule'    => $rule,
-                'item'    => $item,
-                'address' => $address,
-                'quote'   => $quote,
-                'qty'     => $qty,
-                'result'  => $result,
-            ));
-
-            $discountAmount = $result->getDiscountAmount();
-            $baseDiscountAmount = $result->getBaseDiscountAmount();
-
-            $percentKey = $item->getDiscountPercent();
-            /**
-             * Process "delta" rounding
-             */
-            if ($percentKey) {
-                $delta      = isset($this->_roundingDeltas[$percentKey]) ? $this->_roundingDeltas[$percentKey] : 0;
-                $baseDelta  = isset($this->_baseRoundingDeltas[$percentKey])
-                        ? $this->_baseRoundingDeltas[$percentKey]
-                        : 0;
-                $discountAmount+= $delta;
-                $baseDiscountAmount+=$baseDelta;
-
-                $this->_roundingDeltas[$percentKey]     = $discountAmount -
-                                                          $quote->getStore()->roundPrice($discountAmount);
-                $this->_baseRoundingDeltas[$percentKey] = $baseDiscountAmount -
-                                                          $quote->getStore()->roundPrice($baseDiscountAmount);
-                $discountAmount = $quote->getStore()->roundPrice($discountAmount);
-                $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
-            } else {
-                $discountAmount     = $quote->getStore()->roundPrice($discountAmount);
-                $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
-            }
-
-            /**
-             * We can't use row total here because row total not include tax
-             * Discount can be applied on price included tax
-             */
-
-            $itemDiscountAmount = $item->getDiscountAmount();
-            $itemBaseDiscountAmount = $item->getBaseDiscountAmount();
-
-            $discountAmount     = min($itemDiscountAmount + $discountAmount, $itemPrice * $qty);
-            $baseDiscountAmount = min($itemBaseDiscountAmount + $baseDiscountAmount, $baseItemPrice * $qty);
-
-            $item->setDiscountAmount($discountAmount);
-            $item->setBaseDiscountAmount($baseDiscountAmount);
-
-            $item->setOriginalDiscountAmount($originalDiscountAmount);
-            $item->setBaseOriginalDiscountAmount($baseOriginalDiscountAmount);
-
-            $appliedRuleIds[$rule->getRuleId()] = $rule->getRuleId();
-
-            $this->_maintainAddressCouponCode($address, $rule);
-            $this->_addDiscountDescription($address, $rule);
-
-            if ($rule->getStopRulesProcessing()) {
-                break;
-            }
-        }
-
-        $item->setAppliedRuleIds(join(',',$appliedRuleIds));
-        $address->setAppliedRuleIds($this->mergeIds($address->getAppliedRuleIds(), $appliedRuleIds));
-        $quote->setAppliedRuleIds($this->mergeIds($quote->getAppliedRuleIds(), $appliedRuleIds));
+        $appliedRuleIds = $this->applyRules($item);
+        $this->setAppliedRuleIds($item, $appliedRuleIds);
 
         return $this;
     }
@@ -674,32 +479,6 @@ class Validator extends \Magento\Core\Model\AbstractModel
         return $a;
     }
 
-    /**
-     * Set information about usage cart fixed rule by quote address
-     *
-     * @param int $ruleId
-     * @param int $itemId
-     * @return void
-     */
-    public function setCartFixedRuleUsedForAddress($ruleId, $itemId)
-    {
-        $this->_cartFixedRuleUsedForAddress[$ruleId] = $itemId;
-    }
-
-    /**
-     * Retrieve information about usage cart fixed rule by quote address
-     *
-     * @param int $ruleId
-     * @return int|null
-     */
-    public function getCartFixedRuleUsedForAddress($ruleId)
-    {
-        if (isset($this->_cartFixedRuleUsedForAddress[$ruleId])) {
-            return $this->_cartFixedRuleUsedForAddress[$ruleId];
-        }
-        return null;
-    }
-
     /**
      * Calculate quote totals for each rule and save results
      *
@@ -732,19 +511,20 @@ class Validator extends \Magento\Core\Model\AbstractModel
                         continue;
                     }
                     $qty = $this->_getItemQty($item, $rule);
-                    $ruleTotalItemsPrice += $this->_getItemPrice($item) * $qty;
-                    $ruleTotalBaseItemsPrice += $this->_getItemBasePrice($item) * $qty;
+                    $ruleTotalItemsPrice += $this->getItemPrice($item) * $qty;
+                    $ruleTotalBaseItemsPrice += $this->getItemBasePrice($item) * $qty;
                     $validItemsCount++;
                 }
 
                 $this->_rulesItemTotals[$rule->getId()] = array(
-                    'items_price' => $ruleTotalItemsPrice,
+                    'items_price'      => $ruleTotalItemsPrice,
                     'base_items_price' => $ruleTotalBaseItemsPrice,
-                    'items_count' => $validItemsCount,
+                    'items_count'      => $validItemsCount,
                 );
             }
         }
 
+        $this->_stopFurtherRules = false;
         return $this;
     }
 
@@ -802,11 +582,11 @@ class Validator extends \Magento\Core\Model\AbstractModel
      * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
      * @return float
      */
-    protected function _getItemPrice($item)
+    public function getItemPrice($item)
     {
         $price = $item->getDiscountCalculationPrice();
         $calcPrice = $item->getCalculationPrice();
-        return ($price !== null) ? $price : $calcPrice;
+        return $price === null ? $calcPrice : $price;
     }
 
     /**
@@ -815,7 +595,7 @@ class Validator extends \Magento\Core\Model\AbstractModel
      * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
      * @return float
      */
-    protected function _getItemOriginalPrice($item)
+    public function getItemOriginalPrice($item)
     {
         return $this->_taxData->getPrice($item, $item->getOriginalPrice(), true);
     }
@@ -826,7 +606,7 @@ class Validator extends \Magento\Core\Model\AbstractModel
      * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
      * @return float
      */
-    protected function _getItemBasePrice($item)
+    public function getItemBasePrice($item)
     {
         $price = $item->getDiscountCalculationPrice();
         return ($price !== null) ? $item->getBaseDiscountCalculationPrice() : $item->getBaseCalculationPrice();
@@ -838,7 +618,7 @@ class Validator extends \Magento\Core\Model\AbstractModel
      * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
      * @return float
      */
-    protected function _getItemBaseOriginalPrice($item)
+    public function getItemBaseOriginalPrice($item)
     {
         return $this->_taxData->getPrice($item, $item->getBaseOriginalPrice(), true);
     }
@@ -853,7 +633,8 @@ class Validator extends \Magento\Core\Model\AbstractModel
     protected function _getItemQty($item, $rule)
     {
         $qty = $item->getTotalQty();
-        return $rule->getDiscountQty() ? min($qty, $rule->getDiscountQty()) : $qty;
+        $discountQty = $rule->getDiscountQty();
+        return $discountQty ? min($qty, $discountQty) : $qty;
     }
 
     /**
@@ -878,6 +659,252 @@ class Validator extends \Magento\Core\Model\AbstractModel
         return $this;
     }
 
+    /**
+     * Return items list sorted by possibility to apply prioritized rules
+     *
+     * @param array $items
+     * @return array $items
+     */
+    public function sortItemsByPriority($items)
+    {
+        $itemsSorted = array();
+        /** @var $rule \Magento\SalesRule\Model\Rule */
+        foreach ($this->_getRules() as $rule) {
+            foreach ($items as $itemKey => $itemValue) {
+                if ($rule->getActions()->validate($itemValue)) {
+                    unset($items[$itemKey]);
+                    array_push($itemsSorted, $itemValue);
+                }
+            }
+        }
+
+        if (!empty($itemsSorted)) {
+            $items = array_merge($itemsSorted, $items);
+        }
+
+        return $items;
+    }
+
+    /**
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param int[] $appliedRuleIds
+     * @return $this
+     */
+    protected function setAppliedRuleIds(\Magento\Sales\Model\Quote\Item\AbstractItem $item, array $appliedRuleIds)
+    {
+        $address = $item->getAddress();
+        $quote = $item->getQuote();
+
+        $item->setAppliedRuleIds(join(',', $appliedRuleIds));
+        $address->setAppliedRuleIds($this->mergeIds($address->getAppliedRuleIds(), $appliedRuleIds));
+        $quote->setAppliedRuleIds($this->mergeIds($quote->getAppliedRuleIds(), $appliedRuleIds));
+
+        return $this;
+    }
+
+    /**
+     * Fire event to allow overwriting of discount amounts
+     *
+     * @param \Magento\SalesRule\Model\Rule\Action\Discount\Data $discountData
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @param float $qty
+     * @return $this
+     */
+    protected function eventFix(
+        \Magento\SalesRule\Model\Rule\Action\Discount\Data $discountData,
+        \Magento\Sales\Model\Quote\Item\AbstractItem $item,
+        \Magento\SalesRule\Model\Rule $rule,
+        $qty
+    ) {
+        $quote = $item->getQuote();
+        $address = $item->getAddress();
+
+        $this->_eventManager->dispatch('salesrule_validator_process', array(
+            'rule'    => $rule,
+            'item'    => $item,
+            'address' => $address,
+            'quote'   => $quote,
+            'qty'     => $qty,
+            'result'  => $discountData,
+        ));
+
+        return $this;
+    }
+
+    /**
+     * Process "delta" rounding
+     *
+     * @param \Magento\SalesRule\Model\Rule\Action\Discount\Data
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @return $this
+     */
+    protected function deltaRoundingFix(
+        \Magento\SalesRule\Model\Rule\Action\Discount\Data $discountData,
+        \Magento\Sales\Model\Quote\Item\AbstractItem $item
+    ) {
+        $store = $item->getQuote()->getStore();
+        $discountAmount = $discountData->getAmount();
+        $baseDiscountAmount = $discountData->getBaseAmount();
+
+        //TODO Seems \Magento\Sales\Model\Quote\Item\AbstractItem::getDiscountPercent() returns float value
+        //that can not be used as array index
+        $percentKey = $item->getDiscountPercent();
+        if ($percentKey) {
+            $delta      = isset($this->_roundingDeltas[$percentKey]) ? $this->_roundingDeltas[$percentKey] : 0;
+            $baseDelta  = isset($this->_baseRoundingDeltas[$percentKey]) ? $this->_baseRoundingDeltas[$percentKey] : 0;
+
+            $discountAmount += $delta;
+            $baseDiscountAmount += $baseDelta;
+
+            $this->_roundingDeltas[$percentKey] = $discountAmount - $store->roundPrice($discountAmount);
+            $this->_baseRoundingDeltas[$percentKey] = $baseDiscountAmount - $store->roundPrice($baseDiscountAmount);
+        }
+
+        $discountData->setAmount($store->roundPrice($discountAmount));
+        $discountData->setBaseAmount($store->roundPrice($baseDiscountAmount));
+
+        return $this;
+    }
+
+    /**
+     * @param Rule\Action\Discount\Data $discountData
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param float $qty
+     */
+    protected function minFix(
+        \Magento\SalesRule\Model\Rule\Action\Discount\Data $discountData,
+        \Magento\Sales\Model\Quote\Item\AbstractItem $item,
+        $qty
+    ) {
+        $itemPrice = $this->getItemPrice($item);
+        $baseItemPrice = $this->getItemBasePrice($item);
+
+        $itemDiscountAmount = $item->getDiscountAmount();
+        $itemBaseDiscountAmount = $item->getBaseDiscountAmount();
+
+        $discountAmount = min($itemDiscountAmount + $discountData->getAmount(), $itemPrice * $qty);
+        $baseDiscountAmount = min($itemBaseDiscountAmount + $discountData->getBaseAmount(), $baseItemPrice * $qty);
+
+        $discountData->setAmount($discountAmount);
+        $discountData->setBaseAmount($baseDiscountAmount);
+    }
+
+    /**
+     * @param int $key
+     * @return array
+     * @throws \Magento\Core\Exception
+     */
+    public function getRuleItemTotalsInfo($key)
+    {
+        if (empty($this->_rulesItemTotals[$key])) {
+            throw new \Magento\Core\Exception(__('Item totals are not set for the rule.'));
+        }
+
+        return $this->_rulesItemTotals[$key];
+    }
+
+    /**
+     * @param int $key
+     * @return $this
+     */
+    public function decrementRuleItemTotalsCount($key)
+    {
+        $this->_rulesItemTotals[$key]['items_count']--;
+
+        return $this;
+    }
+
+    /**
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @return array
+     */
+    protected function applyRules($item)
+    {
+        $address = $item->getAddress();
+
+        $appliedRuleIds = array();
+        /* @var $rule \Magento\SalesRule\Model\Rule */
+        foreach ($this->_getRules() as $rule) {
+            if ($this->_stopFurtherRules) {
+                break;
+            }
 
+            if (!$this->_canProcessRule($rule, $address)) {
+                continue;
+            }
 
+            if (!$this->_skipActionsValidation && !$rule->getActions()->validate($item)) {
+                continue;
+            }
+
+            $this->applyRule($item, $rule, $address);
+            $appliedRuleIds[$rule->getRuleId()] = $rule->getRuleId();
+
+            if ($rule->getStopRulesProcessing()) {
+                $this->_stopFurtherRules = true;
+                break;
+            }
+        }
+
+        return $appliedRuleIds;
+    }
+
+    /**
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @param \Magento\Sales\Model\Quote\Address $address
+     * @return $this
+     */
+    protected function applyRule($item, $rule, $address)
+    {
+        $discountData = $this->getDiscountData($item, $rule);
+        $this->setDiscountData($discountData, $item);
+
+        $this->_maintainAddressCouponCode($address, $rule);
+        $this->_addDiscountDescription($address, $rule);
+
+        return $this;
+    }
+
+    /**
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @param \Magento\SalesRule\Model\Rule $rule
+     * @return Rule\Action\Discount\Data
+     */
+    protected function getDiscountData($item, $rule)
+    {
+        $qty = $this->_getItemQty($item, $rule);
+
+        $discountCalculator = $this->calculatorFactory->create($rule->getSimpleAction());
+        $qty = $discountCalculator->fixQuantity($qty, $rule);
+        $discountData = $discountCalculator->calculate($rule, $item, $qty);
+
+        $this->eventFix($discountData, $item, $rule, $qty);
+        $this->deltaRoundingFix($discountData, $item);
+
+        /**
+         * We can't use row total here because row total not include tax
+         * Discount can be applied on price included tax
+         */
+
+        $this->minFix($discountData, $item, $qty);
+
+        return $discountData;
+    }
+
+    /**
+     * @param Rule\Action\Discount\Data $discountData
+     * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
+     * @return $this
+     */
+    protected function setDiscountData($discountData, $item)
+    {
+        $item->setDiscountAmount($discountData->getAmount());
+        $item->setBaseDiscountAmount($discountData->getBaseAmount());
+        $item->setOriginalDiscountAmount($discountData->getOriginalAmount());
+        $item->setBaseOriginalDiscountAmount($discountData->getBaseOriginalAmount());
+
+        return $this;
+    }
 }
diff --git a/app/code/Magento/SalesRule/i18n/de_DE.csv b/app/code/Magento/SalesRule/i18n/de_DE.csv
index 5e755c29b79..1285fcf7e80 100644
--- a/app/code/Magento/SalesRule/i18n/de_DE.csv
+++ b/app/code/Magento/SalesRule/i18n/de_DE.csv
@@ -18,7 +18,7 @@
 "Buy X get Y free (discount amount is Y)","X kaufen, Y kostenlos bekommen (Rabattbetrag ist Y)"
 "By Fixed value","Nach festen Wert"
 "By Percentage","Nach Prozent"
-"Can\'t acquire coupon.","Kann Gutschein nicht erwerben."
+"Can't acquire coupon.","Kann Gutschein nicht erwerben."
 "Cart Attribute","Warenkorbattribut"
 "Catalog","Katalog"
 "Code Format","Kennung -Format"
diff --git a/app/code/Magento/SalesRule/i18n/en_US.csv b/app/code/Magento/SalesRule/i18n/en_US.csv
index b3179f57c26..a4ae3c0ca9c 100644
--- a/app/code/Magento/SalesRule/i18n/en_US.csv
+++ b/app/code/Magento/SalesRule/i18n/en_US.csv
@@ -18,7 +18,7 @@
 "Buy X get Y free (discount amount is Y)","Buy X get Y free (discount amount is Y)"
 "By Fixed value","By Fixed value"
 "By Percentage","By Percentage"
-"Can\'t acquire coupon.","Can\'t acquire coupon."
+"Can't acquire coupon.","Can't acquire coupon."
 "Cart Attribute","Cart Attribute"
 "Catalog","Catalog"
 "Code Format","Code Format"
diff --git a/app/code/Magento/SalesRule/i18n/es_ES.csv b/app/code/Magento/SalesRule/i18n/es_ES.csv
index 2861c268af5..d33f536fd0e 100644
--- a/app/code/Magento/SalesRule/i18n/es_ES.csv
+++ b/app/code/Magento/SalesRule/i18n/es_ES.csv
@@ -18,7 +18,7 @@
 "Buy X get Y free (discount amount is Y)","Compre X y llévese Y gratis (la cantidad descontada es Y)"
 "By Fixed value","Por valor Fijo"
 "By Percentage","Por Porcentaje"
-"Can\'t acquire coupon.","No se puede adquirir el cupón."
+"Can't acquire coupon.","No se puede adquirir el cupón."
 "Cart Attribute","Atributos del Carro"
 "Catalog","Catálogo"
 "Code Format","Código de formato"
diff --git a/app/code/Magento/SalesRule/i18n/fr_FR.csv b/app/code/Magento/SalesRule/i18n/fr_FR.csv
index 16eac88ad68..78e03a34d4b 100644
--- a/app/code/Magento/SalesRule/i18n/fr_FR.csv
+++ b/app/code/Magento/SalesRule/i18n/fr_FR.csv
@@ -18,7 +18,7 @@
 "Buy X get Y free (discount amount is Y)","Achetez X et obtenez Y gratuitement (le montant de la remise est Y)"
 "By Fixed value","par valeur fixe"
 "By Percentage","par pourcentage"
-"Can\'t acquire coupon.","ne peut pas obtenir le coupon"
+"Can't acquire coupon.","ne peut pas obtenir le coupon"
 "Cart Attribute","Attribut du panier"
 "Catalog","Catalogue"
 "Code Format","Format du code"
diff --git a/app/code/Magento/SalesRule/i18n/nl_NL.csv b/app/code/Magento/SalesRule/i18n/nl_NL.csv
index 9759e2de84e..aa261b79e2c 100644
--- a/app/code/Magento/SalesRule/i18n/nl_NL.csv
+++ b/app/code/Magento/SalesRule/i18n/nl_NL.csv
@@ -18,7 +18,7 @@
 "Buy X get Y free (discount amount is Y)","Koop X, krijg Y gratis (kortingsbedrag is Y)"
 "By Fixed value","Bij gefixeerde waarde"
 "By Percentage","Bij percentage"
-"Can\'t acquire coupon.","Kan geen kortingsbon verkrijgen"
+"Can't acquire coupon.","Kan geen kortingsbon verkrijgen"
 "Cart Attribute","Winkelwagen attribuut"
 "Catalog","Catalogus"
 "Code Format","Code Formaat"
diff --git a/app/code/Magento/SalesRule/i18n/pt_BR.csv b/app/code/Magento/SalesRule/i18n/pt_BR.csv
index 62d46394dc6..b581f2eca90 100644
--- a/app/code/Magento/SalesRule/i18n/pt_BR.csv
+++ b/app/code/Magento/SalesRule/i18n/pt_BR.csv
@@ -18,7 +18,7 @@
 "Buy X get Y free (discount amount is Y)","Compre X obtenha Y grátis (valor do desconto é Y)"
 "By Fixed value","Por Valor Fixo"
 "By Percentage","Por Percentagem"
-"Can\'t acquire coupon.","Não é possível adquirir cupons."
+"Can't acquire coupon.","Não é possível adquirir cupons."
 "Cart Attribute","Atributo do Carrinho"
 "Catalog","Catálogo"
 "Code Format","Formato do código"
diff --git a/app/code/Magento/SalesRule/i18n/zh_CN.csv b/app/code/Magento/SalesRule/i18n/zh_CN.csv
index 15dcb3295f4..651790cbcf2 100644
--- a/app/code/Magento/SalesRule/i18n/zh_CN.csv
+++ b/app/code/Magento/SalesRule/i18n/zh_CN.csv
@@ -18,7 +18,7 @@
 "Buy X get Y free (discount amount is Y)","购买 X 即可免费获得 Y(折扣额是Y)"
 "By Fixed value","由固定值"
 "By Percentage","按百分比"
-"Can\'t acquire coupon.","无法获取代金券。"
+"Can't acquire coupon.","无法获取代金券。"
 "Cart Attribute","购物车属性"
 "Catalog","分类"
 "Code Format","代码格式"
diff --git a/app/code/Magento/Sendfriend/Block/Send.php b/app/code/Magento/Sendfriend/Block/Send.php
index 730f12990a9..fe1de681205 100644
--- a/app/code/Magento/Sendfriend/Block/Send.php
+++ b/app/code/Magento/Sendfriend/Block/Send.php
@@ -44,7 +44,7 @@ class Send extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -57,14 +57,14 @@ class Send extends \Magento\View\Element\Template
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Sendfriend\Helper\Data $sendfriendData
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Sendfriend\Helper\Data $sendfriendData,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_customerSession = $customerSession;
diff --git a/app/code/Magento/Sendfriend/Controller/Product.php b/app/code/Magento/Sendfriend/Controller/Product.php
index e318cf9579f..2238f753fc5 100644
--- a/app/code/Magento/Sendfriend/Controller/Product.php
+++ b/app/code/Magento/Sendfriend/Controller/Product.php
@@ -40,7 +40,7 @@ class Product extends \Magento\App\Action\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -51,12 +51,12 @@ class Product extends \Magento\App\Action\Action
 
     /**
      * @param \Magento\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator
      */
     public function __construct(
         \Magento\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Core\App\Action\FormKeyValidator $formKeyValidator
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Sendfriend/Model/Sendfriend.php b/app/code/Magento/Sendfriend/Model/Sendfriend.php
index 0050b74b0aa..3bb859ffbab 100644
--- a/app/code/Magento/Sendfriend/Model/Sendfriend.php
+++ b/app/code/Magento/Sendfriend/Model/Sendfriend.php
@@ -100,9 +100,9 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
     protected $_catalogImage = null;
 
     /**
-     * @var \Magento\Email\Model\TemplateFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_templateFactory;
+    protected $_transportBuilder;
 
     /**
      * @var \Magento\Core\Model\StoreManagerInterface
@@ -115,10 +115,10 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
     protected $_escaper;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
-     * @param \Magento\Email\Model\TemplateFactory $templateFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param \Magento\TranslateInterface $translate
      * @param \Magento\Catalog\Helper\Image $catalogImage
      * @param \Magento\Sendfriend\Helper\Data $sendfriendData
@@ -128,10 +128,10 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
-        \Magento\Email\Model\TemplateFactory $templateFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\TranslateInterface $translate,
         \Magento\Catalog\Helper\Image $catalogImage,
         \Magento\Sendfriend\Helper\Data $sendfriendData,
@@ -141,7 +141,7 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
         array $data = array()
     ) {
         $this->_storeManager = $storeManager;
-        $this->_templateFactory = $templateFactory;
+        $this->_transportBuilder = $transportBuilder;
         $this->_translate = $translate;
         $this->_catalogImage = $catalogImage;
         $this->_sendfriendData = $sendfriendData;
@@ -159,16 +159,6 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
         $this->_init('Magento\Sendfriend\Model\Resource\Sendfriend');
     }
 
-    /**
-     * Retrieve Data Helper
-     *
-     * @return \Magento\Sendfriend\Helper\Data
-     */
-    protected function _getHelper()
-    {
-        return $this->_sendfriendData;
-    }
-
     /**
      * @return $this
      * @throws CoreException
@@ -181,12 +171,8 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
             );
         }
 
-        /* @var $translate \Magento\TranslateInterface */
-        $translate = $this->_translate;
-        $translate->setTranslateInline(false);
-
-        /* @var $mailTemplate \Magento\Email\Model\Template */
-        $mailTemplate = $this->_templateFactory->create();
+        $translate = $this->_translate->getTranslateInline();
+        $this->_translate->setTranslateInline(false);
 
         $message = nl2br(htmlspecialchars($this->getSender()->getMessage()));
         $sender  = array(
@@ -194,19 +180,16 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
             'email' => $this->_escaper->escapeHtml($this->getSender()->getEmail())
         );
 
-        $mailTemplate->setDesignConfig(array(
-            'area'  => \Magento\Core\Model\App\Area::AREA_FRONTEND,
-            'store' => $this->_storeManager->getStore()->getId(),
-        ));
-
         foreach ($this->getRecipients()->getEmails() as $k => $email) {
             $name = $this->getRecipients()->getNames($k);
-            $mailTemplate->sendTransactional(
-                $this->getTemplate(),
-                $sender,
-                $email,
-                $name,
-                array(
+            $this->_transportBuilder
+                ->setTemplateIdentifier($this->_sendfriendData->getEmailTemplate())
+                ->setTemplateOptions(array(
+                    'area'  => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                    'store' => $this->_storeManager->getStore()->getId(),
+                ))
+                ->setFrom($sender)
+                ->setTemplateVars(array(
                     'name'          => $name,
                     'email'         => $email,
                     'product_name'  => $this->getProduct()->getName(),
@@ -214,13 +197,13 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
                     'message'       => $message,
                     'sender_name'   => $sender['name'],
                     'sender_email'  => $sender['email'],
-                    'product_image' => $this->_catalogImage->init($this->getProduct(),
-                        'small_image')->resize(75),
-                )
-            );
+                    'product_image' => $this->_catalogImage->init($this->getProduct(), 'small_image')->resize(75),
+                ))
+                ->addTo($email, $name);
+            $transport = $this->_transportBuilder->getTransport();
+            $transport->sendMessage();
         }
-
-        $translate->setTranslateInline(true);
+        $this->_translate->setTranslateInline($translate);
         $this->_incrementSentCount();
 
         return $this;
@@ -459,17 +442,7 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
      */
     public function getMaxSendsToFriend()
     {
-        return $this->_getHelper()->getMaxEmailPerPeriod();
-    }
-
-    /**
-     * Get current Email "Send to friend" template
-     *
-     * @return string
-     */
-    public function getTemplate()
-    {
-        return $this->_getHelper()->getEmailTemplate();
+        return $this->_sendfriendData->getMaxEmailPerPeriod();
     }
 
     /**
@@ -479,7 +452,7 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
      */
     public function getMaxRecipients()
     {
-        return $this->_getHelper()->getMaxRecipients();
+        return $this->_sendfriendData->getMaxRecipients();
     }
 
     /**
@@ -489,7 +462,7 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
      */
     public function canEmailToFriend()
     {
-        return $this->_getHelper()->isEnabled();
+        return $this->_sendfriendData->isEnabled();
     }
 
     /**
@@ -514,7 +487,7 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
             return $this->_sentCount;
         }
 
-        switch ($this->_getHelper()->getLimitBy()) {
+        switch ($this->_sendfriendData->getLimitBy()) {
             case \Magento\Sendfriend\Helper\Data::CHECK_COOKIE:
                 return $this->_sentCount = $this->_sentCountByCookies(false);
             case \Magento\Sendfriend\Helper\Data::CHECK_IP:
@@ -531,7 +504,7 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
      */
     protected function _incrementSentCount()
     {
-        switch ($this->_getHelper()->getLimitBy()) {
+        switch ($this->_sendfriendData->getLimitBy()) {
             case \Magento\Sendfriend\Helper\Data::CHECK_COOKIE:
                 return $this->_sentCount = $this->_sentCountByCookies(true);
             case \Magento\Sendfriend\Helper\Data::CHECK_IP:
@@ -549,7 +522,7 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
      */
     protected function _sentCountByCookies($increment = false)
     {
-        $cookie   = $this->_getHelper()->getCookieName();
+        $cookie   = $this->_sendfriendData->getCookieName();
         $time     = time();
         $newTimes = array();
 
@@ -562,7 +535,7 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
         if ($oldTimes) {
             $oldTimes = explode(',', $oldTimes);
             foreach ($oldTimes as $oldTime) {
-                $periodTime = $time - $this->_getHelper()->getPeriod();
+                $periodTime = $time - $this->_sendfriendData->getPeriod();
                 if (is_numeric($oldTime) AND $oldTime >= $periodTime) {
                     $newTimes[] = $oldTime;
                 }
@@ -587,7 +560,7 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel
     protected function _sentCountByIp($increment = false)
     {
         $time   = time();
-        $period = $this->_getHelper()->getPeriod();
+        $period = $this->_sendfriendData->getPeriod();
         $websiteId = $this->getWebsiteId();
 
         if ($increment) {
diff --git a/app/code/Magento/Sendfriend/etc/module.xml b/app/code/Magento/Sendfriend/etc/module.xml
index d9f8318e8a8..a1f0517bbbd 100755
--- a/app/code/Magento/Sendfriend/etc/module.xml
+++ b/app/code/Magento/Sendfriend/etc/module.xml
@@ -32,7 +32,6 @@
             <module name="Magento_Catalog"/>
             <module name="Magento_Core"/>
             <module name="Magento_Customer"/>
-            <module name="Magento_Email"/>
             <module name="Magento_Theme"/>
         </depends>
     </module>
diff --git a/app/code/Magento/Shipping/Block/Adminhtml/Create.php b/app/code/Magento/Shipping/Block/Adminhtml/Create.php
index e0ed79e89bc..81dba3872c7 100644
--- a/app/code/Magento/Shipping/Block/Adminhtml/Create.php
+++ b/app/code/Magento/Shipping/Block/Adminhtml/Create.php
@@ -33,18 +33,18 @@ class Create extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Shipping/Block/Adminhtml/Create/Items.php b/app/code/Magento/Shipping/Block/Adminhtml/Create/Items.php
index dd82d2d1102..450df2cc2a7 100644
--- a/app/code/Magento/Shipping/Block/Adminhtml/Create/Items.php
+++ b/app/code/Magento/Shipping/Block/Adminhtml/Create/Items.php
@@ -45,7 +45,7 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Helper\Data $salesData
      * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory
      * @param array $data
@@ -53,7 +53,7 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Catalog\Model\ProductFactory $productFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Sales\Helper\Data $salesData,
         \Magento\Shipping\Model\CarrierFactory $carrierFactory,
         array $data = array()
diff --git a/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php
index fe122f58044..155d0f3968a 100644
--- a/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php
+++ b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php
@@ -36,7 +36,7 @@ class Packaging extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -54,7 +54,7 @@ class Packaging extends \Magento\Backend\Block\Template
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Usa\Model\Shipping\Carrier\Usps\Source\Size $sourceSizeModel
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory
      * @param array $data
      */
@@ -62,7 +62,7 @@ class Packaging extends \Magento\Backend\Block\Template
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Usa\Model\Shipping\Carrier\Usps\Source\Size $sourceSizeModel,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Shipping\Model\CarrierFactory $carrierFactory,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging/Grid.php b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging/Grid.php
index f993c0947bc..6aef0e43c2a 100644
--- a/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging/Grid.php
+++ b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging/Grid.php
@@ -33,7 +33,7 @@ class Grid extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -45,13 +45,13 @@ class Grid extends \Magento\Backend\Block\Template
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Sales\Model\Order\Shipment\ItemFactory $shipmentItemFactory
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Sales\Model\Order\Shipment\ItemFactory $shipmentItemFactory,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_shipmentItemFactory = $shipmentItemFactory;
diff --git a/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking.php b/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking.php
index 9d8afc2ba72..c5fed22f115 100644
--- a/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking.php
+++ b/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking.php
@@ -32,7 +32,7 @@ class Tracking extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -44,13 +44,13 @@ class Tracking extends \Magento\Backend\Block\Template
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Shipping\Model\Config $shippingConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Shipping\Model\Config $shippingConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_shippingConfig = $shippingConfig;
diff --git a/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking/View.php b/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking/View.php
index 130ffdcb60f..aa4d44d0f22 100644
--- a/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking/View.php
+++ b/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking/View.php
@@ -37,14 +37,14 @@ class View extends \Magento\Shipping\Block\Adminhtml\Order\Tracking
     /**
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Shipping\Model\Config $shippingConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Shipping\Model\Config $shippingConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Shipping\Model\CarrierFactory $carrierFactory,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Shipping/Block/Adminhtml/View.php b/app/code/Magento/Shipping/Block/Adminhtml/View.php
index de93eb281b4..499445e64ed 100644
--- a/app/code/Magento/Shipping/Block/Adminhtml/View.php
+++ b/app/code/Magento/Shipping/Block/Adminhtml/View.php
@@ -35,18 +35,18 @@ class View extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Shipping/Block/Adminhtml/View/Comments.php b/app/code/Magento/Shipping/Block/Adminhtml/View/Comments.php
index 65bccdf3480..b8d324aa732 100644
--- a/app/code/Magento/Shipping/Block/Adminhtml/View/Comments.php
+++ b/app/code/Magento/Shipping/Block/Adminhtml/View/Comments.php
@@ -39,18 +39,18 @@ class Comments extends \Magento\Backend\Block\Text\ListText
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Shipping/Block/Adminhtml/View/Form.php b/app/code/Magento/Shipping/Block/Adminhtml/View/Form.php
index b7a1ac3b597..b2597b9c34f 100644
--- a/app/code/Magento/Shipping/Block/Adminhtml/View/Form.php
+++ b/app/code/Magento/Shipping/Block/Adminhtml/View/Form.php
@@ -42,14 +42,14 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Sales\Helper\Admin $adminHelper
      * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Sales\Helper\Admin $adminHelper,
         \Magento\Shipping\Model\CarrierFactory $carrierFactory,
         array $data = array()
diff --git a/app/code/Magento/Shipping/Block/Items.php b/app/code/Magento/Shipping/Block/Items.php
index 079c92af58f..b873369e939 100644
--- a/app/code/Magento/Shipping/Block/Items.php
+++ b/app/code/Magento/Shipping/Block/Items.php
@@ -38,18 +38,18 @@ class Items extends \Magento\Sales\Block\Items\AbstractItems
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Shipping/Block/Order/Shipment.php b/app/code/Magento/Shipping/Block/Order/Shipment.php
index 70fdbb5819d..af03a6df2b9 100644
--- a/app/code/Magento/Shipping/Block/Order/Shipment.php
+++ b/app/code/Magento/Shipping/Block/Order/Shipment.php
@@ -38,7 +38,7 @@ class Shipment extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -54,14 +54,14 @@ class Shipment extends \Magento\View\Element\Template
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Payment\Helper\Data $paymentHelper
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Payment\Helper\Data $paymentHelper,
         array $data = array()
diff --git a/app/code/Magento/Shipping/Block/Tracking/Link.php b/app/code/Magento/Shipping/Block/Tracking/Link.php
index 43849379fbf..4a31dd3f8fc 100644
--- a/app/code/Magento/Shipping/Block/Tracking/Link.php
+++ b/app/code/Magento/Shipping/Block/Tracking/Link.php
@@ -32,7 +32,7 @@ class Link extends \Magento\View\Element\Html\Link
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -45,13 +45,13 @@ class Link extends \Magento\View\Element\Html\Link
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Shipping\Helper\Data $shippingData
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Shipping\Helper\Data $shippingData,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Shipping/Block/Tracking/Popup.php b/app/code/Magento/Shipping/Block/Tracking/Popup.php
index 2c3b9861adc..cb45869b565 100644
--- a/app/code/Magento/Shipping/Block/Tracking/Popup.php
+++ b/app/code/Magento/Shipping/Block/Tracking/Popup.php
@@ -30,18 +30,18 @@ class Popup extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registry;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_registry = $registry;
diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php
index 7b4e9d6f31a..e9a4b36fa45 100644
--- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php
+++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php
@@ -37,7 +37,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -54,13 +54,13 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip
     /**
      * @param \Magento\Backend\App\Action\Context $context
      * @param \Magento\App\Response\Http\FileFactory $fileFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
         \Magento\App\Response\Http\FileFactory $fileFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Shipping\Model\CarrierFactory $carrierFactory
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Shipping/Controller/Tracking.php b/app/code/Magento/Shipping/Controller/Tracking.php
index 2a6448525a1..fcdaa78b23d 100644
--- a/app/code/Magento/Shipping/Controller/Tracking.php
+++ b/app/code/Magento/Shipping/Controller/Tracking.php
@@ -33,7 +33,7 @@ class Tracking extends \Magento\App\Action\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -49,13 +49,13 @@ class Tracking extends \Magento\App\Action\Action
 
     /**
      * @param \Magento\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Shipping\Model\InfoFactory $shippingInfoFactory
      * @param \Magento\Sales\Model\OrderFactory $orderFactory
      */
     public function __construct(
         \Magento\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Shipping\Model\InfoFactory $shippingInfoFactory,
         \Magento\Sales\Model\OrderFactory $orderFactory
     ) {
diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php
index 2f54abd895b..23119d06510 100644
--- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php
+++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php
@@ -108,13 +108,13 @@ abstract class AbstractCarrier extends \Magento\Object implements AbstractCarrie
     /**
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         array $data = array()
     ) {
         parent::__construct($data);
diff --git a/app/code/Magento/Shipping/Model/Carrier/Flatrate.php b/app/code/Magento/Shipping/Model/Carrier/Flatrate.php
index 0fb8de29fb6..3cea194f4c1 100644
--- a/app/code/Magento/Shipping/Model/Carrier/Flatrate.php
+++ b/app/code/Magento/Shipping/Model/Carrier/Flatrate.php
@@ -59,7 +59,7 @@ class Flatrate
     /**
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory
      * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
      * @param array $data
@@ -67,7 +67,7 @@ class Flatrate
     public function __construct(
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory,
         \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
         array $data = array()
diff --git a/app/code/Magento/Shipping/Model/Carrier/Freeshipping.php b/app/code/Magento/Shipping/Model/Carrier/Freeshipping.php
index 9a330ffcdaf..344a64c78fe 100644
--- a/app/code/Magento/Shipping/Model/Carrier/Freeshipping.php
+++ b/app/code/Magento/Shipping/Model/Carrier/Freeshipping.php
@@ -62,7 +62,7 @@ class Freeshipping
     /**
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory
      * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
      * @param array $data
@@ -70,7 +70,7 @@ class Freeshipping
     public function __construct(
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory,
         \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
         array $data = array()
diff --git a/app/code/Magento/Shipping/Model/Carrier/Pickup.php b/app/code/Magento/Shipping/Model/Carrier/Pickup.php
index 167b01edc50..01b843db44a 100644
--- a/app/code/Magento/Shipping/Model/Carrier/Pickup.php
+++ b/app/code/Magento/Shipping/Model/Carrier/Pickup.php
@@ -55,7 +55,7 @@ class Pickup
     /**
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory
      * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
      * @param array $data
@@ -63,7 +63,7 @@ class Pickup
     public function __construct(
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory,
         \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
         array $data = array()
diff --git a/app/code/Magento/Shipping/Model/Carrier/Tablerate.php b/app/code/Magento/Shipping/Model/Carrier/Tablerate.php
index 2fd6ed85c55..636f35432d1 100644
--- a/app/code/Magento/Shipping/Model/Carrier/Tablerate.php
+++ b/app/code/Magento/Shipping/Model/Carrier/Tablerate.php
@@ -67,7 +67,7 @@ class Tablerate
     /**
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory
      * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $resultMethodFactory
      * @param \Magento\Shipping\Model\Resource\Carrier\TablerateFactory $tablerateFactory
@@ -76,7 +76,7 @@ class Tablerate
     public function __construct(
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory,
         \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $resultMethodFactory,
         \Magento\Shipping\Model\Resource\Carrier\TablerateFactory $tablerateFactory,
diff --git a/app/code/Magento/Shipping/Model/Config/Backend/Tablerate.php b/app/code/Magento/Shipping/Model/Config/Backend/Tablerate.php
index 8bcb8d301cc..243232767d0 100644
--- a/app/code/Magento/Shipping/Model/Config/Backend/Tablerate.php
+++ b/app/code/Magento/Shipping/Model/Config/Backend/Tablerate.php
@@ -40,8 +40,8 @@ class Tablerate extends \Magento\Core\Model\Config\Value
     protected $_tablerateFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Shipping\Model\Resource\Carrier\TablerateFactory $tablerateFactory
@@ -50,8 +50,8 @@ class Tablerate extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Shipping\Model\Resource\Carrier\TablerateFactory $tablerateFactory,
diff --git a/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php b/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php
index 7832b20ca79..be3a33cafcc 100644
--- a/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php
+++ b/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Shipping\Model\Config\Source;
 
-class Allmethods implements \Magento\Core\Model\Option\ArrayInterface
+class Allmethods implements \Magento\Option\ArrayInterface
 {
     /**
      * Core store config
diff --git a/app/code/Magento/Shipping/Model/Config/Source/Allspecificcountries.php b/app/code/Magento/Shipping/Model/Config/Source/Allspecificcountries.php
index 1f3aaaec006..feaf53d0ee5 100644
--- a/app/code/Magento/Shipping/Model/Config/Source/Allspecificcountries.php
+++ b/app/code/Magento/Shipping/Model/Config/Source/Allspecificcountries.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Shipping\Model\Config\Source;
 
-class Allspecificcountries implements \Magento\Core\Model\Option\ArrayInterface
+class Allspecificcountries implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Shipping/Model/Config/Source/Flatrate.php b/app/code/Magento/Shipping/Model/Config/Source/Flatrate.php
index b2dde6dc4c4..b8f20ba036c 100644
--- a/app/code/Magento/Shipping/Model/Config/Source/Flatrate.php
+++ b/app/code/Magento/Shipping/Model/Config/Source/Flatrate.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Shipping\Model\Config\Source;
 
-class Flatrate implements \Magento\Core\Model\Option\ArrayInterface
+class Flatrate implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Shipping/Model/Config/Source/Tablerate.php b/app/code/Magento/Shipping/Model/Config/Source/Tablerate.php
index f6242e9ce2a..b8baf119b6d 100644
--- a/app/code/Magento/Shipping/Model/Config/Source/Tablerate.php
+++ b/app/code/Magento/Shipping/Model/Config/Source/Tablerate.php
@@ -27,7 +27,7 @@
 
 namespace Magento\Shipping\Model\Config\Source;
 
-class Tablerate implements \Magento\Core\Model\Option\ArrayInterface
+class Tablerate implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Shipping\Model\Carrier\Tablerate
diff --git a/app/code/Magento/Shipping/Model/Order/Track.php b/app/code/Magento/Shipping/Model/Order/Track.php
index 414d8020286..a40c2944bc3 100644
--- a/app/code/Magento/Shipping/Model/Order/Track.php
+++ b/app/code/Magento/Shipping/Model/Order/Track.php
@@ -55,8 +55,8 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track
     protected $_carrierFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\LocaleInterface $coreLocale
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -69,8 +69,8 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\LocaleInterface $coreLocale,
         \Magento\Stdlib\DateTime $dateTime,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
diff --git a/app/code/Magento/Shipping/Model/Source/HandlingAction.php b/app/code/Magento/Shipping/Model/Source/HandlingAction.php
index 25d53ba532f..f1f7c9cf1a6 100644
--- a/app/code/Magento/Shipping/Model/Source/HandlingAction.php
+++ b/app/code/Magento/Shipping/Model/Source/HandlingAction.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Shipping\Model\Source;
 
-class HandlingAction implements \Magento\Core\Model\Option\ArrayInterface
+class HandlingAction implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Shipping/Model/Source/HandlingType.php b/app/code/Magento/Shipping/Model/Source/HandlingType.php
index a1e9eae8ba2..6a4563360e5 100644
--- a/app/code/Magento/Shipping/Model/Source/HandlingType.php
+++ b/app/code/Magento/Shipping/Model/Source/HandlingType.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Shipping\Model\Source;
 
-class HandlingType implements \Magento\Core\Model\Option\ArrayInterface
+class HandlingType implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Edit.php b/app/code/Magento/Sitemap/Block/Adminhtml/Edit.php
index 417ce2f6251..c553ee27d82 100644
--- a/app/code/Magento/Sitemap/Block/Adminhtml/Edit.php
+++ b/app/code/Magento/Sitemap/Block/Adminhtml/Edit.php
@@ -35,18 +35,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php
index e2fce6380a1..8435c71b6a3 100644
--- a/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php
+++ b/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php
@@ -39,14 +39,14 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\System\Store $systemStore
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\System\Store $systemStore,
         array $data = array()
diff --git a/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php b/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php
index 13bf5b94ca3..be4bd0b5707 100644
--- a/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php
+++ b/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php
@@ -35,17 +35,17 @@ class Sitemap extends  \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Sitemap/Model/Config/Source/Frequency.php b/app/code/Magento/Sitemap/Model/Config/Source/Frequency.php
index 73b9926ce18..6131677628d 100644
--- a/app/code/Magento/Sitemap/Model/Config/Source/Frequency.php
+++ b/app/code/Magento/Sitemap/Model/Config/Source/Frequency.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Sitemap\Model\Config\Source;
 
-class Frequency implements \Magento\Core\Model\Option\ArrayInterface
+class Frequency implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php
index 475d0b3e1ca..a10e7711a5d 100644
--- a/app/code/Magento/Sitemap/Model/Observer.php
+++ b/app/code/Magento/Sitemap/Model/Observer.php
@@ -70,31 +70,39 @@ class Observer
     protected $_collectionFactory;
 
     /**
-     * @var \Magento\Email\Model\TemplateFactory
+     * @var \Magento\Mail\Template\TransportBuilder
      */
-    protected $_templateFactory;
+    protected $_transportBuilder;
 
     /**
      * @var \Magento\TranslateInterface
      */
     protected $_translateModel;
 
+    /**
+     * @var \Magento\Core\Model\StoreManagerInterface
+     */
+    protected $_storeManager;
+
     /**
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
-     * @param \Magento\Sitemap\Model\Resource\Sitemap\CollectionFactory $collectionFactory
+     * @param Resource\Sitemap\CollectionFactory $collectionFactory
      * @param \Magento\TranslateInterface $translateModel
-     * @param \Magento\Email\Model\TemplateFactory $templateFactory
+     * @param \Magento\Core\Model\StoreManagerInterface $storeManager
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      */
     public function __construct(
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Sitemap\Model\Resource\Sitemap\CollectionFactory $collectionFactory,
         \Magento\TranslateInterface $translateModel,
-        \Magento\Email\Model\TemplateFactory $templateFactory
+        \Magento\Core\Model\StoreManagerInterface $storeManager,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder
     ) {
         $this->_coreStoreConfig = $coreStoreConfig;
         $this->_collectionFactory = $collectionFactory;
         $this->_translateModel = $translateModel;
-        $this->_templateFactory = $templateFactory;
+        $this->_storeManager = $storeManager;
+        $this->_transportBuilder = $transportBuilder;
     }
 
     /**
@@ -126,20 +134,24 @@ class Observer
         }
 
         if ($errors && $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT)) {
+            $translate = $this->_translateModel->getTranslateInline();
             $this->_translateModel->setTranslateInline(false);
 
-            $emailTemplate = $this->_templateFactory->create();
-            /* @var $emailTemplate \Magento\Email\Model\Template */
-            $emailTemplate->setDesignConfig(array('area' => 'backend'))
-                ->sendTransactional(
-                    $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE),
-                    $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_IDENTITY),
-                    $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT),
-                    null,
-                    array('warnings' => join("\n", $errors))
-                );
-
-            $this->_translateModel->setTranslateInline(true);
+            $this->_transportBuilder
+                ->setTemplateIdentifier(
+                    $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE)
+                )
+                ->setTemplateOptions(array(
+                    'area' => \Magento\Core\Model\App\Area::AREA_ADMIN,
+                    'store' => $this->_storeManager->getStore()->getId(),
+                ))
+                ->setTemplateVars(array('warnings' => join("\n", $errors)))
+                ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_IDENTITY))
+                ->addTo($this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT));
+            $transport = $this->_transportBuilder->getTransport();
+            $transport->sendMessage();
+
+            $this->_translateModel->setTranslateInline($translate);
         }
     }
 }
diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php
index 342ef3c14f7..8d648482895 100644
--- a/app/code/Magento/Sitemap/Model/Sitemap.php
+++ b/app/code/Magento/Sitemap/Model/Sitemap.php
@@ -156,8 +156,8 @@ class Sitemap extends \Magento\Core\Model\AbstractModel
     protected $dateTime;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Escaper $escaper
      * @param \Magento\Sitemap\Helper\Data $sitemapData
      * @param \Magento\App\Filesystem $filesystem
@@ -173,8 +173,8 @@ class Sitemap extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Escaper $escaper,
         \Magento\Sitemap\Helper\Data $sitemapData,
         \Magento\App\Filesystem $filesystem,
diff --git a/app/code/Magento/Sitemap/Model/Source/Product/Image/IncludeImage.php b/app/code/Magento/Sitemap/Model/Source/Product/Image/IncludeImage.php
index 285fde19c97..05e572c0cd2 100644
--- a/app/code/Magento/Sitemap/Model/Source/Product/Image/IncludeImage.php
+++ b/app/code/Magento/Sitemap/Model/Source/Product/Image/IncludeImage.php
@@ -32,7 +32,7 @@
  */
 namespace Magento\Sitemap\Model\Source\Product\Image;
 
-class IncludeImage implements \Magento\Core\Model\Option\ArrayInterface
+class IncludeImage implements \Magento\Option\ArrayInterface
 {
     /**#@+
      * Add Images into Sitemap possible values
diff --git a/app/code/Magento/Sitemap/etc/module.xml b/app/code/Magento/Sitemap/etc/module.xml
index 689b8c319fa..729467a2115 100755
--- a/app/code/Magento/Sitemap/etc/module.xml
+++ b/app/code/Magento/Sitemap/etc/module.xml
@@ -34,7 +34,6 @@
             <module name="Magento_Eav"/>
             <module name="Magento_Cms"/>
             <module name="Magento_Backend"/>
-            <module name="Magento_Email"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php
index f849a18be72..b3b5dd45bd5 100644
--- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php
+++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php
@@ -82,7 +82,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Directory\Model\RegionFactory $regionFactory
      * @param \Magento\Directory\Model\Config\Source\Country $country
@@ -94,7 +94,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Directory\Model\RegionFactory $regionFactory,
         \Magento\Directory\Model\Config\Source\Country $country,
diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit.php b/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit.php
index 383d32d0b46..29546335b63 100644
--- a/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit.php
+++ b/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit.php
@@ -35,18 +35,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php b/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php
index 0da1fc646b0..57f3836b344 100644
--- a/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php
+++ b/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php
@@ -40,17 +40,17 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
      * @var \Magento\Data\Form\FormKey
      */
     protected $formKey;
-    
+
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Tax\Model\Calculation\RateFactory $rateFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Tax\Model\Calculation\RateFactory $rateFactory,
         array $data = array()
diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rule.php b/app/code/Magento/Tax/Controller/Adminhtml/Rule.php
index 81e01cbd325..f4c71878b83 100644
--- a/app/code/Magento/Tax/Controller/Adminhtml/Rule.php
+++ b/app/code/Magento/Tax/Controller/Adminhtml/Rule.php
@@ -40,17 +40,17 @@ class Rule extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context);
diff --git a/app/code/Magento/Tax/Helper/Data.php b/app/code/Magento/Tax/Helper/Data.php
index 14cca5d72ce..b0f7d42feb6 100644
--- a/app/code/Magento/Tax/Helper/Data.php
+++ b/app/code/Magento/Tax/Helper/Data.php
@@ -103,7 +103,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -137,7 +137,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
     /**
      * @param \Magento\App\Helper\Context $context
      * @param \Magento\Core\Helper\Data $coreData
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Tax\Model\Config $taxConfig
      * @param \Magento\Tax\Model\Calculation $calculation
@@ -149,7 +149,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
     public function __construct(
         \Magento\App\Helper\Context $context,
         \Magento\Core\Helper\Data $coreData,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Tax\Model\Config $taxConfig,
         \Magento\Tax\Model\Calculation $calculation,
diff --git a/app/code/Magento/Tax/Model/Calculation.php b/app/code/Magento/Tax/Model/Calculation.php
index b0501aaeb42..c4341a40d0e 100644
--- a/app/code/Magento/Tax/Model/Calculation.php
+++ b/app/code/Magento/Tax/Model/Calculation.php
@@ -117,8 +117,8 @@ class Calculation extends \Magento\Core\Model\AbstractModel
     protected $_classesFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Customer\Helper\Data $customerData
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
@@ -131,8 +131,8 @@ class Calculation extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Customer\Helper\Data $customerData,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
diff --git a/app/code/Magento/Tax/Model/Calculation/Rate.php b/app/code/Magento/Tax/Model/Calculation/Rate.php
index adc8620fc8a..9cdf52bf2a8 100644
--- a/app/code/Magento/Tax/Model/Calculation/Rate.php
+++ b/app/code/Magento/Tax/Model/Calculation/Rate.php
@@ -71,8 +71,8 @@ class Rate extends \Magento\Core\Model\AbstractModel
     protected $_titleFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Directory\Model\RegionFactory $regionFactory
      * @param \Magento\Tax\Model\Calculation\Rate\TitleFactory $taxTitleFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
@@ -80,8 +80,8 @@ class Rate extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Directory\Model\RegionFactory $regionFactory,
         \Magento\Tax\Model\Calculation\Rate\TitleFactory $taxTitleFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Tax/Model/Calculation/Rule.php b/app/code/Magento/Tax/Model/Calculation/Rule.php
index 5e8df8790b6..2afeaab5fc9 100644
--- a/app/code/Magento/Tax/Model/Calculation/Rule.php
+++ b/app/code/Magento/Tax/Model/Calculation/Rule.php
@@ -97,8 +97,8 @@ class Rule extends \Magento\Core\Model\AbstractModel
     protected $_calculation;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxHelper
      * @param \Magento\Tax\Model\ClassModel $taxClass
      * @param \Magento\Tax\Model\Calculation $calculation
@@ -107,8 +107,8 @@ class Rule extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxHelper,
         \Magento\Tax\Model\ClassModel $taxClass,
         \Magento\Tax\Model\Calculation $calculation,
diff --git a/app/code/Magento/Tax/Model/ClassModel.php b/app/code/Magento/Tax/Model/ClassModel.php
index 12eb37553d6..71f3f73b0f6 100644
--- a/app/code/Magento/Tax/Model/ClassModel.php
+++ b/app/code/Magento/Tax/Model/ClassModel.php
@@ -59,16 +59,16 @@ class ClassModel extends \Magento\Core\Model\AbstractModel
     protected $_classFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Model\TaxClass\Factory $classFactory
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Tax\Model\TaxClass\Factory $classFactory,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
diff --git a/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php b/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php
index 83dde3145b7..cffad93165a 100644
--- a/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php
+++ b/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php
@@ -34,8 +34,8 @@ class IncludePrice extends \Magento\Core\Model\Config\Value
     protected $_app;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\App\ConfigInterface $config
      * @param \Magento\Core\Model\App $app
@@ -44,8 +44,8 @@ class IncludePrice extends \Magento\Core\Model\Config\Value
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\App\ConfigInterface $config,
         \Magento\Core\Model\App $app,
diff --git a/app/code/Magento/Tax/Model/Config/Source/Apply/On.php b/app/code/Magento/Tax/Model/Config/Source/Apply/On.php
index 3ad73a8062e..706d05bc1d0 100644
--- a/app/code/Magento/Tax/Model/Config/Source/Apply/On.php
+++ b/app/code/Magento/Tax/Model/Config/Source/Apply/On.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Tax\Model\Config\Source\Apply;
 
-class On implements \Magento\Core\Model\Option\ArrayInterface
+class On implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Tax/Model/Config/Source/Basedon.php b/app/code/Magento/Tax/Model/Config/Source/Basedon.php
index f03a55ee5ee..f89ee3c9256 100644
--- a/app/code/Magento/Tax/Model/Config/Source/Basedon.php
+++ b/app/code/Magento/Tax/Model/Config/Source/Basedon.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Tax\Model\Config\Source;
 
-class Basedon implements \Magento\Core\Model\Option\ArrayInterface
+class Basedon implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Tax/Model/Config/Source/Catalog.php b/app/code/Magento/Tax/Model/Config/Source/Catalog.php
index 070e8aaa140..2f108f79f0d 100644
--- a/app/code/Magento/Tax/Model/Config/Source/Catalog.php
+++ b/app/code/Magento/Tax/Model/Config/Source/Catalog.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Tax\Model\Config\Source;
 
-class Catalog implements \Magento\Core\Model\Option\ArrayInterface
+class Catalog implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Tax/Model/Config/Source/TaxClass/Customer.php b/app/code/Magento/Tax/Model/Config/Source/TaxClass/Customer.php
index 972b5ecc8a4..8ae55fe4d6e 100644
--- a/app/code/Magento/Tax/Model/Config/Source/TaxClass/Customer.php
+++ b/app/code/Magento/Tax/Model/Config/Source/TaxClass/Customer.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Tax\Model\Config\Source\TaxClass;
 
-class Customer implements \Magento\Core\Model\Option\ArrayInterface
+class Customer implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Tax\Model\TaxClass\Source\CustomerFactory
diff --git a/app/code/Magento/Tax/Model/Config/Source/TaxClass/Product.php b/app/code/Magento/Tax/Model/Config/Source/TaxClass/Product.php
index 221cbd7f615..d5c52e361d1 100644
--- a/app/code/Magento/Tax/Model/Config/Source/TaxClass/Product.php
+++ b/app/code/Magento/Tax/Model/Config/Source/TaxClass/Product.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Tax\Model\Config\Source\TaxClass;
 
-class Product implements \Magento\Core\Model\Option\ArrayInterface
+class Product implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Tax\Model\TaxClass\Source\ProductFactory
diff --git a/app/code/Magento/Tax/Model/Resource/Rule/Grid/Options/CustomerTaxClass.php b/app/code/Magento/Tax/Model/Resource/Rule/Grid/Options/CustomerTaxClass.php
index 368444c579c..265cc3b234b 100644
--- a/app/code/Magento/Tax/Model/Resource/Rule/Grid/Options/CustomerTaxClass.php
+++ b/app/code/Magento/Tax/Model/Resource/Rule/Grid/Options/CustomerTaxClass.php
@@ -26,7 +26,7 @@
 namespace Magento\Tax\Model\Resource\Rule\Grid\Options;
 
 class CustomerTaxClass
-    implements \Magento\Core\Model\Option\ArrayInterface
+    implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Tax\Model\Resource\TaxClass\CollectionFactory
diff --git a/app/code/Magento/Tax/Model/Resource/Rule/Grid/Options/HashOptimized.php b/app/code/Magento/Tax/Model/Resource/Rule/Grid/Options/HashOptimized.php
index 9dd09f93b61..016fc49a9b3 100644
--- a/app/code/Magento/Tax/Model/Resource/Rule/Grid/Options/HashOptimized.php
+++ b/app/code/Magento/Tax/Model/Resource/Rule/Grid/Options/HashOptimized.php
@@ -26,7 +26,7 @@
 namespace Magento\Tax\Model\Resource\Rule\Grid\Options;
 
 class HashOptimized
-    implements \Magento\Core\Model\Option\ArrayInterface
+    implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Tax\Model\Resource\Calculation\Rate\Collection
diff --git a/app/code/Magento/Tax/Model/Resource/Rule/Grid/Options/ProductTaxClass.php b/app/code/Magento/Tax/Model/Resource/Rule/Grid/Options/ProductTaxClass.php
index d9f588aa835..c9d0ca807d0 100644
--- a/app/code/Magento/Tax/Model/Resource/Rule/Grid/Options/ProductTaxClass.php
+++ b/app/code/Magento/Tax/Model/Resource/Rule/Grid/Options/ProductTaxClass.php
@@ -26,7 +26,7 @@
 namespace Magento\Tax\Model\Resource\Rule\Grid\Options;
 
 class ProductTaxClass
-    implements \Magento\Core\Model\Option\ArrayInterface
+    implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Tax\Model\Resource\TaxClass\CollectionFactory
diff --git a/app/code/Magento/Tax/Model/System/Config/Source/Algorithm.php b/app/code/Magento/Tax/Model/System/Config/Source/Algorithm.php
index 5261d5887c8..125177d66fc 100644
--- a/app/code/Magento/Tax/Model/System/Config/Source/Algorithm.php
+++ b/app/code/Magento/Tax/Model/System/Config/Source/Algorithm.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Tax\Model\System\Config\Source;
 
-class Algorithm implements \Magento\Core\Model\Option\ArrayInterface
+class Algorithm implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Tax/Model/System/Config/Source/Apply.php b/app/code/Magento/Tax/Model/System/Config/Source/Apply.php
index a44c086d70b..bdaba0cc81e 100644
--- a/app/code/Magento/Tax/Model/System/Config/Source/Apply.php
+++ b/app/code/Magento/Tax/Model/System/Config/Source/Apply.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Tax\Model\System\Config\Source;
 
-class Apply implements \Magento\Core\Model\Option\ArrayInterface
+class Apply implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Tax/Model/System/Config/Source/PriceType.php b/app/code/Magento/Tax/Model/System/Config/Source/PriceType.php
index 87df0a04555..56ad3a10c18 100644
--- a/app/code/Magento/Tax/Model/System/Config/Source/PriceType.php
+++ b/app/code/Magento/Tax/Model/System/Config/Source/PriceType.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Tax\Model\System\Config\Source;
 
-class PriceType implements \Magento\Core\Model\Option\ArrayInterface
+class PriceType implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Tax/Model/System/Config/Source/Tax/Display/Type.php b/app/code/Magento/Tax/Model/System/Config/Source/Tax/Display/Type.php
index d848ab6a940..22b08d1d66a 100644
--- a/app/code/Magento/Tax/Model/System/Config/Source/Tax/Display/Type.php
+++ b/app/code/Magento/Tax/Model/System/Config/Source/Tax/Display/Type.php
@@ -31,7 +31,7 @@
  */
 namespace Magento\Tax\Model\System\Config\Source\Tax\Display;
 
-class Type implements \Magento\Core\Model\Option\ArrayInterface
+class Type implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Tax/Model/System/Config/Source/Tax/Region.php b/app/code/Magento/Tax/Model/System/Config/Source/Tax/Region.php
index 13db8946479..d2a1b0e720b 100644
--- a/app/code/Magento/Tax/Model/System/Config/Source/Tax/Region.php
+++ b/app/code/Magento/Tax/Model/System/Config/Source/Tax/Region.php
@@ -26,7 +26,7 @@
 
 namespace Magento\Tax\Model\System\Config\Source\Tax;
 
-class Region implements \Magento\Core\Model\Option\ArrayInterface
+class Region implements \Magento\Option\ArrayInterface
 {
     /**
      * @var array
diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit.php
index 736cba7ac6a..0e4fda2bae6 100644
--- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit.php
+++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit.php
@@ -34,18 +34,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/AbstractTab.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/AbstractTab.php
index 91bdc425faf..b91c75ab723 100644
--- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/AbstractTab.php
+++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/AbstractTab.php
@@ -44,20 +44,20 @@ abstract class AbstractTab
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\ObjectManager $objectManager
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\ObjectManager $objectManager,
         array $data = array()
diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/Css.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/Css.php
index 7598a532f47..614bf189ad9 100644
--- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/Css.php
+++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/Css.php
@@ -59,7 +59,7 @@ class Css
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\ObjectManager $objectManager
      * @param \Magento\Theme\Model\Uploader\Service $uploaderService
@@ -68,7 +68,7 @@ class Css
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\ObjectManager $objectManager,
         \Magento\Theme\Model\Uploader\Service $uploaderService,
diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/General.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/General.php
index 1ac6786447a..ddc9c690fab 100644
--- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/General.php
+++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/General.php
@@ -53,7 +53,7 @@ class General
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\ObjectManager $objectManager
      * @param \Magento\View\Design\Theme\Image\PathInterface $themeImagePath
@@ -62,7 +62,7 @@ class General
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\ObjectManager $objectManager,
         \Magento\View\Design\Theme\Image\PathInterface $themeImagePath,
diff --git a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php
index 4246d132f68..c5afa528642 100644
--- a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php
+++ b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php
@@ -36,7 +36,7 @@ class Theme extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -47,12 +47,12 @@ class Theme extends \Magento\Backend\App\Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\App\Response\Http\FileFactory $fileFactory
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\App\Response\Http\FileFactory $fileFactory
     ) {
         $this->_coreRegistry = $coreRegistry;
diff --git a/app/code/Magento/Theme/Model/Layout/Source/Layout.php b/app/code/Magento/Theme/Model/Layout/Source/Layout.php
index 67c974c01c8..b83646929d1 100644
--- a/app/code/Magento/Theme/Model/Layout/Source/Layout.php
+++ b/app/code/Magento/Theme/Model/Layout/Source/Layout.php
@@ -23,7 +23,7 @@
  */
 namespace Magento\Theme\Model\Layout\Source;
 
-class Layout implements \Magento\Core\Model\Option\ArrayInterface
+class Layout implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Theme\Model\Layout\Config
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier.php b/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier.php
index c75e6f7794e..1038fce4b40 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier.php
@@ -111,7 +111,7 @@ abstract class AbstractCarrier extends \Magento\Shipping\Model\Carrier\AbstractC
     /**
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory
      * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory
      * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
@@ -123,13 +123,13 @@ abstract class AbstractCarrier extends \Magento\Shipping\Model\Carrier\AbstractC
      * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
      * @param \Magento\Directory\Helper\Data $directoryData
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory,
         \Magento\Shipping\Model\Rate\ResultFactory $rateFactory,
         \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier/Source/Mode.php b/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier/Source/Mode.php
index 0a764c96010..5a960937221 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier/Source/Mode.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier/Source/Mode.php
@@ -34,7 +34,7 @@
 
 namespace Magento\Usa\Model\Shipping\Carrier\AbstractCarrier\Source;
 
-class Mode implements \Magento\Core\Model\Option\ArrayInterface
+class Mode implements \Magento\Option\ArrayInterface
 {
     /**
      * Returns array to be used in packages request type on back-end
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier/Source/Requesttype.php b/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier/Source/Requesttype.php
index b80ce15664d..e83ff5612c2 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier/Source/Requesttype.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier/Source/Requesttype.php
@@ -33,7 +33,7 @@
  */
 namespace Magento\Usa\Model\Shipping\Carrier\AbstractCarrier\Source;
 
-class Requesttype implements \Magento\Core\Model\Option\ArrayInterface
+class Requesttype implements \Magento\Option\ArrayInterface
 {
     /**
      * Returns array to be used in packages request type on back-end
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php
index a332024bcc1..b90655488a4 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php
@@ -191,7 +191,7 @@ class Dhl
     /**
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory
      * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory
      * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
@@ -206,13 +206,13 @@ class Dhl
      * @param \Magento\Stdlib\String $string
      * @param \Zend_Http_ClientFactory $httpClientFactory
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory,
         \Magento\Shipping\Model\Rate\ResultFactory $rateFactory,
         \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php
index 783f7bd51f3..ee3cce06b3e 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php
@@ -212,7 +212,7 @@ class International
     /**
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory
      * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory
      * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
@@ -237,7 +237,7 @@ class International
     public function __construct(
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory,
         \Magento\Shipping\Model\Rate\ResultFactory $rateFactory,
         \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International/Source/Contenttype.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International/Source/Contenttype.php
index e9adef5d258..52ad9663e78 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International/Source/Contenttype.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International/Source/Contenttype.php
@@ -30,7 +30,7 @@ namespace Magento\Usa\Model\Shipping\Carrier\Dhl\International\Source;
  *
  * @author     Magento Core Team <core@magentocommerce.com>
  */
-class Contenttype implements \Magento\Core\Model\Option\ArrayInterface
+class Contenttype implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Source/Generic.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Source/Generic.php
index 21822c5894f..6e33b10b2f7 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Source/Generic.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Source/Generic.php
@@ -17,14 +17,14 @@
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
- *   
+ *
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
 namespace Magento\Usa\Model\Shipping\Carrier\Dhl\Source;
 
-class Generic implements \Magento\Core\Model\Option\ArrayInterface
+class Generic implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Usa\Model\Shipping\Carrier\Dhl
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php
index cfd4298d850..17391a17bd1 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php
@@ -133,7 +133,7 @@ class Fedex
     /**
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory
      * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory
      * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
@@ -149,13 +149,13 @@ class Fedex
      * @param \Magento\Module\Dir\Reader $configReader
      * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory,
         \Magento\Shipping\Model\Rate\ResultFactory $rateFactory,
         \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex/Source/Generic.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex/Source/Generic.php
index 47f8ea48db8..595a32f6ff2 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex/Source/Generic.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex/Source/Generic.php
@@ -17,14 +17,14 @@
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
- *   
+ *
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
 namespace Magento\Usa\Model\Shipping\Carrier\Fedex\Source;
 
-class Generic implements \Magento\Core\Model\Option\ArrayInterface
+class Generic implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Usa\Model\Shipping\Carrier\Fedex
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php
index 3858e3006de..45b81ec95ff 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php
@@ -140,7 +140,7 @@ class Ups
     /**
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory
      * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory
      * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
@@ -154,13 +154,13 @@ class Ups
      * @param \Magento\Logger $logger
      * @param \Magento\Core\Model\LocaleInterface $locale
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory,
         \Magento\Shipping\Model\Rate\ResultFactory $rateFactory,
         \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Generic.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Generic.php
index 34d077583b6..cac9d09a8c4 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Generic.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Generic.php
@@ -17,13 +17,13 @@
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
- *   
+ *
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 namespace Magento\Usa\Model\Shipping\Carrier\Ups\Source;
 
-class Generic implements \Magento\Core\Model\Option\ArrayInterface
+class Generic implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Usa\Model\Shipping\Carrier\Ups
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Mode.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Mode.php
index 133e932a5be..bb7c7f2857b 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Mode.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Mode.php
@@ -34,7 +34,7 @@
  */
 namespace Magento\Usa\Model\Shipping\Carrier\Ups\Source;
 
-class Mode implements \Magento\Core\Model\Option\ArrayInterface
+class Mode implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Type.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Type.php
index 4d7f8cf0884..1f74934650a 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Type.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Type.php
@@ -32,7 +32,7 @@
  */
 namespace Magento\Usa\Model\Shipping\Carrier\Ups\Source;
 
-class Type implements \Magento\Core\Model\Option\ArrayInterface
+class Type implements \Magento\Option\ArrayInterface
 {
     /**
      * {@inheritdoc}
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php
index 1761295c9f7..4bf5a7c9181 100755
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php
@@ -141,7 +141,7 @@ class Usps
     /**
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
-     * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+     * @param \Magento\Logger\AdapterFactory $logAdapterFactory
      * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory
      * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory
      * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
@@ -156,13 +156,13 @@ class Usps
      * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory
      * @param \Zend_Http_ClientFactory $httpClientFactory
      * @param array $data
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
-        \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+        \Magento\Logger\AdapterFactory $logAdapterFactory,
         \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory,
         \Magento\Shipping\Model\Rate\ResultFactory $rateFactory,
         \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Usps/Source/Generic.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Usps/Source/Generic.php
index 9e536376c58..aa0fb934a5b 100644
--- a/app/code/Magento/Usa/Model/Shipping/Carrier/Usps/Source/Generic.php
+++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Usps/Source/Generic.php
@@ -17,14 +17,14 @@
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
- *   
+ *
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
 namespace Magento\Usa\Model\Shipping\Carrier\Usps\Source;
 
-class Generic implements \Magento\Core\Model\Option\ArrayInterface
+class Generic implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Usa\Model\Shipping\Carrier\Usps
diff --git a/app/code/Magento/User/Block/Buttons.php b/app/code/Magento/User/Block/Buttons.php
index 486c9947b3b..49c3dbb701b 100644
--- a/app/code/Magento/User/Block/Buttons.php
+++ b/app/code/Magento/User/Block/Buttons.php
@@ -31,18 +31,18 @@ class Buttons extends \Magento\Backend\Block\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/User/Block/Role/Edit.php b/app/code/Magento/User/Block/Role/Edit.php
index 72cebbd477b..df3a95cf842 100644
--- a/app/code/Magento/User/Block/Role/Edit.php
+++ b/app/code/Magento/User/Block/Role/Edit.php
@@ -30,7 +30,7 @@ class Edit extends \Magento\Backend\Block\Widget\Tabs
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -38,14 +38,14 @@ class Edit extends \Magento\Backend\Block\Widget\Tabs
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\Backend\Model\Auth\Session $authSession
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\Backend\Model\Auth\Session $authSession,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/User/Block/Role/Grid/User.php b/app/code/Magento/User/Block/Role/Grid/User.php
index 89269e758ac..2a99649b8c2 100644
--- a/app/code/Magento/User/Block/Role/Grid/User.php
+++ b/app/code/Magento/User/Block/Role/Grid/User.php
@@ -33,7 +33,7 @@ class User extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -53,7 +53,7 @@ class User extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Json\EncoderInterface $jsonEncoder
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\User\Model\RoleFactory $roleFactory
      * @param array $data
      */
@@ -61,7 +61,7 @@ class User extends \Magento\Backend\Block\Widget\Grid\Extended
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Json\EncoderInterface $jsonEncoder,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\User\Model\RoleFactory $roleFactory,
         array $data = array()
     ) {
diff --git a/app/code/Magento/User/Block/Role/Tab/Edit.php b/app/code/Magento/User/Block/Role/Tab/Edit.php
index 542d262bebe..e49216932c2 100644
--- a/app/code/Magento/User/Block/Role/Tab/Edit.php
+++ b/app/code/Magento/User/Block/Role/Tab/Edit.php
@@ -40,7 +40,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form
     /**
      * Root ACL Resource
      *
-     * @var \Magento\Core\Model\Acl\RootResource
+     * @var \Magento\Acl\RootResource
      */
     protected $_rootResource;
 
@@ -70,7 +70,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Acl\RootResource $rootResource
+     * @param \Magento\Acl\RootResource $rootResource
      * @param \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory
      * @param \Magento\Acl\Builder $aclBuilder
      * @param \Magento\Acl\Resource\ProviderInterface $aclResourceProvider
@@ -79,7 +79,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Acl\RootResource $rootResource,
+        \Magento\Acl\RootResource $rootResource,
         \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory,
         \Magento\Acl\Builder $aclBuilder,
         \Magento\Acl\Resource\ProviderInterface $aclResourceProvider,
diff --git a/app/code/Magento/User/Block/User/Edit.php b/app/code/Magento/User/Block/User/Edit.php
index 5930e8c2408..0a26e3b57e8 100644
--- a/app/code/Magento/User/Block/User/Edit.php
+++ b/app/code/Magento/User/Block/User/Edit.php
@@ -37,18 +37,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/User/Block/User/Edit/Tab/Main.php b/app/code/Magento/User/Block/User/Edit/Tab/Main.php
index bb3c0e89a04..703c2f234db 100644
--- a/app/code/Magento/User/Block/User/Edit/Tab/Main.php
+++ b/app/code/Magento/User/Block/User/Edit/Tab/Main.php
@@ -37,14 +37,14 @@ class Main extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Backend\Model\Auth\Session $authSession
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Backend\Model\Auth\Session $authSession,
         array $data = array()
@@ -52,7 +52,7 @@ class Main extends \Magento\Backend\Block\Widget\Form\Generic
         $this->_authSession = $authSession;
         parent::__construct($context, $registry, $formFactory, $data);
     }
-    
+
     /**
      * Prepare form fields
      *
diff --git a/app/code/Magento/User/Block/User/Edit/Tab/Roles.php b/app/code/Magento/User/Block/User/Edit/Tab/Roles.php
index 8e208b73bee..c5948880b16 100644
--- a/app/code/Magento/User/Block/User/Edit/Tab/Roles.php
+++ b/app/code/Magento/User/Block/User/Edit/Tab/Roles.php
@@ -32,7 +32,7 @@ class Roles extends \Magento\Backend\Block\Widget\Grid\Extended
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -51,7 +51,7 @@ class Roles extends \Magento\Backend\Block\Widget\Grid\Extended
      * @param \Magento\Backend\Helper\Data $backendHelper
      * @param \Magento\Json\EncoderInterface $jsonEncoder
      * @param \Magento\User\Model\Resource\Role\CollectionFactory $userRolesFactory
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param array $data
      */
     public function __construct(
@@ -59,7 +59,7 @@ class Roles extends \Magento\Backend\Block\Widget\Grid\Extended
         \Magento\Backend\Helper\Data $backendHelper,
         \Magento\Json\EncoderInterface $jsonEncoder,
         \Magento\User\Model\Resource\Role\CollectionFactory $userRolesFactory,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         array $data = array()
     ) {
         $this->_jsonEncoder = $jsonEncoder;
diff --git a/app/code/Magento/User/Controller/Adminhtml/User.php b/app/code/Magento/User/Controller/Adminhtml/User.php
index 5511c532ad4..a01d8b69c05 100644
--- a/app/code/Magento/User/Controller/Adminhtml/User.php
+++ b/app/code/Magento/User/Controller/Adminhtml/User.php
@@ -28,7 +28,7 @@ class User extends \Magento\Backend\App\AbstractAction
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -41,12 +41,12 @@ class User extends \Magento\Backend\App\AbstractAction
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\User\Model\UserFactory $userFactory
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\User\Model\UserFactory $userFactory
     ) {
         parent::__construct($context);
diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Role.php b/app/code/Magento/User/Controller/Adminhtml/User/Role.php
index bc0397b95e3..33791d26b75 100644
--- a/app/code/Magento/User/Controller/Adminhtml/User/Role.php
+++ b/app/code/Magento/User/Controller/Adminhtml/User/Role.php
@@ -30,7 +30,7 @@ class Role extends \Magento\Backend\App\AbstractAction
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -64,7 +64,7 @@ class Role extends \Magento\Backend\App\AbstractAction
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\User\Model\RoleFactory $roleFactory
      * @param \Magento\User\Model\UserFactory $userFactory
      * @param \Magento\User\Model\RulesFactory $rulesFactory
@@ -72,7 +72,7 @@ class Role extends \Magento\Backend\App\AbstractAction
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\User\Model\RoleFactory $roleFactory,
         \Magento\User\Model\UserFactory $userFactory,
         \Magento\User\Model\RulesFactory $rulesFactory,
@@ -222,7 +222,7 @@ class Role extends \Magento\Backend\App\AbstractAction
 
         $isAll = $this->getRequest()->getParam('all');
         if ($isAll) {
-            $resource = array($this->_objectManager->get('Magento\Core\Model\Acl\RootResource')->getId());
+            $resource = array($this->_objectManager->get('Magento\Acl\RootResource')->getId());
         }
 
         $role = $this->_initRole('role_id');
diff --git a/app/code/Magento/User/Model/Acl/Loader/Rule.php b/app/code/Magento/User/Model/Acl/Loader/Rule.php
index d292b2c33be..b1672c3145d 100644
--- a/app/code/Magento/User/Model/Acl/Loader/Rule.php
+++ b/app/code/Magento/User/Model/Acl/Loader/Rule.php
@@ -31,13 +31,13 @@ class Rule implements \Magento\Acl\LoaderInterface
     protected $_resource;
 
     /**
-     * @param \Magento\Core\Model\Acl\RootResource $rootResource
+     * @param \Magento\Acl\RootResource $rootResource
      * @param \Magento\App\Resource $resource
      * @param array $data
      * @SuppressWarnings(PHPMD.UnusedFormalParameter):
      */
     public function __construct(
-        \Magento\Core\Model\Acl\RootResource $rootResource,
+        \Magento\Acl\RootResource $rootResource,
         \Magento\App\Resource $resource,
         array $data = array()
     ) {
diff --git a/app/code/Magento/User/Model/Resource/Rules.php b/app/code/Magento/User/Model/Resource/Rules.php
index 2d087f334a2..1c82a1b1a33 100644
--- a/app/code/Magento/User/Model/Resource/Rules.php
+++ b/app/code/Magento/User/Model/Resource/Rules.php
@@ -31,7 +31,7 @@ class Rules extends \Magento\Core\Model\Resource\Db\AbstractDb
     /**
      * Root ACL resource
      *
-     * @var \Magento\Core\Model\Acl\RootResource
+     * @var \Magento\Acl\RootResource
      */
     protected $_rootResource;
 
@@ -56,14 +56,14 @@ class Rules extends \Magento\Core\Model\Resource\Db\AbstractDb
      * @param \Magento\App\Resource $resource
      * @param \Magento\Acl\Builder $aclBuilder
      * @param \Magento\Logger $logger
-     * @param \Magento\Core\Model\Acl\RootResource $rootResource
+     * @param \Magento\Acl\RootResource $rootResource
      * @param \Magento\Acl\CacheInterface $aclCache
      */
     public function __construct(
         \Magento\App\Resource $resource,
         \Magento\Acl\Builder $aclBuilder,
         \Magento\Logger $logger,
-        \Magento\Core\Model\Acl\RootResource $rootResource,
+        \Magento\Acl\RootResource $rootResource,
         \Magento\Acl\CacheInterface $aclCache
     ) {
         $this->_aclBuilder = $aclBuilder;
diff --git a/app/code/Magento/User/Model/Role.php b/app/code/Magento/User/Model/Role.php
index 243ce22b64f..7d5bce6557e 100644
--- a/app/code/Magento/User/Model/Role.php
+++ b/app/code/Magento/User/Model/Role.php
@@ -51,16 +51,16 @@ class Role extends \Magento\Core\Model\AbstractModel
     protected $_userRolesFactory;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\User\Model\Resource\Role\User\CollectionFactory $userRolesFactory
      * @param \Magento\User\Model\Resource\Role $resource
      * @param \Magento\User\Model\Resource\Role\Collection $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\User\Model\Resource\Role\User\CollectionFactory $userRolesFactory,
         \Magento\User\Model\Resource\Role $resource,
         \Magento\User\Model\Resource\Role\Collection $resourceCollection,
diff --git a/app/code/Magento/User/Model/Rules.php b/app/code/Magento/User/Model/Rules.php
index 0d0e494b26d..08035e08280 100644
--- a/app/code/Magento/User/Model/Rules.php
+++ b/app/code/Magento/User/Model/Rules.php
@@ -44,15 +44,15 @@ class Rules extends \Magento\Core\Model\AbstractModel
     /**
      * Class constructor
      *
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param Resource\Rules $resource
      * @param Resource\Permissions\Collection $resourceCollection
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\User\Model\Resource\Rules $resource,
         \Magento\User\Model\Resource\Permissions\Collection $resourceCollection,
         array $data = array()
diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php
index e30b438faea..2303d06abda 100644
--- a/app/code/Magento/User/Model/User.php
+++ b/app/code/Magento/User/Model/User.php
@@ -33,7 +33,6 @@ namespace Magento\User\Model;
  * @method string getLastname()
  * @method \Magento\User\Model\User setLastname(string $value)
  * @method string getEmail()
- * @method \Magento\User\Model\User setEmail(string $value)
  * @method string getUsername()
  * @method \Magento\User\Model\User setUsername(string $value)
  * @method string getPassword()
@@ -93,16 +92,6 @@ class User
      */
     protected $_hasResources = true;
 
-    /**
-     * Mail handler
-     *
-     * @var  \Magento\Email\Model\Template\Mailer
-     */
-    protected $_mailer;
-
-    /** @var \Magento\Email\Model\Sender */
-    protected $_sender;
-
     /**
      * User data
      *
@@ -131,13 +120,6 @@ class User
      */
     protected $_roleFactory;
 
-    /**
-     * Factory for email info model
-     *
-     * @var \Magento\Email\Model\InfoFactory
-     */
-    protected $_emailInfoFactory;
-
     /**
      * @var \Magento\Encryption\EncryptorInterface
      */
@@ -149,35 +131,43 @@ class User
     protected $dateTime;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @var \Magento\Mail\Template\TransportBuilder
+     */
+    protected $_transportBuilder;
+
+    /**
+     * @var \Magento\Core\Model\StoreManagerInterface
+     */
+    protected $_storeManager;
+
+    /**
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\User\Helper\Data $userData
-     * @param \Magento\Email\Model\Sender $sender
      * @param \Magento\Backend\App\ConfigInterface $config
      * @param \Magento\Validator\ObjectFactory $validatorObjectFactory
      * @param \Magento\User\Model\RoleFactory $roleFactory
-     * @param \Magento\Email\Model\InfoFactory $emailInfoFactory
-     * @param \Magento\Email\Model\Template\MailerFactory $mailerFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      * @param \Magento\Encryption\EncryptorInterface $encryptor
      * @param \Magento\Stdlib\DateTime $dateTime
      * @param \Magento\Core\Model\Resource\AbstractResource $resource
      * @param \Magento\Data\Collection\Db $resourceCollection
+     * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param array $data
      *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\User\Helper\Data $userData,
-        \Magento\Email\Model\Sender $sender,
         \Magento\Backend\App\ConfigInterface $config,
         \Magento\Validator\ObjectFactory $validatorObjectFactory,
         \Magento\User\Model\RoleFactory $roleFactory,
-        \Magento\Email\Model\InfoFactory $emailInfoFactory,
-        \Magento\Email\Model\Template\MailerFactory $mailerFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder,
         \Magento\Encryption\EncryptorInterface $encryptor,
         \Magento\Stdlib\DateTime $dateTime,
+        \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Core\Model\Resource\AbstractResource $resource = null,
         \Magento\Data\Collection\Db $resourceCollection = null,
         array $data = array()
@@ -186,12 +176,11 @@ class User
         $this->dateTime = $dateTime;
         parent::__construct($context, $registry, $resource, $resourceCollection, $data);
         $this->_userData = $userData;
-        $this->_sender = $sender;
         $this->_config = $config;
         $this->_validatorObject = $validatorObjectFactory;
         $this->_roleFactory = $roleFactory;
-        $this->_emailInfoFactory = $emailInfoFactory;
-        $this->_mailer = $mailerFactory->create();
+        $this->_transportBuilder = $transportBuilder;
+        $this->_storeManager = $storeManager;
     }
 
     /**
@@ -212,14 +201,13 @@ class User
         $properties = parent::__sleep();
         return array_diff($properties, array(
             '_eventManager',
-            '_sender',
             '_userData',
             '_config',
             '_validatorObject',
             '_roleFactory',
-            '_emailInfoFactory',
-            '_mailer',
-            '_encryptor'
+            '_encryptor',
+            '_transportBuilder',
+            '_storeManager'
         ));
     }
 
@@ -231,15 +219,14 @@ class User
         parent::__wakeup();
         $objectManager = \Magento\App\ObjectManager::getInstance();
         $this->_eventManager    = $objectManager->get('Magento\Event\ManagerInterface');
-        $this->_sender          = $objectManager->get('Magento\Email\Model\Sender');
         $this->_userData        = $objectManager->get('Magento\User\Helper\Data');
         $this->_config = $objectManager->get('Magento\Backend\App\ConfigInterface');
-        $this->_coreRegistry    = $objectManager->get('Magento\Core\Model\Registry');
+        $this->_coreRegistry    = $objectManager->get('Magento\Registry');
         $this->_validatorObject = $objectManager->get('Magento\Validator\ObjectFactory');
         $this->_roleFactory = $objectManager->get('Magento\User\Model\RoleFactory');
-        $this->_emailInfoFactory = $objectManager->get('Magento\Email\Model\InfoFactory');
-        $this->_mailer = $objectManager->get('Magento\Email\Model\Template\MailerFactory');
         $this->_encryptor = $objectManager->get('Magento\Encryption\EncryptorInterface');
+        $this->_transportBuilder =  $objectManager->get('Magento\Mail\Template\TransportBuilder');
+        $this->_storeManager =  $objectManager->get('Magento\Core\Model\StoreManagerInterface');
     }
 
     /**
@@ -443,18 +430,6 @@ class User
         return (is_array($result) && count($result) > 0) ? true : false;
     }
 
-    /**
-     * Set custom mail handler
-     *
-     * @param \Magento\Email\Model\Template\Mailer $mailer
-     * @return $this
-     */
-    public function setMailer(\Magento\Email\Model\Template\Mailer $mailer)
-    {
-        $this->_mailer = $mailer;
-        return $this;
-    }
-
     /**
      * Send email with reset password confirmation link
      *
@@ -462,20 +437,20 @@ class User
      */
     public function sendPasswordResetConfirmationEmail()
     {
-        /** @var \Magento\Email\Model\Info $emailInfo */
-        $emailInfo = $this->_emailInfoFactory->create();
-        $emailInfo->addTo($this->getEmail(), $this->getName());
-        $this->_mailer->addEmailInfo($emailInfo);
-
         // Set all required params and send emails
-        $this->_mailer->setSender($this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_IDENTITY));
-        $this->_mailer->setStoreId(0);
-        $this->_mailer->setTemplateId($this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_TEMPLATE));
-        $this->_mailer->setTemplateParams(array(
-            'user' => $this
-        ));
-        $this->_mailer->send();
-
+        /** @var \Magento\Mail\TransportInterface $transport */
+        $transport = $this->_transportBuilder
+            ->setTemplateIdentifier($this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_TEMPLATE))
+            ->setTemplateOptions(array(
+                'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                'store' => 0
+            ))
+            ->setTemplateVars(array('user' => $this, 'store' => $this->_storeManager->getStore(0)))
+            ->setFrom($this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_IDENTITY))
+            ->addTo($this->getEmail(), $this->getName())
+            ->getTransport();
+
+        $transport->sendMessage();
         return $this;
     }
 
@@ -486,15 +461,20 @@ class User
      */
     public function sendPasswordResetNotificationEmail()
     {
-        $this->_sender->send(
-            $this->getEmail(),
-            $this->getName(),
-            self::XML_PATH_RESET_PASSWORD_TEMPLATE,
-            self::XML_PATH_FORGOT_EMAIL_IDENTITY,
-            array('user' => $this),
-            0
-        );
-        return $this;
+        // Set all required params and send emails
+        /** @var \Magento\Mail\TransportInterface $transport */
+        $transport = $this->_transportBuilder
+            ->setTemplateIdentifier($this->_config->getValue(self::XML_PATH_RESET_PASSWORD_TEMPLATE))
+            ->setTemplateOptions(array(
+                'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                'store' => 0
+            ))
+            ->setTemplateVars(array('user' => $this, 'store' => $this->_storeManager->getStore(0)))
+            ->setFrom($this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_IDENTITY))
+            ->addTo($this->getEmail(), $this->getName())
+            ->getTransport();
+
+        $transport->sendMessage();
     }
 
     /**
diff --git a/app/code/Magento/User/etc/di.xml b/app/code/Magento/User/etc/di.xml
index 5ef277cfc14..c40e6145ee5 100644
--- a/app/code/Magento/User/etc/di.xml
+++ b/app/code/Magento/User/etc/di.xml
@@ -28,13 +28,13 @@
     <preference for="Magento\Backend\App\ConfigInterface" type="Magento\Backend\App\Config" />
     <type name="Magento\User\Model\Resource\Rules">
         <arguments>
-            <argument name="rootResource" xsi:type="object">Magento\Core\Model\Acl\RootResource\Proxy</argument>
-            <argument name="aclCache" xsi:type="object">Magento\Core\Model\Acl\Cache\Proxy</argument>
+            <argument name="rootResource" xsi:type="object">Magento\Acl\RootResource\Proxy</argument>
+            <argument name="aclCache" xsi:type="object">Magento\Acl\Cache\Proxy</argument>
         </arguments>
     </type>
     <type name="Magento\User\Model\Resource\User">
         <arguments>
-            <argument name="aclCache" xsi:type="object">Magento\Core\Model\Acl\Cache\Proxy</argument>
+            <argument name="aclCache" xsi:type="object">Magento\Acl\Cache\Proxy</argument>
         </arguments>
     </type>
     <type name="Magento\Module\Updater\SetupFactory">
diff --git a/app/code/Magento/User/view/email/password_reset.html b/app/code/Magento/User/view/email/password_reset.html
index fc358201f81..aa66510a487 100644
--- a/app/code/Magento/User/view/email/password_reset.html
+++ b/app/code/Magento/User/view/email/password_reset.html
@@ -1,4 +1,4 @@
-<!--@subject New password for {{var customer.name}} @-->
+<!--@subject New password for {{var user.name}} @-->
 <!--@vars
 {"store url=\"\"":"Store Url",
 "var logo_url":"Email Logo Image Url",
diff --git a/app/code/Magento/Webapi/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webapi.php b/app/code/Magento/Webapi/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webapi.php
index dd6fbcbf8ed..a6be2b97faf 100644
--- a/app/code/Magento/Webapi/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webapi.php
+++ b/app/code/Magento/Webapi/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webapi.php
@@ -41,7 +41,7 @@ class Webapi extends \Magento\Backend\Block\Widget\Form\Generic
     /** @var string[] */
     protected $_selectedResources;
 
-    /** @var \Magento\Core\Model\Acl\RootResource */
+    /** @var \Magento\Acl\RootResource */
     protected $_rootResource;
 
     /** @var \Magento\Acl\Resource\ProviderInterface */
@@ -60,10 +60,10 @@ class Webapi extends \Magento\Backend\Block\Widget\Form\Generic
      * Initialize dependencies.
      *
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Helper\Data $coreHelper
-     * @param \Magento\Core\Model\Acl\RootResource $rootResource
+     * @param \Magento\Acl\RootResource $rootResource
      * @param \Magento\Acl\Resource\ProviderInterface $resourceProvider
      * @param \Magento\Integration\Helper\Data $integrationData
      * @param \Magento\Webapi\Helper\Data $webapiData
@@ -71,10 +71,10 @@ class Webapi extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Helper\Data $coreHelper,
-        \Magento\Core\Model\Acl\RootResource $rootResource,
+        \Magento\Acl\RootResource $rootResource,
         \Magento\Acl\Resource\ProviderInterface $resourceProvider,
         \Magento\Integration\Helper\Data $integrationData,
         \Magento\Webapi\Helper\Data $webapiData,
diff --git a/app/code/Magento/Webapi/Block/Adminhtml/Integration/Edit/Tab/Webapi.php b/app/code/Magento/Webapi/Block/Adminhtml/Integration/Edit/Tab/Webapi.php
index 63e13de83b0..b0de76ed10a 100644
--- a/app/code/Magento/Webapi/Block/Adminhtml/Integration/Edit/Tab/Webapi.php
+++ b/app/code/Magento/Webapi/Block/Adminhtml/Integration/Edit/Tab/Webapi.php
@@ -37,7 +37,7 @@ class Webapi extends \Magento\Backend\Block\Widget\Form\Generic
     /**
      * Root ACL Resource
      *
-     * @var \Magento\Core\Model\Acl\RootResource
+     * @var \Magento\Acl\RootResource
      */
     protected $_rootResource;
 
@@ -65,9 +65,9 @@ class Webapi extends \Magento\Backend\Block\Widget\Form\Generic
      * Initialize dependencies.
      *
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
-     * @param \Magento\Core\Model\Acl\RootResource $rootResource
+     * @param \Magento\Acl\RootResource $rootResource
      * @param \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory
      * @param \Magento\Acl\Resource\ProviderInterface $aclResourceProvider
      * @param \Magento\Webapi\Helper\Data $webapiData
@@ -79,9 +79,9 @@ class Webapi extends \Magento\Backend\Block\Widget\Form\Generic
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
-        \Magento\Core\Model\Acl\RootResource $rootResource,
+        \Magento\Acl\RootResource $rootResource,
         \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory,
         \Magento\Acl\Resource\ProviderInterface $aclResourceProvider,
         \Magento\Webapi\Helper\Data $webapiData,
diff --git a/app/code/Magento/Webapi/Helper/Data.php b/app/code/Magento/Webapi/Helper/Data.php
index 472e5fd4a20..25e4d903a5e 100644
--- a/app/code/Magento/Webapi/Helper/Data.php
+++ b/app/code/Magento/Webapi/Helper/Data.php
@@ -24,22 +24,20 @@
 
 namespace Magento\Webapi\Helper;
 
-use Magento\App\Helper\Context;
-use Magento\Core\Model\Registry;
 use Magento\Integration\Controller\Adminhtml\Integration as IntegrationController;
 
 class Data extends \Magento\App\Helper\AbstractHelper
 {
-    /** @var Registry */
+    /** @var \Magento\Registry */
     protected $_registry;
 
     /**
-     * @param Context $context
-     * @param Registry $registry
+     * @param \Magento\App\Helper\Context $context
+     * @param \Magento\Registry $registry
      */
     public function __construct(
-        Context $context,
-        Registry $registry
+        \Magento\App\Helper\Context $context,
+        \Magento\Registry $registry
     ) {
         $this->_registry = $registry;
         parent::__construct($context);
diff --git a/app/code/Magento/Weee/Block/Renderer/Weee/Tax.php b/app/code/Magento/Weee/Block/Renderer/Weee/Tax.php
index 6d2e5fcf6a5..c9194e03a07 100644
--- a/app/code/Magento/Weee/Block/Renderer/Weee/Tax.php
+++ b/app/code/Magento/Weee/Block/Renderer/Weee/Tax.php
@@ -61,7 +61,7 @@ class Tax
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -79,14 +79,14 @@ class Tax
      * @param \Magento\Backend\Block\Template\Context $context
      * @param \Magento\Directory\Model\Config\Source\Country $sourceCountry
      * @param \Magento\Directory\Helper\Data $directoryHelper
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
         \Magento\Directory\Model\Config\Source\Country $sourceCountry,
         \Magento\Directory\Helper\Data $directoryHelper,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_sourceCountry = $sourceCountry;
diff --git a/app/code/Magento/Weee/Helper/Data.php b/app/code/Magento/Weee/Helper/Data.php
index 3e5b83a7c0f..f9b5d122c3c 100644
--- a/app/code/Magento/Weee/Helper/Data.php
+++ b/app/code/Magento/Weee/Helper/Data.php
@@ -48,7 +48,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
@@ -81,7 +81,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Weee\Model\Tax $weeeTax
      * @param \Magento\Tax\Helper\Data $taxData
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig
      */
     public function __construct(
@@ -89,7 +89,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Weee\Model\Tax $weeeTax,
         \Magento\Tax\Helper\Data $taxData,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig
     ) {
         $this->_storeManager = $storeManager;
diff --git a/app/code/Magento/Weee/Model/Config/Source/Display.php b/app/code/Magento/Weee/Model/Config/Source/Display.php
index 7bd7642ee51..fd07bdeaab2 100644
--- a/app/code/Magento/Weee/Model/Config/Source/Display.php
+++ b/app/code/Magento/Weee/Model/Config/Source/Display.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Weee\Model\Config\Source;
 
-class Display implements \Magento\Core\Model\Option\ArrayInterface
+class Display implements \Magento\Option\ArrayInterface
 {
     /**
      * Retrieve list of available options to display FPT
diff --git a/app/code/Magento/Weee/Model/Observer.php b/app/code/Magento/Weee/Model/Observer.php
index e87dd1db5da..97ed2e691cf 100644
--- a/app/code/Magento/Weee/Model/Observer.php
+++ b/app/code/Magento/Weee/Model/Observer.php
@@ -55,8 +55,8 @@ class Observer extends \Magento\Core\Model\AbstractModel
     protected $productTypeConfig;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\View\LayoutInterface $layout
      * @param Tax $weeeTax
      * @param \Magento\Weee\Helper\Data $weeeData
@@ -67,8 +67,8 @@ class Observer extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\View\LayoutInterface $layout,
         Tax $weeeTax,
         \Magento\Weee\Helper\Data $weeeData,
diff --git a/app/code/Magento/Weee/Model/Tax.php b/app/code/Magento/Weee/Model/Tax.php
index 78c9535e306..e74db56995d 100644
--- a/app/code/Magento/Weee/Model/Tax.php
+++ b/app/code/Magento/Weee/Model/Tax.php
@@ -92,8 +92,8 @@ class Tax extends \Magento\Core\Model\AbstractModel
     protected $_customerSession;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Tax\Model\CalculationFactory $calculationFactory
@@ -105,8 +105,8 @@ class Tax extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Tax\Model\CalculationFactory $calculationFactory,
diff --git a/app/code/Magento/Weee/view/adminhtml/renderer/tax.phtml b/app/code/Magento/Weee/view/adminhtml/renderer/tax.phtml
index 6e57cd6ebd9..fc482611fa3 100644
--- a/app/code/Magento/Weee/view/adminhtml/renderer/tax.phtml
+++ b/app/code/Magento/Weee/view/adminhtml/renderer/tax.phtml
@@ -24,14 +24,19 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<?php /** @var $this \Magento\Weee\Block\Renderer\Weee\Tax */?>
+<?php
+/** @var $this \Magento\Weee\Block\Renderer\Weee\Tax */
+$data = ['fptAttribute' => [
+    'region' => $this->helper('Magento\Core\Helper\Data')->jsonDecode(
+        $this->helper('Magento\Directory\Helper\Data')->getRegionJson()
+    ),
+    'itemsData' => $this->getValues(),
+    'bundlePriceType' => '#price_type',
+]];
+?>
 <div id="attribute-<?php echo $this->getElement()->getHtmlId(); ?>-container" class="field"
      data-element-id="<?php echo $this->getElement()->getHtmlId(); ?>"
-     data-mage-init='{"fptAttribute":{
-        "region": <?php echo $this->escapeHtml($this->helper('Magento\Directory\Helper\Data')->getRegionJson()) ?>,
-        "itemsData": <?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\Data')->jsonEncode($this->getValues())); ?>,
-        "bundlePriceType": "#price_type"
-     }}'>
+     data-mage-init="<?=$this->escapeHtml($this->helper('Magento\Core\Helper\Data')->jsonEncode($data))?>">
     <label class="label"><span><?php echo $this->getElement()->getLabel() ?></span></label>
 
     <div class="control">
diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Form.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Form.php
index 3f59fc5452e..ab8e9cf23c2 100644
--- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Form.php
+++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Form.php
@@ -43,14 +43,14 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Widget\Model\WidgetFactory $widgetFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Widget\Model\WidgetFactory $widgetFactory,
         array $data = array()
diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit.php
index 75fe31bc684..b08aa85ebec 100644
--- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit.php
+++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit.php
@@ -38,18 +38,18 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_coreRegistry = $registry;
diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php
index 055c0c3342f..1f228bc845b 100644
--- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php
+++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php
@@ -49,7 +49,7 @@ class Main
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\Core\Model\System\Store $store
      * @param \Magento\View\Design\Theme\LabelFactory $themeLabelFactory
@@ -57,7 +57,7 @@ class Main
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\Core\Model\System\Store $store,
         \Magento\View\Design\Theme\LabelFactory $themeLabelFactory,
diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php
index df249f122c6..f86d49d1d0c 100644
--- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php
+++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php
@@ -40,7 +40,7 @@ class Settings
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -51,14 +51,14 @@ class Settings
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
      * @param \Magento\View\Design\Theme\LabelFactory $themeLabelFactory
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
         \Magento\View\Design\Theme\LabelFactory $themeLabelFactory,
         array $data = array()
diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php
index f356c835cfe..01ad0d56762 100644
--- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php
+++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php
@@ -41,30 +41,30 @@ class Options extends \Magento\Backend\Block\Widget\Form\Generic
      * @var string
      */
     protected $_defaultElementType = 'text';
-    
+
     /**
      * @var \Magento\Widget\Model\Widget
      */
     protected $_widget;
 
     /**
-     * @var \Magento\Core\Model\Option\ArrayPool
+     * @var \Magento\Option\ArrayPool
      */
     protected $_sourceModelPool;
 
     /**
      * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Data\FormFactory $formFactory
-     * @param \Magento\Core\Model\Option\ArrayPool $sourceModelPool
+     * @param \Magento\Option\ArrayPool $sourceModelPool
      * @param \Magento\Widget\Model\Widget $widget
      * @param array $data
      */
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Data\FormFactory $formFactory,
-        \Magento\Core\Model\Option\ArrayPool $sourceModelPool,
+        \Magento\Option\ArrayPool $sourceModelPool,
         \Magento\Widget\Model\Widget $widget,
         array $data = array()
     ) {
diff --git a/app/code/Magento/Widget/Controller/Adminhtml/Widget.php b/app/code/Magento/Widget/Controller/Adminhtml/Widget.php
index bf5f1abb8de..e80ebdb7983 100644
--- a/app/code/Magento/Widget/Controller/Adminhtml/Widget.php
+++ b/app/code/Magento/Widget/Controller/Adminhtml/Widget.php
@@ -40,7 +40,7 @@ class Widget extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -58,13 +58,13 @@ class Widget extends \Magento\Backend\App\Action
      * @param \Magento\Backend\App\Action\Context $context
      * @param \Magento\Widget\Model\Widget\Config $widgetConfig
      * @param \Magento\Widget\Model\Widget $widget
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
         \Magento\Widget\Model\Widget\Config $widgetConfig,
         \Magento\Widget\Model\Widget $widget,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_widgetConfig = $widgetConfig;
         $this->_widget = $widget;
diff --git a/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance.php b/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance.php
index 140d6003898..13cdecfddbf 100644
--- a/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance.php
+++ b/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance.php
@@ -34,7 +34,7 @@ class Instance extends \Magento\Backend\App\Action
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -60,7 +60,7 @@ class Instance extends \Magento\Backend\App\Action
 
     /**
      * @param \Magento\Backend\App\Action\Context $context
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Widget\Model\Widget\InstanceFactory $widgetFactory
      * @param \Magento\Logger $logger
      * @param \Magento\Math\Random $mathRandom
@@ -68,7 +68,7 @@ class Instance extends \Magento\Backend\App\Action
      */
     public function __construct(
         \Magento\Backend\App\Action\Context $context,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Widget\Model\Widget\InstanceFactory $widgetFactory,
         \Magento\Logger $logger,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Widget/Model/Resource/Widget/Instance/Options/ThemeId.php b/app/code/Magento/Widget/Model/Resource/Widget/Instance/Options/ThemeId.php
index 460568d8de1..08941e48335 100644
--- a/app/code/Magento/Widget/Model/Resource/Widget/Instance/Options/ThemeId.php
+++ b/app/code/Magento/Widget/Model/Resource/Widget/Instance/Options/ThemeId.php
@@ -33,7 +33,7 @@
 
 namespace Magento\Widget\Model\Resource\Widget\Instance\Options;
 
-class ThemeId implements \Magento\Core\Model\Option\ArrayInterface
+class ThemeId implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Widget\Model\Widget\Instance
diff --git a/app/code/Magento/Widget/Model/Resource/Widget/Instance/Options/Types.php b/app/code/Magento/Widget/Model/Resource/Widget/Instance/Options/Types.php
index 0e09b045b30..cbfe0635277 100644
--- a/app/code/Magento/Widget/Model/Resource/Widget/Instance/Options/Types.php
+++ b/app/code/Magento/Widget/Model/Resource/Widget/Instance/Options/Types.php
@@ -33,7 +33,7 @@
 
 namespace Magento\Widget\Model\Resource\Widget\Instance\Options;
 
-class Types implements \Magento\Core\Model\Option\ArrayInterface
+class Types implements \Magento\Option\ArrayInterface
 {
     /**
      * @var \Magento\Widget\Model\Widget\Instance
diff --git a/app/code/Magento/Widget/Model/Widget/Instance.php b/app/code/Magento/Widget/Model/Widget/Instance.php
index 1f4526f74dc..04199f7775c 100644
--- a/app/code/Magento/Widget/Model/Widget/Instance.php
+++ b/app/code/Magento/Widget/Model/Widget/Instance.php
@@ -117,10 +117,10 @@ class Instance extends \Magento\Core\Model\AbstractModel
      * @var \Magento\Filesystem\Directory\ReadInterface
      */
     protected $_directory;
-    
+
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Escaper $escaper
      * @param \Magento\View\FileSystem $viewFileSystem
      * @param \Magento\App\Cache\TypeListInterface $cacheTypeList
@@ -136,8 +136,8 @@ class Instance extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Escaper $escaper,
         \Magento\View\FileSystem $viewFileSystem,
         \Magento\App\Cache\TypeListInterface $cacheTypeList,
diff --git a/app/code/Magento/Widget/Model/Widget/Instance/OptionsFactory.php b/app/code/Magento/Widget/Model/Widget/Instance/OptionsFactory.php
index b3cb3e825f0..afaf317196e 100644
--- a/app/code/Magento/Widget/Model/Widget/Instance/OptionsFactory.php
+++ b/app/code/Magento/Widget/Model/Widget/Instance/OptionsFactory.php
@@ -46,7 +46,7 @@ class OptionsFactory
      *
      * @param string $type
      * @param array $data
-     * @return \Magento\Core\Model\Option\ArrayInterface
+     * @return \Magento\Option\ArrayInterface
      */
     public function create($type, array $data = array())
     {
diff --git a/app/code/Magento/Wishlist/Block/AbstractBlock.php b/app/code/Magento/Wishlist/Block/AbstractBlock.php
index 8cc3a75b58c..63fa260c1b9 100644
--- a/app/code/Magento/Wishlist/Block/AbstractBlock.php
+++ b/app/code/Magento/Wishlist/Block/AbstractBlock.php
@@ -63,7 +63,7 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -76,13 +76,13 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php
index b0b9d97dfc1..928f85a90a5 100644
--- a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php
+++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php
@@ -56,7 +56,7 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -77,7 +77,7 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php
index bbb94311196..6d9356a6853 100644
--- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php
+++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php
@@ -53,7 +53,7 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -67,13 +67,13 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock
      * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Wishlist/Block/Item/Configure.php b/app/code/Magento/Wishlist/Block/Item/Configure.php
index 273e28b21a9..e4844c4a609 100644
--- a/app/code/Magento/Wishlist/Block/Item/Configure.php
+++ b/app/code/Magento/Wishlist/Block/Item/Configure.php
@@ -46,20 +46,20 @@ class Configure extends \Magento\View\Element\Template
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Wishlist\Helper\Data $wishlistData
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param array $data
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Wishlist\Helper\Data $wishlistData,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         array $data = array()
     ) {
         $this->_wishlistData = $wishlistData;
diff --git a/app/code/Magento/Wishlist/Block/Share/Wishlist.php b/app/code/Magento/Wishlist/Block/Share/Wishlist.php
index 209c46c4973..5c11eefa941 100644
--- a/app/code/Magento/Wishlist/Block/Share/Wishlist.php
+++ b/app/code/Magento/Wishlist/Block/Share/Wishlist.php
@@ -51,7 +51,7 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock
     /**
      * @param \Magento\View\Element\Template\Context $context
      * @param \Magento\Catalog\Model\Config $catalogConfig
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxData
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Math\Random $mathRandom
@@ -65,13 +65,13 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock
      * @param \Magento\Customer\Model\CustomerFactory $customerFactory
      * @param array $data
      * @param array $priceBlockTypes
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\View\Element\Template\Context $context,
         \Magento\Catalog\Model\Config $catalogConfig,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         \Magento\Tax\Helper\Data $taxData,
         \Magento\Catalog\Helper\Data $catalogData,
         \Magento\Math\Random $mathRandom,
diff --git a/app/code/Magento/Wishlist/Controller/Index.php b/app/code/Magento/Wishlist/Controller/Index.php
index e5af21c4aae..1e82732cb7f 100644
--- a/app/code/Magento/Wishlist/Controller/Index.php
+++ b/app/code/Magento/Wishlist/Controller/Index.php
@@ -62,27 +62,35 @@ class Index
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
+    /**
+     * @var \Magento\Mail\Template\TransportBuilder
+     */
+    protected $_transportBuilder;
+
     /**
      * @param \Magento\App\Action\Context $context
      * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Wishlist\Model\Config $wishlistConfig
      * @param \Magento\App\Response\Http\FileFactory $fileResponseFactory
+     * @param \Magento\Mail\Template\TransportBuilder $transportBuilder
      */
     public function __construct(
         \Magento\App\Action\Context $context,
         \Magento\Core\App\Action\FormKeyValidator $formKeyValidator,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Wishlist\Model\Config $wishlistConfig,
-        \Magento\App\Response\Http\FileFactory $fileResponseFactory
+        \Magento\App\Response\Http\FileFactory $fileResponseFactory,
+        \Magento\Mail\Template\TransportBuilder $transportBuilder
     ) {
         $this->_coreRegistry = $coreRegistry;
         $this->_wishlistConfig = $wishlistConfig;
         $this->_fileResponseFactory = $fileResponseFactory;
+        $this->_transportBuilder = $transportBuilder;
         parent::__construct($context, $formKeyValidator);
     }
 
@@ -738,31 +746,33 @@ class Index
                 ->toHtml();
 
             $emails = array_unique($emails);
-            /* @var $emailModel \Magento\Email\Model\Template */
-            $emailModel = $this->_objectManager->create('Magento\Email\Model\Template');
-
             $sharingCode = $wishlist->getSharingCode();
 
             try {
+                $storeConfig = $this->_objectManager->get('Magento\Core\Model\Store\Config');
+                $storeManager = $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface');
                 foreach ($emails as $email) {
-                    $emailModel->sendTransactional(
-                        $this->_objectManager
-                            ->get('Magento\Core\Model\Store\Config')
-                            ->getConfig('wishlist/email/email_template'),
-                        $this->_objectManager
-                            ->get('Magento\Core\Model\Store\Config')
-                            ->getConfig('wishlist/email/email_identity'),
-                        $email,
-                        null,
-                        array(
+                    $transport = $this->_transportBuilder
+                        ->setTemplateIdentifier($storeConfig->getConfig('wishlist/email/email_template'))
+                        ->setTemplateOptions(array(
+                            'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND,
+                            'store' => $storeManager->getStore()->getStoreId()
+                        ))
+                        ->setTemplateVars(array(
                             'customer'      => $customer,
                             'salable'       => $wishlist->isSalable() ? 'yes' : '',
                             'items'         => $wishlistBlock,
                             'addAllLink'    => $this->_url->getUrl('*/shared/allcart', array('code' => $sharingCode)),
                             'viewOnSiteLink'=> $this->_url->getUrl('*/shared/index', array('code' => $sharingCode)),
-                            'message'       => $message
-                        )
-                    );
+                            'message'       => $message,
+                            'store'         => $storeManager->getStore()
+                        ))
+                        ->setFrom($storeConfig->getConfig('wishlist/email/email_identity'))
+                        ->addTo($email)
+                        ->getTransport();
+
+                    $transport->sendMessage();
+
                     $sent++;
                 }
             } catch (\Exception $e) {
diff --git a/app/code/Magento/Wishlist/Controller/Shared.php b/app/code/Magento/Wishlist/Controller/Shared.php
index 526d59f1cef..17e35548684 100644
--- a/app/code/Magento/Wishlist/Controller/Shared.php
+++ b/app/code/Magento/Wishlist/Controller/Shared.php
@@ -39,19 +39,19 @@ class Shared extends AbstractController
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry = null;
 
     /**
      * @param \Magento\App\Action\Context $context
      * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      */
     public function __construct(
         \Magento\App\Action\Context $context,
         \Magento\Core\App\Action\FormKeyValidator $formKeyValidator,
-        \Magento\Core\Model\Registry $coreRegistry
+        \Magento\Registry $coreRegistry
     ) {
         $this->_coreRegistry = $coreRegistry;
         parent::__construct($context, $formKeyValidator);
diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php
index 7fefcdb24aa..81d9756da2b 100644
--- a/app/code/Magento/Wishlist/Helper/Data.php
+++ b/app/code/Magento/Wishlist/Helper/Data.php
@@ -84,7 +84,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
     /**
      * Core registry
      *
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_coreRegistry;
 
@@ -118,7 +118,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
     /**
      * @param \Magento\App\Helper\Context $context
      * @param \Magento\Core\Helper\Data $coreData
-     * @param \Magento\Core\Model\Registry $coreRegistry
+     * @param \Magento\Registry $coreRegistry
      * @param \Magento\Core\Model\Store\Config $coreStoreConfig
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Wishlist\Model\WishlistFactory $wishlistFactory
@@ -128,7 +128,7 @@ class Data extends \Magento\App\Helper\AbstractHelper
     public function __construct(
         \Magento\App\Helper\Context $context,
         \Magento\Core\Helper\Data $coreData,
-        \Magento\Core\Model\Registry $coreRegistry,
+        \Magento\Registry $coreRegistry,
         \Magento\Core\Model\Store\Config $coreStoreConfig,
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Wishlist\Model\WishlistFactory $wishlistFactory,
diff --git a/app/code/Magento/Wishlist/Model/Config/Source/Summary.php b/app/code/Magento/Wishlist/Model/Config/Source/Summary.php
index fa16c6f720b..0eb33d9bf44 100644
--- a/app/code/Magento/Wishlist/Model/Config/Source/Summary.php
+++ b/app/code/Magento/Wishlist/Model/Config/Source/Summary.php
@@ -25,7 +25,7 @@
  */
 namespace Magento\Wishlist\Model\Config\Source;
 
-class Summary implements \Magento\Core\Model\Option\ArrayInterface
+class Summary implements \Magento\Option\ArrayInterface
 {
     /**
      * @return array
diff --git a/app/code/Magento/Wishlist/Model/Item.php b/app/code/Magento/Wishlist/Model/Item.php
index e1d723e81bc..38ac05f5909 100644
--- a/app/code/Magento/Wishlist/Model/Item.php
+++ b/app/code/Magento/Wishlist/Model/Item.php
@@ -142,8 +142,8 @@ class Item extends \Magento\Core\Model\AbstractModel
     protected $productTypeConfig;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Core\Model\StoreManagerInterface $storeManager
      * @param \Magento\Core\Model\Date $date
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
@@ -156,8 +156,8 @@ class Item extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Core\Model\StoreManagerInterface $storeManager,
         \Magento\Core\Model\Date $date,
         \Magento\Catalog\Model\ProductFactory $productFactory,
diff --git a/app/code/Magento/Wishlist/Model/Observer.php b/app/code/Magento/Wishlist/Model/Observer.php
index 8a7048eb1f7..015277a8fd7 100644
--- a/app/code/Magento/Wishlist/Model/Observer.php
+++ b/app/code/Magento/Wishlist/Model/Observer.php
@@ -61,8 +61,8 @@ class Observer extends \Magento\Core\Model\AbstractModel
     protected $messageManager;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Wishlist\Helper\Data $wishlistData
      * @param \Magento\Checkout\Model\Session $checkoutSession
      * @param \Magento\Customer\Model\Session $customerSession
@@ -73,8 +73,8 @@ class Observer extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Wishlist\Helper\Data $wishlistData,
         \Magento\Checkout\Model\Session $checkoutSession,
         \Magento\Customer\Model\Session $customerSession,
diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php b/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php
index 2b5aadc4cad..44726147ebd 100644
--- a/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php
+++ b/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php
@@ -32,7 +32,7 @@ namespace Magento\Wishlist\Model\Resource\Item\Collection;
 class Grid extends \Magento\Wishlist\Model\Resource\Item\Collection
 {
     /**
-     * @var \Magento\Core\Model\Registry
+     * @var \Magento\Registry
      */
     protected $_registryManager;
 
@@ -54,9 +54,9 @@ class Grid extends \Magento\Wishlist\Model\Resource\Item\Collection
      * @param \Magento\Catalog\Model\Entity\AttributeFactory $catalogAttrFactory
      * @param \Magento\Wishlist\Model\Resource\Item $resource
      * @param \Magento\App\State $appState
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Registry $registry
      * @param \Zend_Db_Adapter_Abstract $connection
-     * 
+     *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
@@ -77,7 +77,7 @@ class Grid extends \Magento\Wishlist\Model\Resource\Item\Collection
         \Magento\Catalog\Model\Entity\AttributeFactory $catalogAttrFactory,
         \Magento\Wishlist\Model\Resource\Item $resource,
         \Magento\App\State $appState,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Registry $registry,
         $connection = null
     ) {
         $this->_registryManager = $registry;
diff --git a/app/code/Magento/Wishlist/Model/Wishlist.php b/app/code/Magento/Wishlist/Model/Wishlist.php
index d534ef50c53..302b4cc79a1 100644
--- a/app/code/Magento/Wishlist/Model/Wishlist.php
+++ b/app/code/Magento/Wishlist/Model/Wishlist.php
@@ -128,8 +128,8 @@ class Wishlist extends \Magento\Core\Model\AbstractModel
     protected $_useCurrentWebsite;
 
     /**
-     * @param \Magento\Core\Model\Context $context
-     * @param \Magento\Core\Model\Registry $registry
+     * @param \Magento\Model\Context $context
+     * @param \Magento\Registry $registry
      * @param \Magento\Catalog\Helper\Product $catalogProduct
      * @param \Magento\Wishlist\Helper\Data $wishlistData
      * @param ResourceWishlist $resource
@@ -145,8 +145,8 @@ class Wishlist extends \Magento\Core\Model\AbstractModel
      * @param array $data
      */
     public function __construct(
-        \Magento\Core\Model\Context $context,
-        \Magento\Core\Model\Registry $registry,
+        \Magento\Model\Context $context,
+        \Magento\Registry $registry,
         \Magento\Catalog\Helper\Product $catalogProduct,
         \Magento\Wishlist\Helper\Data $wishlistData,
         ResourceWishlist $resource,
@@ -390,7 +390,7 @@ class Wishlist extends \Magento\Core\Model\AbstractModel
             $storeId = $product->hasWishlistStoreId() ? $product->getWishlistStoreId() : $product->getStoreId();
         } else {
             $productId = (int) $product;
-            if ($buyRequest->getStoreId()) {
+            if (isset($buyRequest) && $buyRequest->getStoreId()) {
                 $storeId = $buyRequest->getStoreId();
             } else {
                 $storeId = $this->_storeManager->getStore()->getId();
diff --git a/app/code/Magento/Wishlist/etc/module.xml b/app/code/Magento/Wishlist/etc/module.xml
index 29ef3602129..3719e3fe085 100755
--- a/app/code/Magento/Wishlist/etc/module.xml
+++ b/app/code/Magento/Wishlist/etc/module.xml
@@ -39,7 +39,6 @@
             <module name="Magento_Tax"/>
             <module name="Magento_Backend"/>
             <module name="Magento_Bundle" type="soft"/>
-            <module name="Magento_Email"/>
             <module name="Magento_Sales"/>
             <module name="Magento_GroupedProduct"/>
             <module name="Magento_ConfigurableProduct"/>
diff --git a/app/code/Magento/Wishlist/i18n/de_DE.csv b/app/code/Magento/Wishlist/i18n/de_DE.csv
index 4552b6a7a4b..0fd1fd086ef 100644
--- a/app/code/Magento/Wishlist/i18n/de_DE.csv
+++ b/app/code/Magento/Wishlist/i18n/de_DE.csv
@@ -18,9 +18,9 @@
 "Are you sure you want to remove this product from your wishlist?","Sind  Sie sicher, dass Sie dieses Produkt von Ihrem Wunschzettel entfernen möchten?"
 "Are you sure you would like to remove this item from the wishlist?","Sind  Sie sicher, dass Sie dieses Objekt von Ihrem Wunschzettel entfernen möchten?"
 "Back","Zurück"
-"Can\'t delete item from wishlist","Artikel kann nicht aus Wunschliste gelöscht werden"
-"Can\'t save description %s","Kann Beschreibung nicht sichern %s"
-"Can\'t update wishlist","Kann Wunschzettel nicht aktualisieren"
+"Can't delete item from wishlist","Artikel kann nicht aus Wunschliste gelöscht werden"
+"Can't save description %s","Kann Beschreibung nicht sichern %s"
+"Can't update wishlist","Kann Wunschzettel nicht aktualisieren"
 "Cannot add item to shopping cart","Kann Objekt nicht zum Warenkorb hinzufügen"
 "Cannot add the following product(s) to shopping cart: %s.","Der Warenkorb kann nicht um das/die folgende(n) Produkt(e) erweitert werden: %s."
 "Cannot add the item to shopping cart.","Kann das Objekt nicht zum Warenkorb hinzufügen."
@@ -48,7 +48,7 @@
 "Edit","Bearbeiten"
 "Email Sender","E-Mail-Absender"
 "Email Template","E-Mail-Vorlage"
-"Email address can\'t be empty.","E-Mail-Adressfeld darf nicht leer sein."
+"Email address can't be empty.","E-Mail-Adressfeld darf nicht leer sein."
 "Email addresses, separated by commas","E-Mail-Adressen, durch Komma getrennt"
 "Enabled","Aktiviert"
 "General Options","Allgemeine Optionen"
diff --git a/app/code/Magento/Wishlist/i18n/en_US.csv b/app/code/Magento/Wishlist/i18n/en_US.csv
index 4e594dd9bdd..09319942c36 100644
--- a/app/code/Magento/Wishlist/i18n/en_US.csv
+++ b/app/code/Magento/Wishlist/i18n/en_US.csv
@@ -18,9 +18,9 @@
 "Are you sure you want to remove this product from your wishlist?","Are you sure you want to remove this product from your wishlist?"
 "Are you sure you would like to remove this item from the wishlist?","Are you sure you would like to remove this item from the wishlist?"
 "Back","Back"
-"Can\'t delete item from wishlist","Can\'t delete item from wishlist"
-"Can\'t save description %s","Can\'t save description %s"
-"Can\'t update wishlist","Can\'t update wishlist"
+"Can't delete item from wishlist","Can't delete item from wishlist"
+"Can't save description %s","Can't save description %s"
+"Can't update wishlist","Can't update wishlist"
 "Cannot add item to shopping cart","Cannot add item to shopping cart"
 "Cannot add the following product(s) to shopping cart: %s.","Cannot add the following product(s) to shopping cart: %s."
 "Cannot add the item to shopping cart.","Cannot add the item to shopping cart."
@@ -48,7 +48,7 @@
 "Edit","Edit"
 "Email Sender","Email Sender"
 "Email Template","Email Template"
-"Email address can\'t be empty.","Email address can\'t be empty."
+"Email address can't be empty.","Email address can't be empty."
 "Email addresses, separated by commas","Email addresses, separated by commas"
 "Enabled","Enabled"
 "General Options","General Options"
diff --git a/app/code/Magento/Wishlist/i18n/es_ES.csv b/app/code/Magento/Wishlist/i18n/es_ES.csv
index f62ea203a97..16387ec19ce 100644
--- a/app/code/Magento/Wishlist/i18n/es_ES.csv
+++ b/app/code/Magento/Wishlist/i18n/es_ES.csv
@@ -18,9 +18,9 @@
 "Are you sure you want to remove this product from your wishlist?","¿Está seguro que desea retirar este producto de su lista de deseos?"
 "Are you sure you would like to remove this item from the wishlist?","¿Está seguro de querer eliminar este artículo de su lista?"
 "Back","Volver"
-"Can\'t delete item from wishlist","No se puede eliminar el artículo de la lista de la compra"
-"Can\'t save description %s","Imposible guardar la descripción %s"
-"Can\'t update wishlist","Imposible actualizar la lista"
+"Can't delete item from wishlist","No se puede eliminar el artículo de la lista de la compra"
+"Can't save description %s","Imposible guardar la descripción %s"
+"Can't update wishlist","Imposible actualizar la lista"
 "Cannot add item to shopping cart","No se pudo añadir el artículo al carrito de compra"
 "Cannot add the following product(s) to shopping cart: %s.","No se pueden añadir el (los) siguiente(s) producto(s) a la cesta de la compra: %s."
 "Cannot add the item to shopping cart.","Imposible añadir el artículo a la cesta de la compra."
@@ -48,7 +48,7 @@
 "Edit","Editar"
 "Email Sender","Remitente del email"
 "Email Template","Plantilla de email"
-"Email address can\'t be empty.","El campo Dirección de correo electrónico no puede estar vacío."
+"Email address can't be empty.","El campo Dirección de correo electrónico no puede estar vacío."
 "Email addresses, separated by commas","Direcciones de correo electrónico, separadas por comas"
 "Enabled","Habilitado"
 "General Options","Opciones Generales"
diff --git a/app/code/Magento/Wishlist/i18n/fr_FR.csv b/app/code/Magento/Wishlist/i18n/fr_FR.csv
index 3a6488728eb..3f84708c19e 100644
--- a/app/code/Magento/Wishlist/i18n/fr_FR.csv
+++ b/app/code/Magento/Wishlist/i18n/fr_FR.csv
@@ -18,9 +18,9 @@
 "Are you sure you want to remove this product from your wishlist?","Êtes-vous sûr(e) de vouloir enlever ce produit de votre liste de vœux?"
 "Are you sure you would like to remove this item from the wishlist?","Êtes-vous sûr(e) de vouloir enlever ce produit de la liste de vœux?"
 "Back","Retour"
-"Can\'t delete item from wishlist","Impossible de supprimer l'article de la liste de souhaits."
-"Can\'t save description %s","Ne peut sauvegarder la description %s"
-"Can\'t update wishlist","Ne peut mettre à jour la liste de vœux"
+"Can't delete item from wishlist","Impossible de supprimer l'article de la liste de souhaits."
+"Can't save description %s","Ne peut sauvegarder la description %s"
+"Can't update wishlist","Ne peut mettre à jour la liste de vœux"
 "Cannot add item to shopping cart","Ne peut ajouter l'article au caddy"
 "Cannot add the following product(s) to shopping cart: %s.","Impossible d'ajouter le(s) produit(s) suivant(s) au panier d'achat virtuel : %s."
 "Cannot add the item to shopping cart.","Ne peut ajouter l'article au caddy."
@@ -48,7 +48,7 @@
 "Edit","Éditer"
 "Email Sender","Envoyez courriel à l'expéditeur"
 "Email Template","Modèle courriel"
-"Email address can\'t be empty.","Adresse courriel ne peut être vide."
+"Email address can't be empty.","Adresse courriel ne peut être vide."
 "Email addresses, separated by commas","Adresses courriel, séparées par virgules"
 "Enabled","Activé"
 "General Options","Options générales"
diff --git a/app/code/Magento/Wishlist/i18n/nl_NL.csv b/app/code/Magento/Wishlist/i18n/nl_NL.csv
index f7a8bf4a93b..b67d7dbe2dd 100644
--- a/app/code/Magento/Wishlist/i18n/nl_NL.csv
+++ b/app/code/Magento/Wishlist/i18n/nl_NL.csv
@@ -18,9 +18,9 @@
 "Are you sure you want to remove this product from your wishlist?","Weet u zeker dat u dit product wilt verwijderen van uw verlanglijstje?"
 "Are you sure you would like to remove this item from the wishlist?","Weet u zeker dat u dit item graag van de verlanglijst wilt verwijderen?"
 "Back","Terug"
-"Can\'t delete item from wishlist","Kan het item niet verwijderen van het verlanglijstje"
-"Can\'t save description %s","Kan omschrijving %s niet opslaan"
-"Can\'t update wishlist","Kan het verlanglijstje niet updaten"
+"Can't delete item from wishlist","Kan het item niet verwijderen van het verlanglijstje"
+"Can't save description %s","Kan omschrijving %s niet opslaan"
+"Can't update wishlist","Kan het verlanglijstje niet updaten"
 "Cannot add item to shopping cart","Kan het item niet toevoegen aan het winkelwagentje"
 "Cannot add the following product(s) to shopping cart: %s.","Kan de volgende producten niet toevoegen aan winkelwagen: %s."
 "Cannot add the item to shopping cart.","Kan het item niet toevoegen aan het winkelwagentje."
@@ -48,7 +48,7 @@
 "Edit","Bewerken"
 "Email Sender","E-mail Verzender"
 "Email Template","E-mail Sjabloon"
-"Email address can\'t be empty.","E-mailadres mag niet leeg zijn."
+"Email address can't be empty.","E-mailadres mag niet leeg zijn."
 "Email addresses, separated by commas","E-mailadressen, gedeeld door komma's"
 "Enabled","Aan"
 "General Options","Algemene opties"
diff --git a/app/code/Magento/Wishlist/i18n/pt_BR.csv b/app/code/Magento/Wishlist/i18n/pt_BR.csv
index 845ad7c87c4..f14f808bf43 100644
--- a/app/code/Magento/Wishlist/i18n/pt_BR.csv
+++ b/app/code/Magento/Wishlist/i18n/pt_BR.csv
@@ -18,9 +18,9 @@
 "Are you sure you want to remove this product from your wishlist?","Tem certeza de que deseja remover este produto da sua lista de desejos?"
 "Are you sure you would like to remove this item from the wishlist?","Você tem certeza de que deseja remover este item da lista de desejos?"
 "Back","Voltar"
-"Can\'t delete item from wishlist","Não é possível excluir item da lista de desejos"
-"Can\'t save description %s","Não é possível salvar descrição %s"
-"Can\'t update wishlist","Não é possível atualizar sua lista de desejos"
+"Can't delete item from wishlist","Não é possível excluir item da lista de desejos"
+"Can't save description %s","Não é possível salvar descrição %s"
+"Can't update wishlist","Não é possível atualizar sua lista de desejos"
 "Cannot add item to shopping cart","Não é possível adicionar item ao carrinho de compras"
 "Cannot add the following product(s) to shopping cart: %s.","Não foi possível adicionar o(s) seguinte(s) produto(s) ao carrinho de compras: %s"
 "Cannot add the item to shopping cart.","Impossível adicionar item ao carrinho."
@@ -48,7 +48,7 @@
 "Edit","Editar"
 "Email Sender","Remetente do e-mail:"
 "Email Template","Modelo de e-mail"
-"Email address can\'t be empty.","O endereço de email não pode ficar vazio."
+"Email address can't be empty.","O endereço de email não pode ficar vazio."
 "Email addresses, separated by commas","Endereços de email, separados por vírgulas"
 "Enabled","Ativado"
 "General Options","Opções gerais"
diff --git a/app/code/Magento/Wishlist/i18n/zh_CN.csv b/app/code/Magento/Wishlist/i18n/zh_CN.csv
index d264ab99f2b..9a8f2b1ee89 100644
--- a/app/code/Magento/Wishlist/i18n/zh_CN.csv
+++ b/app/code/Magento/Wishlist/i18n/zh_CN.csv
@@ -18,9 +18,9 @@
 "Are you sure you want to remove this product from your wishlist?","您是否确认要从愿望清单中删除该产品?"
 "Are you sure you would like to remove this item from the wishlist?","您确认要从愿望清单中删除该项目?"
 "Back","返回"
-"Can\'t delete item from wishlist","无法从愿望清单中删除项目"
-"Can\'t save description %s","无法保存描述 %s"
-"Can\'t update wishlist","无法更新愿望清单"
+"Can't delete item from wishlist","无法从愿望清单中删除项目"
+"Can't save description %s","无法保存描述 %s"
+"Can't update wishlist","无法更新愿望清单"
 "Cannot add item to shopping cart","无法添加内容到购物车"
 "Cannot add the following product(s) to shopping cart: %s.","无法将下列产品添加到购物车:%s。"
 "Cannot add the item to shopping cart.","无法添加该项目到购物车。"
@@ -48,7 +48,7 @@
 "Edit","编辑"
 "Email Sender","电子邮件发送人"
 "Email Template","电子邮件模板"
-"Email address can\'t be empty.","邮件地址不能为空。"
+"Email address can't be empty.","邮件地址不能为空。"
 "Email addresses, separated by commas","邮件地址,使用逗号分隔"
 "Enabled","已启用"
 "General Options","常规选项"
diff --git a/app/etc/di.xml b/app/etc/di.xml
index 178967a0456..7c1b9b7d5f8 100644
--- a/app/etc/di.xml
+++ b/app/etc/di.xml
@@ -92,7 +92,7 @@
     </type>
     <preference for="Magento\Module\Output\ConfigInterface" type="Magento\Core\Model\Module\Output\Config" />
     <preference for="Magento\View\Design\Theme\CustomizationInterface" type="Magento\View\Design\Theme\Customization" />
-    <preference for="Magento\Image\Adapter\ConfigInterface" type="Magento\Core\Model\Image\Adapter\Config" />
+    <preference for="Magento\Image\Adapter\ConfigInterface" type="Magento\Image\Adapter\Config" />
     <preference for="Magento\View\Design\Theme\Image\PathInterface" type="Magento\Core\Model\Theme\Image\Path" />
     <preference for="Magento\Session\Config\ConfigInterface" type="Magento\Core\Model\Session\Config" />
     <preference for="Magento\Session\SidResolverInterface" type="Magento\Core\Model\Session\SidResolver\Proxy" />
@@ -259,9 +259,6 @@
             <argument name="fileWriteFactory" xsi:type="object">Magento\Filesystem\File\WriteFactory</argument>
         </arguments>
     </type>
-    <type name="Magento\App\FrontController">
-        <plugin name="install" type="Magento\Module\FrontController\Plugin\Install" sortOrder="40"/>
-    </type>
     <virtualType name="layoutArgumentInterpreterInternal" type="Magento\Data\Argument\Interpreter\Composite">
         <arguments>
             <argument name="interpreters" xsi:type="array">
diff --git a/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php b/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php
index 7f02b9273c3..930a54b81ac 100644
--- a/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php
+++ b/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php
@@ -32,17 +32,38 @@ namespace Magento\TestFramework\Db;
 
 class Mysql extends \Magento\TestFramework\Db\AbstractDb
 {
+    /**
+     * Defaults extra file name
+     */
+    const DEFAULTS_EXTRA_FILE_NAME = 'defaults_extra.cnf';
+
+    /**
+     * Set initial essential parameters
+     *
+     * @param string $host
+     * @param string $user
+     * @param string $password
+     * @param string $schema
+     * @param string $varPath
+     * @param \Magento\Shell $shell
+     * @throws \Magento\Exception
+     */
+    public function __construct($host, $user, $password, $schema, $varPath, \Magento\Shell $shell)
+    {
+        parent::__construct($host, $user, $password, $schema, $varPath, $shell);
+        $this->_createDefaultsExtra();
+    }
+
     /**
      * Remove all DB objects
      */
     public function cleanup()
     {
         $this->_shell->execute(
-            'mysql --host=%s --user=%s --password=%s %s -e %s',
+            'mysql --defaults-extra-file=%s --host=%s %s -e %s',
             array(
+                $this->_getDefaultsExtraFileName(),
                 $this->_host,
-                $this->_user,
-                $this->_password,
                 $this->_schema,
                 "DROP DATABASE `{$this->_schema}`; CREATE DATABASE `{$this->_schema}`"
             )
@@ -75,8 +96,8 @@ class Mysql extends \Magento\TestFramework\Db\AbstractDb
     public function storeDbDump()
     {
         $this->_shell->execute(
-            'mysqldump --host=%s --user=%s --password=%s %s > %s',
-            array($this->_host, $this->_user, $this->_password, $this->_schema, $this->getSetupDbDumpFilename())
+            'mysqldump --defaults-extra-file=%s --host=%s  %s > %s',
+            array($this->_getDefaultsExtraFileName(), $this->_host, $this->_schema, $this->getSetupDbDumpFilename())
         );
     }
 
@@ -86,8 +107,32 @@ class Mysql extends \Magento\TestFramework\Db\AbstractDb
     public function restoreFromDbDump()
     {
         $this->_shell->execute(
-            'mysql --host=%s --user=%s --password=%s %s < %s',
-            array($this->_host, $this->_user, $this->_password, $this->_schema, $this->getSetupDbDumpFilename())
+            'mysql --defaults-extra-file=%s --host=%s %s < %s',
+            array($this->_getDefaultsExtraFileName(), $this->_host, $this->_schema, $this->getSetupDbDumpFilename())
+        );
+    }
+
+    /**
+     * Get defaults extra file name
+     *
+     * @return string
+     */
+    protected function _getDefaultsExtraFileName()
+    {
+        return rtrim($this->_varPath, '\\/') . DIRECTORY_SEPARATOR . self::DEFAULTS_EXTRA_FILE_NAME;
+    }
+
+    /**
+     * Create defaults extra file
+     */
+    protected function _createDefaultsExtra()
+    {
+        $extraConfig = array(
+            '[client]',
+            'user=' . $this->_user,
+            'password="' . $this->_password . '"'
         );
+        file_put_contents($this->_getDefaultsExtraFileName(), implode(PHP_EOL, $extraConfig));
+        chmod($this->_getDefaultsExtraFileName(), 0644);
     }
 }
diff --git a/dev/tests/integration/framework/Magento/TestFramework/Helper/Api.php b/dev/tests/integration/framework/Magento/TestFramework/Helper/Api.php
index 2f5cb205a4f..231954b0480 100644
--- a/dev/tests/integration/framework/Magento/TestFramework/Helper/Api.php
+++ b/dev/tests/integration/framework/Magento/TestFramework/Helper/Api.php
@@ -69,11 +69,11 @@ class Api
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('isSecureArea');
-        $objectManager->get('Magento\Core\Model\Registry')->register('isSecureArea', true);
+        $objectManager->get('Magento\Registry')->unregister('isSecureArea');
+        $objectManager->get('Magento\Registry')->register('isSecureArea', true);
         $result = call_user_func_array(array($handlerMock, $path), $params);
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('isSecureArea');
-        $objectManager->get('Magento\Core\Model\Registry')->register('isSecureArea', false);
+        $objectManager->get('Magento\Registry')->unregister('isSecureArea');
+        $objectManager->get('Magento\Registry')->register('isSecureArea', false);
 
         self::restoreErrorHandler();
         return $result;
diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php
index c53794935e8..3831a6f243b 100644
--- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php
+++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php
@@ -34,7 +34,7 @@ class ObjectManager extends \Magento\App\ObjectManager
      */
     protected $_classesToDestruct = array(
         'Magento\Core\Model\Layout',
-        'Magento\Core\Model\Registry'
+        'Magento\Registry'
     );
 
     /**
diff --git a/dev/tests/integration/testsuite/Magento/Backend/App/Router/DefaultRouterTest.php b/dev/tests/integration/testsuite/Magento/Backend/App/Router/DefaultRouterTest.php
index 4af3e4b4476..b3964933ac0 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/App/Router/DefaultRouterTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/App/Router/DefaultRouterTest.php
@@ -35,12 +35,17 @@ class DefaultRouterTest extends \PHPUnit_Framework_TestCase
     /**
      * @var \Magento\Backend\App\Router\DefaultRouter
      */
-    protected $_model;
+    protected $model;
+
+    /**
+     * @var \Magento\ObjectManager
+     */
+    protected $objectManager;
 
     protected function setUp()
     {
-        $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $this->_model = $objectManager->create('Magento\Backend\App\Router\DefaultRouter');
+        $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+        $this->model = $this->objectManager->create('Magento\Backend\App\Router\DefaultRouter');
     }
 
     public function testRouterCanProcessRequestsWithProperPathInfo()
@@ -50,7 +55,7 @@ class DefaultRouterTest extends \PHPUnit_Framework_TestCase
             ->method('getPathInfo')
             ->will($this->returnValue('backend/admin/dashboard'));
 
-        $this->assertInstanceOf('Magento\Backend\Controller\Adminhtml\Dashboard', $this->_model->match($request));
+        $this->assertInstanceOf('Magento\Backend\Controller\Adminhtml\Dashboard', $this->model->match($request));
     }
 
     /**
@@ -62,7 +67,7 @@ class DefaultRouterTest extends \PHPUnit_Framework_TestCase
      */
     public function testGetControllerClassName($module, $controller, $className)
     {
-        $this->assertEquals($className, $this->_model->getControllerClassName($module, $controller));
+        $this->assertEquals($className, $this->model->getControllerClassName($module, $controller));
     }
 
     public function getControllerClassNameDataProvider()
@@ -72,4 +77,50 @@ class DefaultRouterTest extends \PHPUnit_Framework_TestCase
             array('Magento_Index_Adminhtml', 'process', 'Magento\Index\Controller\Adminhtml\Process'),
         );
     }
+
+    /**
+     * @magentoDataFixture Magento/TestFixture/Controller/Adminhtml/Index.php
+     */
+    public function testMatchCustomNoRouteAction()
+    {
+        if (!\Magento\TestFramework\Helper\Bootstrap::canTestHeaders()) {
+            $this->markTestSkipped('Can\'t test get match without sending headers');
+        }
+
+        $routers = array(
+            'testmodule' => array(
+                'frontName' => 'testfixture',
+                'id' => 'testfixture',
+                'modules' => ['Magento_TestFixture_Adminhtml']
+            )
+        );
+
+        $routeConfig = $this->getMock(
+            'Magento\App\Route\Config',
+            ['_getRoutes'],
+            array(
+                'reader' => $this->objectManager->get('Magento\App\Route\Config\Reader'),
+                'cache' => $this->objectManager->get('Magento\Config\CacheInterface'),
+                'configScope' => $this->objectManager->get('Magento\Config\ScopeInterface'),
+                'areaList' => $this->objectManager->get('Magento\App\AreaList'),
+                'cacheId' => 'RoutesConfig',
+            )
+        );
+
+        $routeConfig->expects($this->any())
+            ->method('_getRoutes')
+            ->will($this->returnValue($routers));
+
+        $defaultRouter = $this->objectManager->create('Magento\Backend\App\Router\DefaultRouter', array(
+            'routeConfig' => $routeConfig
+        ));
+
+        /** @var $request \Magento\TestFramework\Request */
+        $request = $this->objectManager->get('Magento\TestFramework\Request');
+
+        $request->setPathInfo('backend/testfixture/test_controller');
+        $controller = $defaultRouter->match($request);
+        $this->assertInstanceOf('Magento\TestFixture\Controller\Adminhtml\Index', $controller);
+        $this->assertEquals('noroute', $request->getActionName());
+    }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php
index 583054fc1f4..a6572991344 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php
@@ -42,7 +42,7 @@ class GeneralTest extends \PHPUnit_Framework_TestCase
         $objectManager->get('Magento\View\DesignInterface')
             ->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE)
             ->setDefaultDesignTheme();
-        $objectManager->get('Magento\Core\Model\Registry')
+        $objectManager->get('Magento\Registry')
             ->register('design', $objectManager ->create('Magento\Core\Model\Design'));
         $layout = $objectManager ->create('Magento\Core\Model\Layout');
         $block = $layout->addBlock('Magento\Backend\Block\System\Design\Edit\Tab\General');
diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/GroupTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/GroupTest.php
index 0a7289a3ecf..9625b1a858e 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/GroupTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/GroupTest.php
@@ -51,7 +51,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
         foreach ($registryData as $key => $value) {
-            $objectManager->get('Magento\Core\Model\Registry')->register($key, $value);
+            $objectManager->get('Magento\Registry')->register($key, $value);
         }
 
         /** @var $layout \Magento\Core\Model\Layout */
@@ -66,9 +66,9 @@ class GroupTest extends \PHPUnit_Framework_TestCase
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('store_type');
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('store_data');
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('store_action');
+        $objectManager->get('Magento\Registry')->unregister('store_type');
+        $objectManager->get('Magento\Registry')->unregister('store_data');
+        $objectManager->get('Magento\Registry')->unregister('store_action');
     }
 
     public function testPrepareForm()
diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/StoreTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/StoreTest.php
index 8fb13aededa..3242115d315 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/StoreTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/StoreTest.php
@@ -51,7 +51,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
         foreach ($registryData as $key => $value) {
-            $objectManager->get('Magento\Core\Model\Registry')->register($key, $value);
+            $objectManager->get('Magento\Registry')->register($key, $value);
         }
 
         /** @var $layout \Magento\Core\Model\Layout */
@@ -66,9 +66,9 @@ class StoreTest extends \PHPUnit_Framework_TestCase
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('store_type');
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('store_data');
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('store_action');
+        $objectManager->get('Magento\Registry')->unregister('store_type');
+        $objectManager->get('Magento\Registry')->unregister('store_data');
+        $objectManager->get('Magento\Registry')->unregister('store_action');
     }
 
     public function testPrepareForm()
diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/WebsiteTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/WebsiteTest.php
index 7987b1874ff..3e67e72964d 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/WebsiteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/WebsiteTest.php
@@ -50,7 +50,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase
             'store_action' => 'add'
         );
         foreach ($registryData as $key => $value) {
-            $objectManager->get('Magento\Core\Model\Registry')->register($key, $value);
+            $objectManager->get('Magento\Registry')->register($key, $value);
         }
 
         /** @var $layout \Magento\Core\Model\Layout */
@@ -65,9 +65,9 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('store_type');
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('store_data');
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('store_action');
+        $objectManager->get('Magento\Registry')->unregister('store_type');
+        $objectManager->get('Magento\Registry')->unregister('store_data');
+        $objectManager->get('Magento\Registry')->unregister('store_action');
     }
 
     public function testPrepareForm()
diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/EditTest.php
index 04a6e32485a..d6f4783b759 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/EditTest.php
@@ -36,9 +36,9 @@ class EditTest extends \PHPUnit_Framework_TestCase
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('store_type');
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('store_data');
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('store_action');
+        $objectManager->get('Magento\Registry')->unregister('store_type');
+        $objectManager->get('Magento\Registry')->unregister('store_data');
+        $objectManager->get('Magento\Registry')->unregister('store_action');
     }
 
     /**
@@ -52,7 +52,7 @@ class EditTest extends \PHPUnit_Framework_TestCase
             if ($key == 'store_data') {
                 $value = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create($value);
             }
-            $objectManager->get('Magento\Core\Model\Registry')->register($key, $value);
+            $objectManager->get('Magento\Registry')->register($key, $value);
         }
     }
 
diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Variable/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Variable/EditTest.php
index 579c46e9e2c..e1ee781c402 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Variable/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Variable/EditTest.php
@@ -50,7 +50,7 @@ class EditTest extends \PHPUnit_Framework_TestCase
             ->setData($data)
             ->save();
 
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_variable', $variable);
+        $objectManager->get('Magento\Registry')->register('current_variable', $variable);
         $objectManager->get('Magento\App\RequestInterface')
             ->setParam('variable_id', $variable->getId());
         $block = $objectManager->get('Magento\View\LayoutInterface')
diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/TabsTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/TabsTest.php
index accc187d0fd..9e4b9f19fe1 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/TabsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/TabsTest.php
@@ -42,7 +42,7 @@ class TabsTest extends \PHPUnit_Framework_TestCase
             ->create('Magento\Widget\Model\Widget\Instance');
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_widget_instance', $widgetInstance);
+        $objectManager->get('Magento\Registry')->register('current_widget_instance', $widgetInstance);
 
         /** @var $layout \Magento\Core\Model\Layout */
         $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface');
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/TabsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/TabsTest.php
index 399e36e2574..93e1087a10c 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/TabsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/TabsTest.php
@@ -45,7 +45,7 @@ class TabsTest extends \PHPUnit_Framework_TestCase
         /** @var $product \Magento\Catalog\Model\Product */
         $product = $objectManager->create('Magento\Catalog\Model\Product');
         $product->load(1); // fixture
-        $objectManager->get('Magento\Core\Model\Registry')->register('product', $product);
+        $objectManager->get('Magento\Registry')->register('product', $product);
 
         $objectManager->get('Magento\App\State')->setAreaCode('nonexisting');
         /** @var $layout \Magento\Core\Model\Layout */
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/EditTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/EditTest.php
index 33ec5fb8a1b..8a8c619b8e1 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/EditTest.php
@@ -49,7 +49,7 @@ class EditTest extends \PHPUnit_Framework_TestCase
         $product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE);
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_product', $product);
+        $objectManager->get('Magento\Registry')->register('current_product', $product);
         $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface')
             ->createBlock('Magento\Catalog\Block\Adminhtml\Product\Edit');
     }
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Options/AjaxTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Options/AjaxTest.php
index bbab448973e..4a0e70ddf50 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Options/AjaxTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Options/AjaxTest.php
@@ -56,7 +56,7 @@ class AjaxTest extends \PHPUnit_Framework_TestCase
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('import_option_products', array(1));
+        $objectManager->get('Magento\Registry')->register('import_option_products', array(1));
         $result = json_decode($this->_block->toHtml(), true);
         $this->assertEquals('test_option_code_1', $result[0]['title']);
     }
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php
index e9d09e78205..dfb7b792d09 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php
@@ -43,7 +43,7 @@ class CrosssellTest extends \PHPUnit_Framework_TestCase
         $product->load(2);
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('product', $product);
+        $objectManager->get('Magento\Registry')->register('product', $product);
         /** @var $block \Magento\Catalog\Block\Product\ProductList\Crosssell */
         $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface')
             ->createBlock('Magento\Catalog\Block\Product\ProductList\Crosssell');
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php
index 7bbb9d53287..ce60446fafa 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php
@@ -43,7 +43,7 @@ class RelatedTest extends \PHPUnit_Framework_TestCase
         $product->load(2);
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('product', $product);
+        $objectManager->get('Magento\Registry')->register('product', $product);
         /** @var $block \Magento\Catalog\Block\Product\ProductList\Related */
         $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface')
             ->createBlock('Magento\Catalog\Block\Product\ProductList\Related');
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php
index ac610665123..0e82014f48f 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php
@@ -51,8 +51,8 @@ class OptionsTest extends \PHPUnit_Framework_TestCase
         $this->_product->load(1);
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('current_product');
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_product', $this->_product);
+        $objectManager->get('Magento\Registry')->unregister('current_product');
+        $objectManager->get('Magento\Registry')->register('current_product', $this->_product);
         $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface')
             ->createBlock('Magento\Catalog\Block\Product\View\Options');
     }
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ViewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ViewTest.php
index 17088ce8c1e..3fc513db555 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ViewTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ViewTest.php
@@ -50,8 +50,8 @@ class ViewTest extends \PHPUnit_Framework_TestCase
         $this->_block = $objectManager->create('Magento\Catalog\Block\Product\View');
         $this->_product = $objectManager->create('Magento\Catalog\Model\Product');
         $this->_product->load(1);
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('product');
-        $objectManager->get('Magento\Core\Model\Registry')->register('product', $this->_product);
+        $objectManager->get('Magento\Registry')->unregister('product');
+        $objectManager->get('Magento\Registry')->register('product', $this->_product);
     }
 
     public function testSetLayout()
@@ -74,7 +74,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase
 
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('product');
+        $objectManager->get('Magento\Registry')->unregister('product');
         $this->_block->setProductId(1);
         $this->assertEquals($this->_product->getId(), $this->_block->getProduct()->getId());
     }
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/CategoryTest.php
index 02af1494d91..9f3bcf66a9c 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/CategoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/CategoryTest.php
@@ -39,7 +39,7 @@ class CategoryTest extends \Magento\TestFramework\TestCase\AbstractController
         parent::assert404NotFound();
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $this->assertNull($objectManager->get('Magento\Core\Model\Registry')->registry('current_category'));
+        $this->assertNull($objectManager->get('Magento\Registry')->registry('current_category'));
     }
 
     public function getViewActionDataProvider()
@@ -90,7 +90,7 @@ class CategoryTest extends \Magento\TestFramework\TestCase\AbstractController
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
         /** @var $currentCategory \Magento\Catalog\Model\Category */
-        $currentCategory = $objectManager->get('Magento\Core\Model\Registry')->registry('current_category');
+        $currentCategory = $objectManager->get('Magento\Registry')->registry('current_category');
         $this->assertInstanceOf('Magento\Catalog\Model\Category', $currentCategory);
         $this->assertEquals($categoryId, $currentCategory->getId(), 'Category in registry.');
 
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/ProductTest.php
index 04d18bee5e1..068eaae6eef 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/ProductTest.php
@@ -37,7 +37,7 @@ class ProductTest extends \Magento\TestFramework\TestCase\AbstractController
         parent::assert404NotFound();
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $this->assertNull($objectManager->get('Magento\Core\Model\Registry')->registry('current_product'));
+        $this->assertNull($objectManager->get('Magento\Registry')->registry('current_product'));
     }
 
     protected function _getProductImageFile()
@@ -61,7 +61,7 @@ class ProductTest extends \Magento\TestFramework\TestCase\AbstractController
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
         /** @var $currentProduct \Magento\Catalog\Model\Product */
-        $currentProduct = $objectManager->get('Magento\Core\Model\Registry')->registry('current_product');
+        $currentProduct = $objectManager->get('Magento\Registry')->registry('current_product');
         $this->assertInstanceOf('Magento\Catalog\Model\Product', $currentProduct);
         $this->assertEquals(1, $currentProduct->getId());
 
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/CategoryTest.php
index c95aabab128..78a48ec4288 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/CategoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/CategoryTest.php
@@ -46,7 +46,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase
             $helperClass = get_class($this->_helper);
             /** @var $objectManager \Magento\TestFramework\ObjectManager */
             $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('_helper/' . $helperClass);
+            $objectManager->get('Magento\Registry')->unregister('_helper/' . $helperClass);
         }
         $this->_helper = null;
     }
@@ -61,7 +61,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase
         $index = 0;
         $expectedPaths = array(
             array(3, '1/2/3'), array(6, '1/2/6'), array(7, '1/2/7'),
-            array(9, '1/2/9'), array(10, '1/2/10'), array(11, '1/2/11'),
+            array(9, '1/2/9'), array(10, '1/2/10'), array(11, '1/2/11'), array(12, '1/2/12'),
         );
         foreach ($categories as $category) {
             $this->assertInstanceOf('Magento\Data\Tree\Node', $category);
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php
index 11afaaf1b4e..12a36ec1fba 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php
@@ -50,7 +50,7 @@ class DataTest extends \PHPUnit_Framework_TestCase
         $category->load(5);
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_category', $category);
+        $objectManager->get('Magento\Registry')->register('current_category', $category);
 
         try {
             $path = $this->_helper->getBreadcrumbPath();
@@ -58,9 +58,9 @@ class DataTest extends \PHPUnit_Framework_TestCase
             $this->assertEquals(array('category3', 'category4', 'category5'), array_keys($path));
             $this->assertArrayHasKey('label', $path['category3']);
             $this->assertArrayHasKey('link', $path['category3']);
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_category');
+            $objectManager->get('Magento\Registry')->unregister('current_category');
         } catch (\Exception $e) {
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_category');
+            $objectManager->get('Magento\Registry')->unregister('current_category');
             throw $e;
         }
     }
@@ -71,12 +71,12 @@ class DataTest extends \PHPUnit_Framework_TestCase
             ->create('Magento\Catalog\Model\Category');
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_category', $category);
+        $objectManager->get('Magento\Registry')->register('current_category', $category);
         try {
             $this->assertSame($category, $this->_helper->getCategory());
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_category');
+            $objectManager->get('Magento\Registry')->unregister('current_category');
         } catch (\Exception $e) {
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_category');
+            $objectManager->get('Magento\Registry')->unregister('current_category');
             throw $e;
         }
     }
@@ -87,12 +87,12 @@ class DataTest extends \PHPUnit_Framework_TestCase
             ->create('Magento\Catalog\Model\Product');
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_product', $product);
+        $objectManager->get('Magento\Registry')->register('current_product', $product);
         try {
             $this->assertSame($product, $this->_helper->getProduct());
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_product');
+            $objectManager->get('Magento\Registry')->unregister('current_product');
         } catch (\Exception $e) {
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_product');
+            $objectManager->get('Magento\Registry')->unregister('current_product');
             throw $e;
         }
     }
@@ -108,12 +108,12 @@ class DataTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(array(), $this->_helper->getAttributeHiddenFields());
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('attribute_type_hidden_fields', 'test');
+        $objectManager->get('Magento\Registry')->register('attribute_type_hidden_fields', 'test');
         try {
             $this->assertEquals('test', $this->_helper->getAttributeHiddenFields());
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('attribute_type_hidden_fields');
+            $objectManager->get('Magento\Registry')->unregister('attribute_type_hidden_fields');
         } catch (\Exception $e) {
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('attribute_type_hidden_fields');
+            $objectManager->get('Magento\Registry')->unregister('attribute_type_hidden_fields');
             throw $e;
         }
     }
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/FlatTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/FlatTest.php
index 87eb4709103..222e4902b15 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/FlatTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/FlatTest.php
@@ -30,20 +30,27 @@ namespace Magento\Catalog\Helper\Product;
 class FlatTest extends \PHPUnit_Framework_TestCase
 {
     /**
-     * @var \Magento\Catalog\Helper\Product\Flat
+     * @var \Magento\Catalog\Helper\Product\Flat\Indexer
      */
     protected $_helper;
 
+    /**
+     * @var \Magento\Catalog\Model\Indexer\Product\Flat\State
+     */
+    protected $_state;
+
     protected function setUp()
     {
         $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->get('Magento\Catalog\Helper\Product\Flat');
+            ->get('Magento\Catalog\Helper\Product\Flat\Indexer');
+        $this->_state = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->get('\Magento\Catalog\Model\Indexer\Product\Flat\State');
     }
 
     public function testIsEnabledDefault()
     {
 
-        $this->assertFalse($this->_helper->isEnabled());
+        $this->assertFalse($this->_state->isFlatEnabled());
     }
 
     /**
@@ -51,7 +58,7 @@ class FlatTest extends \PHPUnit_Framework_TestCase
      */
     public function testIsEnabled()
     {
-        $this->assertTrue($this->_helper->isEnabled());
+        $this->assertTrue($this->_state->isFlatEnabled());
     }
 
     public function testIsAddFilterableAttributesDefault()
@@ -62,7 +69,7 @@ class FlatTest extends \PHPUnit_Framework_TestCase
     public function testIsAddFilterableAttributes()
     {
         $helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Catalog\Helper\Product\Flat', array('addFilterableAttrs' => 1));
+            ->create('Magento\Catalog\Helper\Product\Flat\Indexer', array('addFilterableAttrs' => 1));
         $this->assertEquals(1, $helper->isAddFilterableAttributes());
     }
 
@@ -74,7 +81,7 @@ class FlatTest extends \PHPUnit_Framework_TestCase
     public function testIsAddChildData()
     {
         $helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Catalog\Helper\Product\Flat', array('addChildData' => 1));
+            ->create('Magento\Catalog\Helper\Product\Flat\Indexer', array('addChildData' => 1));
         $this->assertEquals(1, $helper->isAddChildData());
     }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php
index c0c49ea243c..d7b7150cca0 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php
@@ -100,7 +100,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase
         $product->setTypeId(\Magento\Catalog\Model\Product\Type::DEFAULT_TYPE)->setId(99)->setUrlKey($uniqid);
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('product', $product);
+        $objectManager->get('Magento\Registry')->register('product', $product);
 
         $this->_helper->initProductLayout($product, $this->_controller);
         $rootBlock = $this->_layout->getBlock('root');
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/ProductTest.php
index f80542ec752..bd7b1487285 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/ProductTest.php
@@ -115,15 +115,15 @@ class ProductTest extends \PHPUnit_Framework_TestCase
         $category->setId(10);
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_category', $category);
+        $objectManager->get('Magento\Registry')->register('current_category', $category);
 
         try {
             $this->assertStringEndsWith(
                 'sendfriend/product/send/id/100/cat_id/10/', $this->_helper->getEmailToFriendUrl($product)
             );
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_category');
+            $objectManager->get('Magento\Registry')->unregister('current_category');
         } catch (\Exception $e) {
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_category');
+            $objectManager->get('Magento\Registry')->unregister('current_category');
             throw $e;
         }
     }
@@ -211,11 +211,11 @@ class ProductTest extends \PHPUnit_Framework_TestCase
 
         $this->assertInstanceOf(
             'Magento\Catalog\Model\Product',
-            $objectManager->get('Magento\Core\Model\Registry')->registry('current_product')
+            $objectManager->get('Magento\Registry')->registry('current_product')
         );
         $this->assertInstanceOf(
             'Magento\Catalog\Model\Category',
-            $objectManager->get('Magento\Core\Model\Registry')->registry('current_category')
+            $objectManager->get('Magento\Registry')->registry('current_category')
         );
     }
 
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest.php
index 27216bf362b..2ea42da5f75 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest.php
@@ -89,7 +89,7 @@ class CategoryImageTest extends \PHPUnit_Framework_TestCase
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
         /** @var $category \Magento\Catalog\Model\Category */
-        $category = $objectManager->get('Magento\Core\Model\Registry')
+        $category = $objectManager->get('Magento\Registry')
             ->registry('_fixture/Magento\Catalog\Model\Category');
         $this->assertNotEmpty($category->getId());
 
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/_files/category_without_image.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/_files/category_without_image.php
index 68cdc2c1ab0..9cde1b03a78 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/_files/category_without_image.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/_files/category_without_image.php
@@ -41,4 +41,4 @@ $category->setName('Category Without Image 1')
 
 /** @var $objectManager \Magento\TestFramework\ObjectManager */
 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-$objectManager->get('Magento\Core\Model\Registry')->register('_fixture/Magento\Catalog\Model\Category', $category);
+$objectManager->get('Magento\Registry')->register('_fixture/Magento\Catalog\Model\Category', $category);
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/FullTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/FullTest.php
index 0b5dc0b4f75..a87f16f334a 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/FullTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/FullTest.php
@@ -33,9 +33,9 @@ namespace Magento\Catalog\Model\Indexer\Product\Flat\Action;
 class FullTest extends \Magento\TestFramework\Indexer\TestCase
 {
     /**
-     * @var \Magento\Catalog\Helper\Product\Flat
+     * @var \Magento\Catalog\Model\Indexer\Product\Flat\State
      */
-    protected $_helper;
+    protected $_state;
 
     /**
      * @var \Magento\Catalog\Model\Indexer\Product\Flat\Processor
@@ -44,8 +44,8 @@ class FullTest extends \Magento\TestFramework\Indexer\TestCase
 
     protected function setUp()
     {
-        $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->get('Magento\Catalog\Helper\Product\Flat');
+        $this->_state = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->get('Magento\Catalog\Model\Indexer\Product\Flat\State');
         $this->_processor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->get('Magento\Catalog\Model\Indexer\Product\Flat\Processor');
     }
@@ -58,13 +58,13 @@ class FullTest extends \Magento\TestFramework\Indexer\TestCase
      */
     public function testReindexAll()
     {
-        $this->assertTrue($this->_helper->isEnabled());
+        $this->assertTrue($this->_state->isFlatEnabled());
         $this->_processor->reindexAll();
 
         $categoryFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->get('\Magento\Catalog\Model\CategoryFactory');
+            ->get('Magento\Catalog\Model\CategoryFactory');
         $listProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->get('\Magento\Catalog\Block\Product\ListProduct');
+            ->get('Magento\Catalog\Block\Product\ListProduct');
 
         $category = $categoryFactory->create()->load(2);
         $layer = $listProduct->getLayer();
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php
index d26bc0eaa47..6a170631483 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php
@@ -44,9 +44,9 @@ class RowTest extends \Magento\TestFramework\Indexer\TestCase
     protected $_category;
 
     /**
-     * @var \Magento\Catalog\Helper\Product\Flat
+     * @var \Magento\Catalog\Model\Indexer\Product\Flat\State
      */
-    protected $_helper;
+    protected $_state;
 
     /**
      * @var \Magento\Catalog\Model\Indexer\Product\Flat\Processor
@@ -59,29 +59,37 @@ class RowTest extends \Magento\TestFramework\Indexer\TestCase
             ->create('Magento\Catalog\Model\Product');
         $this->_category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\Catalog\Model\Category');
-        $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Catalog\Helper\Product\Flat');
+        $this->_state = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('\Magento\Catalog\Model\Indexer\Product\Flat\State');
         $this->_processor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\Catalog\Model\Indexer\Product\Flat\Processor');
     }
 
     /**
-     * @magentoDbIsolation enabled
-     * @magentoAppIsolation enabled
      * @magentoDataFixture Magento/Catalog/_files/row_fixture.php
      * @magentoConfigFixture current_store catalog/frontend/flat_catalog_product 1
+     * @magentoAppArea frontend
      */
     public function testProductUpdate()
     {
+        $this->markTestSkipped('Incomplete due to MAGETWO-21369');
+
         $categoryFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('\Magento\Catalog\Model\CategoryFactory');
         $listProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('\Magento\Catalog\Block\Product\ListProduct');
 
-        $this->assertTrue($this->_helper->isEnabled());
+        $this->assertTrue(
+            $this->_state->isFlatEnabled(),
+            'Flat is not enabled in configuration'
+        );
 
         $this->_processor->getIndexer()->setScheduled(false);
-        $this->assertFalse($this->_processor->getIndexer()->isScheduled());
+        $this->assertFalse(
+            $this->_processor->getIndexer()->isScheduled(),
+            'Indexer is in scheduled mode when turned to update on save mode'
+         );
+        $this->_processor->reindexAll();
 
         $this->_product->load(1);
         $this->_product->setName('Updated Product');
@@ -90,15 +98,21 @@ class RowTest extends \Magento\TestFramework\Indexer\TestCase
         $category = $categoryFactory->create()->load(9);
         $layer = $listProduct->getLayer();
         $layer->setCurrentCategory($category);
+        /** @var \Magento\Catalog\Model\Resource\Product\Collection $productCollection */
         $productCollection = $layer->getProductCollection();
+        $this->assertTrue(
+            $productCollection->isEnabledFlat(), 'Product collection is not using flat resource when flat is on'
+        );
 
-        $this->assertEquals(1, $productCollection->count());
+        $this->assertEquals(2, $productCollection->count(), 'Product collection items count must be exactly 2');
 
-        /** @var $product \Magento\Catalog\Model\Product */
         foreach ($productCollection as $product) {
-            $this->assertEquals($this->_product->getId(), $product->getId());
-            $this->assertEquals($this->_product->getName(), $product->getName());
-            $this->assertEquals($this->_product->getPrice(), $product->getPrice());
+            /** @var $product \Magento\Catalog\Model\Product */
+            if ($product->getId() == 1) {
+                $this->assertEquals(
+                    'Updated Product', $product->getName(), 'Product name from flat does not match with updated name'
+                );
+            }
         }
     }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php
index a41b8aa1dd8..39537b8c9cd 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php
@@ -64,9 +64,9 @@ class RowsTest extends \Magento\TestFramework\Indexer\TestCase
         $this->_processor->reindexList(array($this->_product->getId()));
 
         $categoryFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->get('\Magento\Catalog\Model\CategoryFactory');
+            ->get('Magento\Catalog\Model\CategoryFactory');
         $listProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->get('\Magento\Catalog\Block\Product\ListProduct');
+            ->get('Magento\Catalog\Block\Product\ListProduct');
 
         $category = $categoryFactory->create()->load(2);
         $layer = $listProduct->getLayer();
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
index 66480faeee2..48afbb4caf2 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
@@ -34,9 +34,9 @@ namespace Magento\Catalog\Model\Indexer\Product\Flat;
 class ProcessorTest extends \Magento\TestFramework\Indexer\TestCase
 {
     /**
-     * @var \Magento\Catalog\Helper\Product\Flat
+     * @var \Magento\Catalog\Model\Indexer\Product\Flat\State
      */
-    protected $_helper;
+    protected $_state;
 
     /**
      * @var \Magento\Catalog\Model\Indexer\Product\Flat\Processor
@@ -45,8 +45,8 @@ class ProcessorTest extends \Magento\TestFramework\Indexer\TestCase
 
     protected function setUp()
     {
-        $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->get('Magento\Catalog\Helper\Product\Flat');
+        $this->_state = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->get('Magento\Catalog\Model\Indexer\Product\Flat\State');
         $this->_processor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->get('Magento\Catalog\Model\Indexer\Product\Flat\Processor');
     }
@@ -59,7 +59,7 @@ class ProcessorTest extends \Magento\TestFramework\Indexer\TestCase
      */
     public function testEnableProductFlat()
     {
-        $this->assertTrue($this->_helper->isEnabled());
+        $this->assertTrue($this->_state->isFlatEnabled());
         $this->assertTrue($this->_processor->getIndexer()->isInvalid());
     }
 
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/CategoryTest.php
index 2f1ac459c68..c919a572500 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/CategoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/CategoryTest.php
@@ -74,7 +74,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase
         );
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $this->assertNull($objectManager->get('Magento\Core\Model\Registry')->registry('current_category_filter'));
+        $this->assertNull($objectManager->get('Magento\Registry')->registry('current_category_filter'));
     }
 
     public function testApply()
@@ -89,7 +89,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase
         );
 
         /** @var $category \Magento\Catalog\Model\Category */
-        $category = $objectManager->get('Magento\Core\Model\Registry')->registry('current_category_filter');
+        $category = $objectManager->get('Magento\Registry')->registry('current_category_filter');
         $this->assertInstanceOf('Magento\Catalog\Model\Category', $category);
         $this->assertEquals(3, $category->getId());
 
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/LayerTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/LayerTest.php
index 9c77159f820..3c4d197e024 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/LayerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/LayerTest.php
@@ -138,15 +138,15 @@ class LayerTest extends \PHPUnit_Framework_TestCase
         /* Category in registry */
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_category', $existingCategory);
+        $objectManager->get('Magento\Registry')->register('current_category', $existingCategory);
         try {
             $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\Catalog\Model\Layer');
             $this->assertSame($existingCategory, $model->getCurrentCategory());
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_category');
+            $objectManager->get('Magento\Registry')->unregister('current_category');
             $this->assertSame($existingCategory, $model->getCurrentCategory());
         } catch (\Exception $e) {
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_category');
+            $objectManager->get('Magento\Registry')->unregister('current_category');
             throw $e;
         }
 
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php
index 580515e7f75..ec8e1f0aa6a 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php
@@ -45,7 +45,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase
         $coreData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false);
         $fileStorageDb = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false);
         $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false);
-        $registry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $registry = $this->getMock('Magento\Registry', array(), array(), '', false);
         $logger = $this->getMock('Magento\Logger', array(), array(), '', false);
         $this->_model = $this->getMockForAbstractClass('Magento\Catalog\Model\Product\Type\AbstractType',
             array($productFactory, $catalogProductOption, $eavConfig, $catalogProductType, $eventManager, $coreData,
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php
index e7e1d1b5f3d..1a1345da5cc 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php
@@ -72,12 +72,12 @@ class ProductExternalTest extends \PHPUnit_Framework_TestCase
         $category = new \Magento\Object(array('id' => 5));
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_category', $category);
+        $objectManager->get('Magento\Registry')->register('current_category', $category);
         try {
             $this->assertEquals(5, $this->_model->getCategoryId());
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_category');
+            $objectManager->get('Magento\Registry')->unregister('current_category');
         } catch (\Exception $e) {
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_category');
+            $objectManager->get('Magento\Registry')->unregister('current_category');
             throw $e;
         }
     }
@@ -88,15 +88,15 @@ class ProductExternalTest extends \PHPUnit_Framework_TestCase
 
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')
+        $objectManager->get('Magento\Registry')
             ->register('current_category', new \Magento\Object(array('id' => 3))); // fixture
         try {
             $category = $this->_model->getCategory();
             $this->assertInstanceOf('Magento\Catalog\Model\Category', $category);
             $this->assertEquals(3, $category->getId());
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_category');
+            $objectManager->get('Magento\Registry')->unregister('current_category');
         } catch (\Exception $e) {
-            $objectManager->get('Magento\Core\Model\Registry')->unregister('current_category');
+            $objectManager->get('Magento\Registry')->unregister('current_category');
             throw $e;
         }
 
@@ -321,9 +321,12 @@ class ProductExternalTest extends \PHPUnit_Framework_TestCase
     public function testGetAvailableInCategories()
     {
         $this->assertEquals(array(), $this->_model->getAvailableInCategories());
-        $this->_model->load(1); // fixture
+        $this->_model->load(4); // fixture
         $actualCategoryIds = $this->_model->getAvailableInCategories();
         sort($actualCategoryIds); // not depend on the order of items
-        $this->assertEquals(array(2, 3, 4), $actualCategoryIds);
+        $this->assertEquals(array(2, 10, 11, 12), $actualCategoryIds);
+        //Check not visible product
+        $this->_model->load(3);
+        $this->assertEmpty($this->_model->getAvailableInCategories());
     }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php
index 1899417db28..441614f9754 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php
@@ -178,7 +178,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase
         $copier = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->get('Magento\Catalog\Model\Product\Copier');
         $duplicate = $copier->copy($this->_model);
-        $this->assertEquals('simple-1', $duplicate->getSku());
+        $this->assertEquals('simple-3', $duplicate->getSku());
     }
 
     /**
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php
index e3b91562e73..a1d32bf7a86 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php
@@ -99,6 +99,18 @@ $category->setId(7)
     ->setPosition(3)
     ->save();
 
+$category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\Catalog\Model\Category');
+$category->setId(8)
+    ->setName('Inactive')
+    ->setParentId(2)
+    ->setPath('1/2/8')
+    ->setAvailableSortBy('name')
+    ->setDefaultSortBy('name')
+    ->setIsActive(false)
+    ->setPosition(4)
+    ->save();
+
 $category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
     ->create('Magento\Catalog\Model\Category');
 $category->setId(9)
@@ -140,14 +152,15 @@ $category->setId(11)
 
 $category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
     ->create('Magento\Catalog\Model\Category');
-$category->setId(8)
-    ->setName('Inactive')
+$category->setId(12)
+    ->setName('Category 12')
     ->setParentId(2)
-    ->setPath('1/2/8')
+    ->setPath('1/2/12')
+    ->setLevel(2)
     ->setAvailableSortBy('name')
     ->setDefaultSortBy('name')
-    ->setIsActive(false)
-    ->setPosition(4)
+    ->setIsActive(true)
+    ->setPosition(8)
     ->save();
 
 /** @var $product \Magento\Catalog\Model\Product */
@@ -188,3 +201,42 @@ $product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
     ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
     ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
     ->save();
+
+$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\Catalog\Model\Product');
+$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
+    ->setId(3)
+    ->setAttributeSetId($installer->getAttributeSetId('catalog_product', 'Default'))
+    ->setStoreId(1)
+    ->setWebsiteIds(array(1))
+    ->setName('Simple Product Not Visible On Frontend')
+    ->setSku('simple')
+    ->setPrice(15)
+    ->setWeight(2)
+    ->setStockData(array(
+        'use_config_manage_stock' => 0,
+    ))
+    ->setCategoryIds(array(10, 11, 12))
+    ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_NOT_VISIBLE)
+    ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
+    ->save();
+
+/** @var $product \Magento\Catalog\Model\Product */
+$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\Catalog\Model\Product');
+$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
+    ->setId(4)
+    ->setAttributeSetId($installer->getAttributeSetId('catalog_product', 'Default'))
+    ->setStoreId(1)
+    ->setWebsiteIds(array(1))
+    ->setName('Simple Product Three')
+    ->setSku('simple')
+    ->setPrice(10)
+    ->setWeight(18)
+    ->setStockData(array(
+        'use_config_manage_stock' => 0,
+    ))
+    ->setCategoryIds(array(10, 11, 12))
+    ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
+    ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
+    ->save();
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/MainTest.php
index 1b17108e796..398a2d9d312 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/MainTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/MainTest.php
@@ -45,7 +45,7 @@ class MainTest extends \PHPUnit_Framework_TestCase
             ->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE)
             ->setDefaultDesignTheme();
         $rule = $objectManager->create('Magento\CatalogRule\Model\Rule');
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_promo_catalog_rule', $rule);
+        $objectManager->get('Magento\Registry')->register('current_promo_catalog_rule', $rule);
 
         $block = $objectManager->create('Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab\Main');
         $block->setLayout($objectManager->create('Magento\Core\Model\Layout'));
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php
index a8a96fa72a1..75ee7816270 100644
--- a/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php
+++ b/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php
@@ -162,6 +162,56 @@ class CartTest extends \Magento\TestFramework\TestCase\AbstractController
         );
     }
 
+    /**
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDataFixture Magento/Checkout/_files/quote_with_simple_product.php
+     * @magentoAppIsolation enabled
+     */
+    public function testUpdatePostAction()
+    {
+        /** Preconditions */
+        $customerFromFixture = 1;
+        $productId = 1;
+        $originalQuantity = 1;
+        $updatedQuantity = 2;
+        /** @var $checkoutSession \Magento\Checkout\Model\Session  */
+        $checkoutSession = $this->_objectManager->create('Magento\Checkout\Model\Session');
+        $quoteItem = $this->_getQuoteItemIdByProductId($checkoutSession->getQuote(), $productId);
+
+        /** @var \Magento\Data\Form\FormKey $formKey */
+        $formKey = $this->_objectManager->get('Magento\Data\Form\FormKey');
+        $postData = [
+            'cart' => [$quoteItem->getId() => ['qty' => $updatedQuantity]],
+            'update_cart_action' => 'update_qty',
+            'form_key' => $formKey->getFormKey()
+        ];
+        $this->getRequest()->setPost($postData);
+        /** @var $customerSession \Magento\Customer\Model\Session */
+        $customerSession = $this->_objectManager->create('Magento\Customer\Model\Session');
+        $customerSession->setCustomerId($customerFromFixture);
+
+        $this->assertNotNull($quoteItem, 'Cannot get quote item for simple product');
+        $this->assertEquals(
+            $originalQuantity,
+            $quoteItem->getQty(),
+            "Precondition failed: invalid quote item quantity"
+        );
+
+        /** Execute SUT */
+        $this->dispatch('checkout/cart/updatePost');
+
+        /** Check results */
+        /** @var \Magento\Sales\Model\Quote $quote */
+        $quote = $this->_objectManager->create('Magento\Sales\Model\Quote');
+        $quote->load($checkoutSession->getQuote()->getId());
+        $quoteItem = $this->_getQuoteItemIdByProductId($quote, 1);
+        $this->assertEquals(
+            $updatedQuantity,
+            $quoteItem->getQty(),
+            "Invalid quote item quantity"
+        );
+    }
+
     /**
      * Gets \Magento\Sales\Model\Quote\Item from \Magento\Sales\Model\Quote by product id
      *
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php
new file mode 100644
index 00000000000..227603758d6
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php
@@ -0,0 +1,151 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Checkout\Model;
+
+use Magento\TestFramework\Helper\Bootstrap;
+
+class SessionTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Checkout\Model\Session
+     */
+    protected $_checkoutSession;
+
+    protected function setUp()
+    {
+        $this->_checkoutSession = Bootstrap::getObjectManager()->create('Magento\Checkout\Model\Session');
+        parent::setUp();
+    }
+
+    /**
+     * Test covers case when quote is not yet initialized and customer data is set to checkout session model.
+     *
+     * Expected result - quote object should be loaded and customer data should be set to it.
+     *
+     * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php
+     */
+    public function testGetQuoteNotInitializedCustomerSet()
+    {
+        /** Preconditions */
+        $customerIdFromFixture = 1;
+        /** @var \Magento\Customer\Service\V1\CustomerServiceInterface $customerService */
+        $customerService = Bootstrap::getObjectManager()->get('Magento\Customer\Service\V1\CustomerServiceInterface');
+        $customer = $customerService->getCustomer($customerIdFromFixture);
+        $this->_checkoutSession->setCustomerData($customer);
+
+        /** Execute SUT */
+        $quote = $this->_checkoutSession->getQuote();
+        $this->_validateCustomerDataInQuote($quote);
+    }
+
+    /**
+     * Test covers case when quote is not yet initialized and customer data is set to customer session model.
+     *
+     * Expected result - quote object should be loaded and customer data should be set to it.
+     *
+     * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php
+     * @magentoAppIsolation enabled
+     */
+    public function testGetQuoteNotInitializedCustomerLoggedIn()
+    {
+        /** Preconditions */
+        $customerIdFromFixture = 1;
+        /** @var \Magento\Customer\Service\V1\CustomerServiceInterface $customerService */
+        $customerService = Bootstrap::getObjectManager()->get('Magento\Customer\Service\V1\CustomerServiceInterface');
+        $customer = $customerService->getCustomer($customerIdFromFixture);
+        /** @var \Magento\Customer\Model\Session $customerSession */
+        $customerSession = Bootstrap::getObjectManager()->get('Magento\Customer\Model\Session');
+        $customerSession->setCustomerData($customer);
+
+        /** Execute SUT */
+        $quote = $this->_checkoutSession->getQuote();
+        $this->_validateCustomerDataInQuote($quote);
+    }
+
+    /**
+     * Tes merging of customer data into initialized quote object.
+     *
+     * Conditions:
+     * 1. Quote without customer data is set to checkout session
+     * 2. Customer without associated quote is set to checkout session
+     *
+     * Expected result:
+     * Quote which is set to checkout session should contain customer data
+     *
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoAppIsolation enabled
+     */
+    public function testLoadCustomerQuoteCustomerWithoutQuote()
+    {
+        /** Preconditions */
+        $customerIdFromFixture = 1;
+        $quote = $this->_checkoutSession->getQuote();
+        $this->assertEmpty($quote->getCustomerId(), 'Precondition failed: Customer data must not be set to quote');
+        $this->assertEmpty($quote->getCustomerEmail(), 'Precondition failed: Customer data must not be set to quote');
+
+        /** @var \Magento\Customer\Service\V1\CustomerServiceInterface $customerService */
+        $customerService = Bootstrap::getObjectManager()->get('Magento\Customer\Service\V1\CustomerServiceInterface');
+        $customer = $customerService->getCustomer($customerIdFromFixture);
+        /** @var \Magento\Customer\Model\Session $customerSession */
+        $customerSession = Bootstrap::getObjectManager()->get('Magento\Customer\Model\Session');
+        $customerSession->setCustomerData($customer);
+
+        /** Ensure that customer data is still unavailable before SUT invocation */
+        $quote = $this->_checkoutSession->getQuote();
+        $this->assertEmpty($quote->getCustomerEmail(), 'Precondition failed: Customer data must not be set to quote');
+
+        /** Execute SUT */
+        $this->_checkoutSession->loadCustomerQuote();
+        $quote = $this->_checkoutSession->getQuote();
+        $this->_validateCustomerDataInQuote($quote);
+    }
+
+    /**
+     * Ensure that quote has customer data specified in customer fixture.
+     *
+     * @param \Magento\Sales\Model\Quote $quote
+     */
+    protected function _validateCustomerDataInQuote($quote)
+    {
+        $customerIdFromFixture = 1;
+        $customerEmailFromFixture = 'customer@example.com';
+        $customerFirstNameFromFixture = 'Firstname';
+        $this->assertEquals(
+            $customerEmailFromFixture,
+            $quote->getCustomerEmail(),
+            'Customer email was not set to Quote correctly.'
+        );
+        $this->assertEquals(
+            $customerIdFromFixture,
+            $quote->getCustomerId(),
+            'Customer ID was not set to Quote correctly.'
+        );
+        $this->assertEquals(
+            $customerFirstNameFromFixture,
+            $quote->getCustomerFirstname(),
+            'Customer first name was not set to Quote correctly.'
+        );
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Model/Type/OnepageTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Model/Type/OnepageTest.php
index 8eaa914f2e0..e658d804936 100644
--- a/dev/tests/integration/testsuite/Magento/Checkout/Model/Type/OnepageTest.php
+++ b/dev/tests/integration/testsuite/Magento/Checkout/Model/Type/OnepageTest.php
@@ -20,66 +20,486 @@
  *
  * @category    Magento
  * @package     Magento_Checkout
- * @subpackage  integration_tests
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
 namespace Magento\Checkout\Model\Type;
 
+use Magento\TestFramework\Helper\Bootstrap;
+
 /**
+ * @magentoDataFixture Magento/Checkout/_files/quote_with_product_and_payment.php
  * @magentoAppArea frontend
  */
 class OnepageTest extends \PHPUnit_Framework_TestCase
 {
+    /** @var \Magento\Checkout\Model\Type\Onepage */
+    protected $_model;
+
+    /** @var \Magento\Sales\Model\Quote */
+    protected $_currentQuote;
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->_model = Bootstrap::getObjectManager()->create('Magento\Checkout\Model\Type\Onepage');
+        /** @var \Magento\Sales\Model\Resource\Quote\Collection $quoteCollection */
+        $quoteCollection = Bootstrap::getObjectManager()->create('Magento\Sales\Model\Resource\Quote\Collection');
+        /** @var \Magento\Sales\Model\Quote $quote */
+        $this->_currentQuote = $quoteCollection->getLastItem();
+        $this->_model->setQuote($this->_currentQuote);
+    }
+
     /**
      * @magentoAppIsolation enabled
-     * @magentoDataFixture Magento/Checkout/_files/quote_with_product_and_payment.php
-     * @dataProvider saveOrderDataProvider
-     *
-     * @param array $customerData
+     * @magentoDbIsolation enabled
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDataFixture Magento/Customer/_files/customer_address.php
      */
-    public function testSaveOrder($customerData)
+    public function testSaveShippingWithCustomerId()
     {
-        /** @var $model \Magento\Checkout\Model\Type\Onepage */
-        $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Checkout\Model\Type\Onepage');
+        $this->_currentQuote->setCustomerId(1)
+            ->save();
+        $data = [
+            'address_id' => '',
+            'firstname' => 'Joe',
+            'lastname' => 'Black',
+            'company' => 'Lunatis',
+            'street' => ['1100 Parmer', 'ln.'],
+            'city' => 'Austin',
+            'region_id' => '57',
+            'region' => '',
+            'postcode' => '78757',
+            'country_id' => 'US',
+            'telephone' => '(512) 999-9999',
+            'fax' => '',
+            'save_in_address_book' => 1
+        ];
+        $this->_model->saveShipping($data, 1);
 
-        /** @var \Magento\Sales\Model\Resource\Quote\Collection $quoteCollection */
-        $quoteCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Sales\Model\Resource\Quote\Collection');
-        /** @var \Magento\Sales\Model\Quote $quote */
-        $quote = $quoteCollection->getLastItem();
+        $address = $this->_currentQuote->getShippingAddress();
+
+        /* Verify that data from Customer Address identified by id=1 is set */
+        $this->assertEquals('John', $address->getFirstname());
+        $this->assertEquals('Smith', $address->getLastname());
+        $this->assertEquals(['Green str, 67'], $address->getStreet());
+        $this->assertEquals('CityM', $address->getCity());
+        $this->assertEquals('Alabama', $address->getRegion());
+        $this->assertEquals(1, $address->getRegionId());
+        $this->assertEquals('75477', $address->getPostcode());
+        $this->assertEquals('US', $address->getCountryId());
+        $this->assertEquals('3468676', $address->getTelephone());
+        $this->assertEquals('customer@example.com', $address->getEmail());
+        $this->assertTrue($address->getCollectShippingRates());
+        $this->assertEquals(1, $address->getCustomerAddressId());
+    }
+
+    /**
+     * @magentoAppIsolation enabled
+     * @magentoDbIsolation enabled
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDataFixture Magento/Customer/_files/customer_address.php
+     */
+    public function testSaveShippingWithData()
+    {
+        $data = [
+            'address_id' => '',
+            'firstname' => 'Joe',
+            'lastname' => 'Black',
+            'company' => 'Lunatis',
+            'street' => ['1100 Parmer', 'ln.'],
+            'city' => 'Austin',
+            'region_id' => '57',
+            'region' => '',
+            'postcode' => '78757',
+            'country_id' => 'US',
+            'telephone' => '(512) 999-9999',
+            'fax' => '',
+            'save_in_address_book' => 1
+        ];
+        $this->_model->saveShipping($data, null);
 
-        $model->setQuote($quote);
-        $model->saveBilling($customerData, null);
+        $address = $this->_currentQuote->getShippingAddress();
 
-        $this->_prepareQuote($quote);
+        /* Verify that data from the form is set */
+        $this->assertEquals('Joe', $address->getFirstname());
+        $this->assertEquals('Black', $address->getLastname());
+        $this->assertEquals('Lunatis', $address->getCompany());
+        $this->assertEquals("1100 Parmer\nln.", $address->getData('street'));
+        $this->assertEquals('Austin', $address->getCity());
+        $this->assertEquals('US', $address->getCountryId());
+        $this->assertEquals('Texas', $address->getRegion());
+        $this->assertEquals('57', $address->getRegionId());
+        $this->assertEquals('78757', $address->getPostcode());
+        $this->assertEquals('(512) 999-9999', $address->getTelephone());
+        $this->assertNull($address->getCustomerAddressId());
+    }
 
-        $model->saveOrder();
+    /**
+     * @magentoAppIsolation enabled
+     */
+    public function testSaveOrder()
+    {
+        $this->_model->saveBilling($this->_getCustomerData(), null);
+        $this->_prepareQuote($this->_getQuote());
+        $this->_model->saveOrder();
 
         /** @var $order \Magento\Sales\Model\Order */
         $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\Sales\Model\Order');
-        $order->loadByIncrementId($model->getLastOrderId());
+        $order->loadByIncrementId($this->_model->getLastOrderId());
 
-        $this->assertNotEmpty($quote->getShippingAddress()->getCustomerAddressId(),
-            'Quote shipping CustomerAddressId should not be ampty');
-        $this->assertNotEmpty($quote->getBillingAddress()->getCustomerAddressId(),
-            'Quote billing CustomerAddressId should not be ampty');
+        $this->assertNotEmpty($this->_model->getQuote()->getShippingAddress()->getCustomerAddressId(),
+            'Quote shipping CustomerAddressId should not be empty');
+        $this->assertNotEmpty($this->_model->getQuote()->getBillingAddress()->getCustomerAddressId(),
+            'Quote billing CustomerAddressId should not be empty');
 
         $this->assertNotEmpty($order->getShippingAddress()->getCustomerAddressId(),
-            'Order shipping CustomerAddressId should not be ampty');
+            'Order shipping CustomerAddressId should not be empty');
         $this->assertNotEmpty($order->getBillingAddress()->getCustomerAddressId(),
-            'Order billing CustomerAddressId should not be ampty');
+            'Order billing CustomerAddressId should not be empty');
     }
 
+    /**
+     * @magentoAppIsolation enabled
+     */
+    public function testInitCheckoutNotLoggedIn()
+    {
+        $this->_model->saveBilling($this->_getCustomerData(), null);
+        $this->_prepareQuote($this->_getQuote());
+        $this->assertTrue($this->_model->getCheckout()->getSteps()['shipping']['allow']);
+        $this->assertTrue($this->_model->getCheckout()->getSteps()['billing']['allow']);
+        $this->_model->initCheckout();
+        $this->assertFalse($this->_model->getCheckout()->getSteps()['shipping']['allow']);
+        $this->assertFalse($this->_model->getCheckout()->getSteps()['billing']['allow']);
+        $this->assertNull($this->_model->getQuote()->getCustomerData()->getEmail());
+    }
 
-    public function saveOrderDataProvider()
+    /**
+     * @magentoAppIsolation enabled
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     */
+    public function testInitCheckoutLoggedIn()
     {
-        return array(
-            array($this->_getCustomerData()),
+        $this->_model->saveBilling($this->_getCustomerData(), null);
+        $this->_prepareQuote($this->_getQuote());
+        $customerIdFromFixture = 1;
+        $emailFromFixture = 'customer@example.com';
+        /** @var $customerSession \Magento\Customer\Model\Session*/
+        $customerSession = Bootstrap::getObjectManager()->create(
+            '\Magento\Customer\Model\Session');
+        /** @var $customerService \Magento\Customer\Service\V1\CustomerService*/
+        $customerService = Bootstrap::getObjectManager()->create('\Magento\Customer\Service\V1\CustomerService');
+        $customerDto = $customerService->getCustomer($customerIdFromFixture);
+        $customerSession->setCustomerData($customerDto);
+        $this->_model = Bootstrap::getObjectManager()->create(
+            'Magento\Checkout\Model\Type\Onepage',
+            ['customerSession' => $customerSession]
         );
+        $this->assertTrue($this->_model->getCheckout()->getSteps()['shipping']['allow']);
+        $this->assertTrue($this->_model->getCheckout()->getSteps()['billing']['allow']);
+        $this->_model->initCheckout();
+        $this->assertFalse($this->_model->getCheckout()->getSteps()['shipping']['allow']);
+        //When the user is logged in and for Step billing - allow is not reset to true
+        $this->assertTrue($this->_model->getCheckout()->getSteps()['billing']['allow']);
+        $this->assertEquals($emailFromFixture, $this->_model->getQuote()->getCustomerData()->getEmail());
+    }
+
+    /**
+     * New customer, the same address should be used for shipping and billing, it should be persisted to DB.
+     *
+     * @magentoAppIsolation enabled
+     * @magentoDbIsolation enabled
+     */
+    public function testSaveBillingSameAsShipping()
+    {
+        $quote = $this->_model->getQuote();
+
+        /** Preconditions */
+        $customerData = $this->_getCustomerData();
+        $customerAddressId = false;
+        $this->assertEquals(1, $customerData['use_for_shipping'], "Precondition failed: use_for_shipping is invalid");
+        $this->assertEquals(
+            1,
+            $customerData['save_in_address_book'],
+            "Precondition failed: save_in_address_book is invalid"
+        );
+        $this->assertEmpty(
+            $quote->getBillingAddress()->getId(),
+            "Precondition failed: billing address must not be initialized."
+        );
+        $this->assertEmpty(
+            $quote->getShippingAddress()->getId(),
+            "Precondition failed: billing address must not be initialized."
+        );
+
+        /** Execute SUT */
+        $result = $this->_model->saveBilling($customerData, $customerAddressId);
+        $this->assertEquals([], $result, 'Return value is invalid');
+
+        /** Ensure that quote addresses were persisted correctly */
+        $billingAddress = $quote->getBillingAddress();
+        $shippingAddress = $quote->getShippingAddress();
+
+        $quoteAddressFieldsToCheck = [
+            'quote_id' => $quote->getId(),
+            'firstname' => 'John',
+            'lastname' => 'Smith',
+            'email' => 'John.Smith@example.com',
+            'street' => '6131 Monterey Rd, Apt 1',
+            'city' => 'Los Angeles',
+            'postcode' => '90042',
+            'country_id' => 'US',
+            'region_id' => '1',
+            'region' => 'Alabama',
+            'telephone' => '(323) 255-5861',
+            'customer_id' => null,
+            'customer_address_id' => null
+        ];
+
+        foreach ($quoteAddressFieldsToCheck as $field => $value) {
+            $this->assertEquals($value, $billingAddress->getData($field), "{$field} value is invalid");
+            $this->assertEquals($value, $shippingAddress->getData($field), "{$field} value is invalid");
+        }
+        $this->assertEquals('1', $shippingAddress->getData('same_as_billing'), "same_as_billing value is invalid");
+        $this->assertGreaterThan(0, $shippingAddress->getData('address_id'), "address_id value is invalid");
+        $this->assertGreaterThan(0, $billingAddress->getData('address_id'), "address_id value is invalid");
+        $this->assertEquals(
+            1,
+            $billingAddress->getData('save_in_address_book'),
+            "save_in_address_book value is invalid"
+        );
+        $this->assertEquals(
+            0,
+            $shippingAddress->getData('save_in_address_book'),
+            "As soon as 'same_as_billing' is set to 1, 'save_in_address_book' of shipping should be 0"
+        );
+
+        /** Ensure that customer-related data was ported to quote correctly */
+        $quoteFieldsToCheck = [
+            'customer_firstname' => 'John',
+            'customer_lastname' => 'Smith',
+            'customer_email' => 'John.Smith@example.com'
+        ];
+        foreach ($quoteFieldsToCheck as $field => $value) {
+            $this->assertEquals($value, $quote->getData($field), "{$field} value is set to quote incorrectly.");
+        }
+
+        /** Perform if checkout steps status was correctly updated in session */
+        /** @var \Magento\Checkout\Model\Session $checkoutSession */
+        $checkoutSession = Bootstrap::getObjectManager()->get('Magento\Checkout\Model\Session');
+        $this->assertTrue($checkoutSession->getStepData('billing', 'allow'), 'Billing step should be allowed.');
+        $this->assertTrue($checkoutSession->getStepData('billing', 'complete'), 'Billing step should be completed.');
+        $this->assertTrue($checkoutSession->getStepData('shipping', 'allow'), 'Shipping step should be allowed.');
+    }
+
+    /**
+     * New customer, billing address should not be used as shipping address, it should be persisted to DB.
+     *
+     * @magentoAppIsolation enabled
+     * @magentoDbIsolation enabled
+     */
+    public function testSaveBilling()
+    {
+        $quote = $this->_model->getQuote();
+
+        /** Preconditions */
+        $customerData = $this->_getCustomerData();
+        $customerData['use_for_shipping'] = 0;
+        $customerAddressId = false;
+        $this->assertEquals(
+            1,
+            $customerData['save_in_address_book'],
+            "Precondition failed: save_in_address_book is invalid"
+        );
+        $this->assertEmpty(
+            $quote->getBillingAddress()->getId(),
+            "Precondition failed: billing address must not be initialized."
+        );
+        $this->assertEmpty(
+            $quote->getShippingAddress()->getId(),
+            "Precondition failed: billing address must not be initialized."
+        );
+
+        /** Execute SUT */
+        $result = $this->_model->saveBilling($customerData, $customerAddressId);
+        $this->assertEquals([], $result, 'Return value is invalid');
+
+        /** Ensure that quote addresses were persisted correctly */
+        $billingAddress = $quote->getBillingAddress();
+        $shippingAddress = $quote->getShippingAddress();
+
+        $quoteAddressFieldsToCheck = [
+            'quote_id' => $quote->getId(),
+            'firstname' => 'John',
+            'lastname' => 'Smith',
+            'email' => 'John.Smith@example.com',
+            'street' => '6131 Monterey Rd, Apt 1',
+            'city' => 'Los Angeles',
+            'postcode' => '90042',
+            'country_id' => 'US',
+            'region_id' => '1',
+            'region' => 'Alabama',
+            'telephone' => '(323) 255-5861',
+            'customer_id' => null,
+            'customer_address_id' => null
+        ];
+
+        foreach ($quoteAddressFieldsToCheck as $field => $value) {
+            $this->assertEquals($value, $billingAddress->getData($field), "{$field} value is invalid");
+        }
+        $this->assertGreaterThan(0, $billingAddress->getData('address_id'), "address_id value is invalid");
+        $this->assertEmpty(
+            $shippingAddress->getData('firstname'),
+            "Shipping address should not be populated with billing address data when 'same_as_billing' is set to 0."
+        );
+        $this->assertEquals(
+            1,
+            $billingAddress->getData('save_in_address_book'),
+            "save_in_address_book value is invalid"
+        );
+
+        /** Ensure that customer-related data was ported to quote correctly */
+        $quoteFieldsToCheck = [
+            'customer_firstname' => 'John',
+            'customer_lastname' => 'Smith',
+            'customer_email' => 'John.Smith@example.com'
+        ];
+        foreach ($quoteFieldsToCheck as $field => $value) {
+            $this->assertEquals($value, $quote->getData($field), "{$field} value is set to quote incorrectly.");
+        }
+
+        /** Perform if checkout steps status was correctly updated in session */
+        /** @var \Magento\Checkout\Model\Session $checkoutSession */
+        $checkoutSession = Bootstrap::getObjectManager()->get('Magento\Checkout\Model\Session');
+        $this->assertTrue($checkoutSession->getStepData('billing', 'allow'), 'Billing step should be allowed.');
+        $this->assertTrue($checkoutSession->getStepData('billing', 'complete'), 'Billing step should be completed.');
+        $this->assertTrue($checkoutSession->getStepData('shipping', 'allow'), 'Shipping step should be allowed.');
+    }
+
+    /**
+     * New address, address data is invalid.
+     */
+    public function testSaveBillingValidationErrorNewAddress()
+    {
+        /** Preconditions */
+        $customerData = $this->_getCustomerData();
+        unset($customerData['firstname']);
+        $customerAddressId = false;
+
+        /** Execute SUT */
+        $result = $this->_model->saveBilling($customerData, $customerAddressId);
+        $validationErrors = [
+            '"First Name" is a required value.',
+            '"First Name" length must be equal or greater than 1 characters.'
+        ];
+        $this->assertEquals(['error' => 1, 'message' => $validationErrors], $result, 'Validation error is invalid.');
+    }
+
+    /**
+     * Existing address, address data is invalid.
+     *
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDataFixture Magento/Customer/_files/customer_address.php
+     */
+    public function testSaveBillingExistingAddressInvalidData()
+    {
+        /** Preconditions */
+        $addressIdFromFixture = 1;
+        $customerIdFromFixture = 1;
+        $customerData = $this->_getCustomerData();
+        unset($customerData['firstname']);
+        $this->_getQuote()->setCustomerId($customerIdFromFixture);
+
+        /** Execute SUT */
+        /**
+         * If customer address is available, provided customer data is not validated,
+         * that's why no error occurs when invalid data is provided
+         */
+        $result = $this->_model->saveBilling($customerData, $addressIdFromFixture);
+        $this->assertEquals([], $result, 'No errors expected.');
+    }
+
+    /**
+     * Address exists, but it does not belong to the current customer which is set to quote.
+     *
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDataFixture Magento/Customer/_files/customer_address.php
+     */
+    public function testSaveBillingInvalidAddressId()
+    {
+        /** Preconditions */
+        $addressIdFromFixture = 1;
+        $customerData = $this->_getCustomerData();
+        unset($customerData['firstname']);
+        /** Any ID can be used, which is not equal to ID of customer to which current address belongs. */
+        $secondCustomerId = 2;
+        $this->_getQuote()->setCustomerId($secondCustomerId);
+
+        /** Execute SUT */
+        $result = $this->_model->saveBilling($customerData, $addressIdFromFixture);
+        $validationErrors = 'The customer address is not valid.';
+        $this->assertEquals(['error' => 1, 'message' => $validationErrors], $result, 'Validation error is invalid.');
+    }
+
+    /**
+     * Empty data.
+     */
+    public function testSaveBillingEmptyData()
+    {
+        /** Execute SUT */
+        $customerData = [];
+        $customerAddressId = false;
+        $result = $this->_model->saveBilling($customerData, $customerAddressId);
+        $this->assertEquals(['error' => -1, 'message' => 'Invalid data'], $result, 'Validation error is invalid.');
+    }
+
+    /**
+     * Address does not exist, but existing email is specified in address data.
+     *
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     */
+    public function testSaveBillingNewAddressErrorExistingEmail()
+    {
+        /** Preconditions */
+        $customerData = $this->_getCustomerData();
+        $fixtureCustomerEmail = 'customer@example.com';
+        $customerData['email'] = $fixtureCustomerEmail;
+        $customerAddressId = false;
+        $this->_getQuote()->setCheckoutMethod(\Magento\Checkout\Model\Type\Onepage::METHOD_REGISTER);
+
+        /** Execute SUT */
+        $result = $this->_model->saveBilling($customerData, $customerAddressId);
+        $this->assertArrayHasKey('message', $result, 'Error message was expected to be set');
+        $this->assertStringStartsWith(
+            'There is already a registered customer using this email address',
+            $result['message'],
+            'Validation error is invalid.'
+        );
+    }
+
+    /**
+     * New address, customer address is invalid (customer validation should fail, not address validation).
+     */
+    public function testSaveBillingInvalidCustomerData()
+    {
+        /** Preconditions */
+        $customerData = $this->_getCustomerData();
+        $customerData['email'] = 'invalidemail';
+        $this->_getQuote()->setCheckoutMethod(\Magento\Checkout\Model\Type\Onepage::METHOD_REGISTER);
+        $customerAddressId = false;
+
+        /** Execute SUT */
+        $result = $this->_model->saveBilling($customerData, $customerAddressId);
+        $validationErrors = '"Email" is not a valid email address.';
+        $this->assertEquals(['error' => -1, 'message' => $validationErrors], $result, 'Validation error is invalid.');
+    }
+
+    /**
+     * @return \Magento\Sales\Model\Quote
+     */
+    protected function _getQuote()
+    {
+        return $this->_currentQuote;
     }
 
     /**
@@ -117,7 +537,8 @@ class OnepageTest extends \PHPUnit_Framework_TestCase
             ),
             'city' => 'Los Angeles',
             'postcode' => '90042',
-            'country_id' => 'AL',
+            'country_id' => 'US',
+            'region_id' => '1',
             'telephone' => '(323) 255-5861',
             'customer_password' => 'password',
             'confirm_password' => 'password',
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/cart.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/cart.php
index bd98f2801ff..8284a60d124 100644
--- a/dev/tests/integration/testsuite/Magento/Checkout/_files/cart.php
+++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/cart.php
@@ -27,8 +27,8 @@
 
 /** @var $objectManager \Magento\TestFramework\ObjectManager */
 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-$objectManager->get('Magento\Core\Model\Registry')->unregister('_singleton/Magento\Checkout\Model\Session');
-$objectManager->get('Magento\Core\Model\Registry')->unregister('_singleton/Magento_Checkout_Model_Cart');
+$objectManager->get('Magento\Registry')->unregister('_singleton/Magento\Checkout\Model\Session');
+$objectManager->get('Magento\Registry')->unregister('_singleton/Magento_Checkout_Model_Cart');
 /** @var $cart \Magento\Checkout\Model\Cart */
 $cart = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Checkout\Model\Cart');
 
@@ -36,6 +36,6 @@ $cart->addProduct($product, $requestInfo);
 $cart->save();
 
 $quoteItemId = $cart->getQuote()->getItemByProduct($product)->getId();
-$objectManager->get('Magento\Core\Model\Registry')->register('product/quoteItemId', $quoteItemId);
-$objectManager->get('Magento\Core\Model\Registry')->unregister('_singleton/Magento\Checkout\Model\Session');
-$objectManager->get('Magento\Core\Model\Registry')->unregister('_singleton/Magento_Checkout_Model_Cart');
+$objectManager->get('Magento\Registry')->register('product/quoteItemId', $quoteItemId);
+$objectManager->get('Magento\Registry')->unregister('_singleton/Magento\Checkout\Model\Session');
+$objectManager->get('Magento\Registry')->unregister('_singleton/Magento_Checkout_Model_Cart');
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_check_payment_rollback.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_check_payment_rollback.php
index 2eaac3a0a4f..c9fa580f7f7 100644
--- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_check_payment_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_check_payment_rollback.php
@@ -26,4 +26,4 @@
 
 /** @var $objectManager \Magento\TestFramework\ObjectManager */
 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-$objectManager->get('Magento\Core\Model\Registry')->unregister('quote');
+$objectManager->get('Magento\Registry')->unregister('quote');
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_product_and_payment.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_product_and_payment.php
index 53ec9c4f022..89f6176c2a5 100644
--- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_product_and_payment.php
+++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_product_and_payment.php
@@ -28,8 +28,7 @@
 require __DIR__ . '/../../../Magento/Catalog/_files/products.php';
 
 /** @var $quote \Magento\Sales\Model\Quote */
-$quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-    ->create('Magento\Sales\Model\Quote');
+$quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Quote');
 $quote->setStoreId(1)
     ->setIsActive(false)
     ->setIsMultiShipping(false)
diff --git a/dev/tests/integration/testsuite/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/DesignTest.php b/dev/tests/integration/testsuite/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/DesignTest.php
index 9d2fc7a9e41..a9db9edaf13 100644
--- a/dev/tests/integration/testsuite/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/DesignTest.php
+++ b/dev/tests/integration/testsuite/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/DesignTest.php
@@ -45,7 +45,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase
             ->setDefaultDesignTheme();
         $objectManager->get('Magento\Config\ScopeInterface')
             ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE);
-        $objectManager->get('Magento\Core\Model\Registry')
+        $objectManager->get('Magento\Registry')
             ->register('cms_page', $objectManager->create('Magento\Cms\Model\Page'));
 
         $block = $objectManager->create('Magento\Cms\Block\Adminhtml\Page\Edit\Tab\Design');
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/MatrixTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/MatrixTest.php
index d41f433468a..f844ec04cdd 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/MatrixTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/MatrixTest.php
@@ -37,7 +37,7 @@ class MatrixTest extends \PHPUnit_Framework_TestCase
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')
+        $objectManager->get('Magento\Registry')
             ->register('current_product', \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\Catalog\Model\Product')->load(1));
         \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface')
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/ConfigTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/ConfigTest.php
index cd2ebf904e7..af3cf4bfeaf 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/ConfigTest.php
@@ -36,7 +36,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')
+        $objectManager->get('Magento\Registry')
             ->register('current_product', $objectManager->create('Magento\Catalog\Model\Product'));
         /** @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Super\Config */
         $block = $objectManager->get('Magento\View\LayoutInterface')
@@ -52,7 +52,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')
+        $objectManager->get('Magento\Registry')
             ->register('current_product', $objectManager->create('Magento\Catalog\Model\Product')->load(1));
         $objectManager->get('Magento\View\LayoutInterface')->createBlock('Magento\View\Element\Text', 'head');
         $usedAttribute = $objectManager->get('Magento\Catalog\Model\Entity\Attribute')->loadByCode(
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/SettingsTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/SettingsTest.php
index 55ebff998eb..90fb50a2286 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/SettingsTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/SettingsTest.php
@@ -50,7 +50,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase
 
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_product', $product);
+        $objectManager->get('Magento\Registry')->register('current_product', $product);
 
         $context = $objectManager->create('Magento\Backend\Block\Template\Context', array('urlBuilder' => $urlModel));
         /** @var $layout \Magento\Core\Model\Layout */
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSetTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSetTest.php
index 38665751654..b6e934f0b09 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSetTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSetTest.php
@@ -42,7 +42,7 @@ class ColumnSetTest
         $product->load(1); // fixture
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_product', $product);
+        $objectManager->get('Magento\Registry')->register('current_product', $product);
 
         /** @var $layout \Magento\Core\Model\Layout */
         $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface');
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/ProductTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/ProductTest.php
index 8586353adb9..0418b7c8835 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/ProductTest.php
@@ -46,7 +46,7 @@ class ProductTest extends \Magento\Backend\Utility\Controller
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
         /** @var $product \Magento\Catalog\Model\Product */
-        $product = $objectManager->get('Magento\Core\Model\Registry')->registry('current_product');
+        $product = $objectManager->get('Magento\Registry')->registry('current_product');
         $this->assertEquals($associatedProductIds, $product->getAssociatedProductIds());
 
         /** @see \Magento\Backend\Utility\Controller::assertPostConditions() */
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Resource/Product/Collection/AssociatedProductTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Resource/Product/Collection/AssociatedProductTest.php
index be4fb0d5f43..314bf90f25f 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Resource/Product/Collection/AssociatedProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Resource/Product/Collection/AssociatedProductTest.php
@@ -38,7 +38,7 @@ class AssociatedProductTest extends \PHPUnit_Framework_TestCase
         $product->setId(10);
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_product', $product);
+        $objectManager->get('Magento\Registry')->register('current_product', $product);
         $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\ConfigurableProduct\Model\Resource\Product\Collection\AssociatedProduct');
         $collectionProduct = $collection->getFirstItem();
@@ -61,7 +61,7 @@ class AssociatedProductTest extends \PHPUnit_Framework_TestCase
         $product->load(1); // fixture
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_product', $product);
+        $objectManager->get('Magento\Registry')->register('current_product', $product);
         $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\ConfigurableProduct\Model\Resource\Product\Collection\AssociatedProduct');
         $this->assertEmpty($collection->count());
diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php
index 0f1cb9dd947..b16e5e1f1f0 100644
--- a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php
+++ b/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php
@@ -51,8 +51,8 @@ class StoreTest extends \PHPUnit_Framework_TestCase
     {
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
         $this->_modelParams = array(
-            'context'                 => $objectManager->get('Magento\Core\Model\Context'),
-            'registry'                => $objectManager->get('Magento\Core\Model\Registry'),
+            'context'                 => $objectManager->get('Magento\Model\Context'),
+            'registry'                => $objectManager->get('Magento\Registry'),
             'coreFileStorageDatabase' => $objectManager->get('Magento\Core\Helper\File\Storage\Database'),
             'configCacheType'         => $objectManager->get('Magento\App\Cache\Type\Config'),
             'url'                     => $objectManager->get('Magento\Url'),
@@ -377,7 +377,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase
 
         $params = $this->_modelParams;
         $params['context'] = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Core\Model\Context', array('appState' => $appStateMock));
+            ->create('Magento\Model\Context', array('appState' => $appStateMock));
 
         $model = $this->getMock('Magento\Core\Model\Store', array('getConfig'), $params);
 
diff --git a/dev/tests/integration/testsuite/Magento/Css/PreProcessor/CacheTest.php b/dev/tests/integration/testsuite/Magento/Css/PreProcessor/CacheTest.php
index 594953b9d68..9147895f214 100644
--- a/dev/tests/integration/testsuite/Magento/Css/PreProcessor/CacheTest.php
+++ b/dev/tests/integration/testsuite/Magento/Css/PreProcessor/CacheTest.php
@@ -24,37 +24,31 @@
 
 namespace Magento\Css\PreProcessor;
 
+use \Magento\Css\PreProcessor\Cache\Import\Cache;
+use \Magento\Css\PreProcessor\Cache\Import\Map\Storage;
+
 class CacheTest extends \PHPUnit_Framework_TestCase
 {
     /**
-     * @var \Magento\Css\PreProcessor\Less
+     * @var \Magento\ObjectManager
      */
-    protected $model;
+    protected $objectManager;
 
     /**
-     * @var \Magento\Css\PreProcessor\Cache\CacheManagerFactory
+     * @var \Magento\Css\PreProcessor\Less
      */
-    protected $cacheManagerFactory;
+    protected $preProcessorLess;
 
     /**
-     * @var \Magento\App\Filesystem
+     * @var \Magento\Filesystem
      */
     protected $filesystem;
 
-    /**
-     * @var \Magento\View\Service
-     */
-    protected $viewService;
-
     public function setUp()
     {
-        $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $this->model = $objectManager->create('Magento\Css\PreProcessor\Less');
-        $this->cacheManagerFactory = $objectManager->create('Magento\Css\PreProcessor\Cache\CacheManagerFactory');
-        $this->filesystem = $objectManager->get('Magento\Filesystem');
-        $this->viewService = $objectManager->get('Magento\View\Service');
-
-        $this->clearCache();
+        $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+        $this->preProcessorLess = $this->objectManager->create('Magento\Css\PreProcessor\Less');
+        $this->filesystem = $this->objectManager->get('Magento\Filesystem');
 
         \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array(
             \Magento\App\Filesystem::PARAM_APP_DIRS => array(
@@ -63,6 +57,8 @@ class CacheTest extends \PHPUnit_Framework_TestCase
                 ),
             )
         ));
+
+        $this->clearCache();
     }
 
     protected function tearDown()
@@ -70,30 +66,37 @@ class CacheTest extends \PHPUnit_Framework_TestCase
         $this->clearCache();
     }
 
-    public function testProcess()
+    public function testLessCache()
     {
-        $sourceFilePath = 'oyejorge.less';
+        $file = $this->objectManager->create('Magento\View\Publisher\CssFile',
+            [
+                'filePath' => 'oyejorge.css',
+                'allowDuplication' => false,
+                'viewParams' => $this->getDesignParams()
+            ]
+        );
 
-        $designParams = $this->getDesignParams();
         $targetDirectory = $this->filesystem->getDirectoryWrite(\Magento\App\Filesystem::TMP_DIR);
 
         /**
-         * cache was not initialize yet and will return empty value
+         * cache was not initialize yet and return empty value
          *
          * @var \Magento\Css\PreProcessor\Cache\CacheManager $cacheManagerEmpty
          */
-        $cacheManagerEmpty = $this->cacheManagerFactory->create($sourceFilePath, $designParams);
-        $this->assertEmpty($cacheManagerEmpty->getCachedFile());
+        $emptyCache = $this->objectManager->create('Magento\Css\PreProcessor\Cache\CacheManager');
+        $emptyCache->initializeCacheByType(Cache::IMPORT_CACHE, $file);
+        $this->assertEmpty($emptyCache->getCachedFile(Cache::IMPORT_CACHE));
 
-        $this->model->process($sourceFilePath, $designParams, $targetDirectory);
+        $this->preProcessorLess->process($file, $targetDirectory);
 
         /**
-         * cache initialized and will return cached file
+         * cache initialized and return cached file
          *
          * @var \Magento\Css\PreProcessor\Cache\CacheManager $cacheManagerGenerated
          */
-        $cacheManagerGenerated = $this->cacheManagerFactory->create($sourceFilePath, $designParams);
-        $this->assertNotEmpty($cacheManagerGenerated->getCachedFile());
+        $generatedCache = $this->objectManager->create('Magento\Css\PreProcessor\Cache\CacheManager');
+        $generatedCache->initializeCacheByType(Cache::IMPORT_CACHE, $file);
+        $this->assertNotEmpty($generatedCache->getCachedFile(Cache::IMPORT_CACHE));
     }
 
     /**
@@ -102,8 +105,8 @@ class CacheTest extends \PHPUnit_Framework_TestCase
     protected function getDesignParams()
     {
         $designParams = ['area' => 'frontend'];
-        /** @var \Magento\View\Service $viewService */
-        $this->viewService->updateDesignParams($designParams);
+        $viewService = $this->objectManager->get('Magento\View\Service');
+        $viewService->updateDesignParams($designParams);
 
         return $designParams;
     }
@@ -116,8 +119,8 @@ class CacheTest extends \PHPUnit_Framework_TestCase
         /** @var \Magento\Filesystem\Directory\WriteInterface $mapsDirectory */
         $mapsDirectory = $this->filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR);
 
-        if ($mapsDirectory->isDirectory(\Magento\Css\PreProcessor\Cache\Import\Map\Storage::MAPS_DIR)) {
-            $mapsDirectory->delete(\Magento\Css\PreProcessor\Cache\Import\Map\Storage::MAPS_DIR);
+        if ($mapsDirectory->isDirectory(Storage::MAPS_DIR)) {
+            $mapsDirectory->delete(Storage::MAPS_DIR);
         }
         return $this;
     }
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/AccordionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/AccordionTest.php
index 6f392f4b9fe..f1a66c88fdd 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/AccordionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/AccordionTest.php
@@ -46,7 +46,7 @@ class AccordionTest extends \PHPUnit_Framework_TestCase
         $customer->load(1);
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_customer', $customer);
+        $objectManager->get('Magento\Registry')->register('current_customer', $customer);
         /** @var $layout \Magento\View\LayoutInterface */
         $layout = $objectManager->create(
             'Magento\Core\Model\Layout',
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/ViewTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/ViewTest.php
index 38f87244eb8..1e595e19550 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/ViewTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/ViewTest.php
@@ -38,7 +38,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase
     /** @var  \Magento\Backend\Block\Template\Context */
     private $_context;
 
-    /** @var  \Magento\Core\Model\Registry */
+    /** @var  \Magento\Registry */
     private $_coreRegistry;
 
     /** @var  \Magento\Customer\Model\CustomerFactory */
@@ -65,7 +65,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase
             );
 
         $this->_customerFactory = $objectManager->get('Magento\Customer\Model\CustomerFactory');
-        $this->_coreRegistry = $objectManager->get('Magento\Core\Model\Registry');
+        $this->_coreRegistry = $objectManager->get('Magento\Registry');
         $this->_groupService = $objectManager->get('Magento\Customer\Service\V1\CustomerGroupServiceInterface');
 
         $this->_block = $objectManager->get('Magento\View\LayoutInterface')
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/Edit/FormTest.php
index 72ef77af71d..ba37a908919 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/Edit/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/Edit/FormTest.php
@@ -44,7 +44,7 @@ class FormTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Customer\Service\V1\CustomerGroupService */
     private $customerGroupService;
 
-    /** @var \Magento\Core\Model\Registry */
+    /** @var \Magento\Registry */
     private $registry;
 
     public function setUp()
@@ -58,7 +58,7 @@ class FormTest extends \PHPUnit_Framework_TestCase
             'Magento\Customer\Service\V1\CustomerGroupServiceInterface'
         );
 
-        $this->registry = Bootstrap::getObjectManager()->get('Magento\Core\Model\Registry');
+        $this->registry = Bootstrap::getObjectManager()->get('Magento\Registry');
     }
 
     public function tearDown()
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/EditTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/EditTest.php
index 1ab477419fe..5634fe2367e 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/EditTest.php
@@ -45,7 +45,7 @@ class EditTest extends AbstractController
     /** @var \Magento\Customer\Service\V1\CustomerGroupService */
     private $customerGroupService;
 
-    /** @var \Magento\Core\Model\Registry */
+    /** @var \Magento\Registry */
     private $registry;
 
     public function setUp()
@@ -59,7 +59,7 @@ class EditTest extends AbstractController
             'Magento\Customer\Service\V1\CustomerGroupService'
         );
 
-        $this->registry = Bootstrap::getObjectManager()->get('Magento\Core\Model\Registry');
+        $this->registry = Bootstrap::getObjectManager()->get('Magento\Registry');
     }
 
     public function tearDown()
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
index 2df3308bd73..36ab3a4d058 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
@@ -183,7 +183,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller
         /**
          * Check that customer id set and addresses saved
          */
-        $registry = $objectManager->get('Magento\Core\Model\Registry');
+        $registry = $objectManager->get('Magento\Registry');
         $customer = $registry->registry('current_customer');
         $this->assertInstanceOf('Magento\Customer\Model\Customer', $customer);
         $this->assertCount(1, $customer->getAddressesCollection());
@@ -259,7 +259,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller
         /**
          * Check that customer id set and addresses saved
          */
-        $customer = $objectManager->get('Magento\Core\Model\Registry')->registry('current_customer');
+        $customer = $objectManager->get('Magento\Registry')->registry('current_customer');
         $this->assertInstanceOf('Magento\Customer\Model\Customer', $customer);
 
         /**
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormFactoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormFactoryTest.php
index 45d967aedba..826a999f1f6 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormFactoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormFactoryTest.php
@@ -58,6 +58,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
         ];
 
         $this->_expectedData = $this->_requestData;
+        $this->_expectedData['street'] = trim(implode("\n", $this->_expectedData['street']));
 
         unset($this->_expectedData['id']);
         unset($this->_expectedData['default_shipping']);
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormTest.php
index 19b6d62e066..756b069b8d2 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormTest.php
@@ -117,6 +117,7 @@ class FormTest extends \PHPUnit_Framework_TestCase
 
     public function testRestoreData()
     {
+        $this->_expected['street'] = trim(implode("\n", $this->_expected['street']));
         $attributeValues = $this->_form->restoreData($this->_form->extractData($this->_request));
         $this->assertEquals($this->_expected, $attributeValues);
     }
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php
index c98f4ad6ee2..e17322b21d1 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php
@@ -80,7 +80,6 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase
             ->setLastname('Smith');
         $address = $this->_addressBuilder->create();
 
-        /* XXX: would it be better to have a clear method for this? */
         $this->_addressBuilder->setId(2)
             ->setCountryId('US')
             ->setCustomerId(1)
@@ -253,7 +252,8 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase
             'rp_token' => $resetToken,
             'rp_token_created_at' => '1970-01-01',
         ]));
-        $this->_customerService->saveCustomer($this->_customerBuilder->create());
+        $customerData = $this->_customerBuilder->create();
+        $this->_customerService->saveCustomer($customerData);
 
         $this->_service->validateResetPasswordLinkToken(1, $resetToken);
     }
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php
index d65bdb8d28e..76d88d7c03c 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php
@@ -1,7 +1,5 @@
 <?php
 /**
- * Integration test for service layer \Magento\Customer\Service\V1\CustomerAddressService
- *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -25,11 +23,13 @@
  */
 namespace Magento\Customer\Service\V1;
 
-use Magento\Customer\Service\V1;
 use Magento\Exception\InputException;
 use Magento\Exception\NoSuchEntityException;
+use Magento\Customer\Service\V1;
 
 /**
+ * Integration test for service layer \Magento\Customer\Service\V1\CustomerAddressService
+ *
  * @SuppressWarnings(PHPMD.TooManyMethods)
  * @SuppressWarnings(PHPMD.ExcessivePublicCount)
  */
@@ -263,8 +263,16 @@ class CustomerAddressServiceTest extends \PHPUnit_Framework_TestCase
 
         $addresses = $this->_service->getAddresses($customerId);
         $this->assertNotEquals($proposedAddress->getAttributes(), $addresses[1]->getAttributes());
-        $this->assertArrayHasKey('weird', $proposedAddress->getAttributes());
-        $this->assertArrayNotHasKey('weird', $addresses[1]->getAttributes());
+        $this->assertArrayNotHasKey(
+            'weird',
+            $proposedAddress->getAttributes(),
+            'Only valid attributes should be available.'
+        );
+        $this->assertArrayNotHasKey(
+            'weird',
+            $addresses[1]->getAttributes(),
+            'Only valid attributes should be available.'
+        );
     }
 
     /**
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php
index 1fce688c7d9..919ce30f98c 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php
@@ -74,17 +74,14 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
     public function testGetCustomerAttributeMetadata()
     {
         // Expect these attributes to exist but do not check the value
-        $expectAttrsWOutVals = array('updated_at', 'created_at', 'password_hash');
+        $expectAttrsWOutVals = array('created_at');
 
         // Expect these attributes to exist and check the value - values come from _files/customer.php
         $expectAttrsWithVals = array(
-            'entity_id'                 => '1',
-            'entity_type_id'            => '1',
-            'attribute_set_id'          => '1',
+            'id'                        => '1',
             'website_id'                => '1',
             'store_id'                  => '1',
             'group_id'                  => '1',
-            'disable_auto_group_change' => '0',
             'firstname'                 => 'Firstname',
             'lastname'                  => 'Lastname',
             'email'                     => 'customer@example.com',
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerServiceTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerServiceTest.php
index 36cc56b7245..107d74fd01d 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerServiceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerServiceTest.php
@@ -23,7 +23,6 @@
  */
 namespace Magento\Customer\Service\V1;
 
-use Magento\Customer\Service\V1;
 use Magento\Exception\InputException;
 use Magento\Exception\NoSuchEntityException;
 
@@ -41,6 +40,9 @@ class CustomerServiceTest extends \PHPUnit_Framework_TestCase
     /** @var CustomerAccountServiceInterface Needed for password checking */
     private $_accountService;
 
+    /** @var CustomerAddressServiceInterface Needed for verifying if addresses are deleted */
+    private $_addressService;
+
     /** @var \Magento\ObjectManager */
     private $_objectManager;
 
@@ -59,6 +61,8 @@ class CustomerServiceTest extends \PHPUnit_Framework_TestCase
         $this->_service = $this->_objectManager->create('Magento\Customer\Service\V1\CustomerServiceInterface');
         $this->_accountService = $this->_objectManager
             ->create('Magento\Customer\Service\V1\CustomerAccountServiceInterface');
+        $this->_addressService = $this->_objectManager
+            ->create('Magento\Customer\Service\V1\CustomerAddressServiceInterface');
 
         $this->_addressBuilder = $this->_objectManager->create('Magento\Customer\Service\V1\Dto\AddressBuilder');
         $this->_customerBuilder = $this->_objectManager->create('Magento\Customer\Service\V1\Dto\CustomerBuilder');
@@ -69,7 +73,7 @@ class CustomerServiceTest extends \PHPUnit_Framework_TestCase
             ->setDefaultBilling(true)
             ->setDefaultShipping(true)
             ->setPostcode('75477')
-            ->setRegion(new V1\Dto\Region([
+            ->setRegion(new Dto\Region([
                 'region_code' => 'AL',
                 'region' => 'Alabama',
                 'region_id' => 1
@@ -88,7 +92,7 @@ class CustomerServiceTest extends \PHPUnit_Framework_TestCase
             ->setDefaultBilling(false)
             ->setDefaultShipping(false)
             ->setPostcode('47676')
-            ->setRegion(new V1\Dto\Region([
+            ->setRegion(new Dto\Region([
                 'region_code' => 'AL',
                 'region' => 'Alabama',
                 'region_id' => 1
@@ -214,17 +218,16 @@ class CustomerServiceTest extends \PHPUnit_Framework_TestCase
         $inBeforeOnly = array_diff_assoc($attributesBefore, $attributesAfter);
         $inAfterOnly = array_diff_assoc($attributesAfter, $attributesBefore);
         $expectedInBefore = array(
+            'email',
             'firstname',
             'lastname',
-            'email',
-            'password_hash',
         );
         $this->assertEquals($expectedInBefore, array_keys($inBeforeOnly));
         $this->assertContains('created_in', array_keys($inAfterOnly));
         $this->assertContains('firstname', array_keys($inAfterOnly));
         $this->assertContains('lastname', array_keys($inAfterOnly));
         $this->assertContains('email', array_keys($inAfterOnly));
-        $this->assertContains('password_hash', array_keys($inAfterOnly));
+        $this->assertNotContains('password_hash', array_keys($inAfterOnly));
     }
 
     /**
@@ -442,23 +445,21 @@ class CustomerServiceTest extends \PHPUnit_Framework_TestCase
         $inBeforeOnly = array_diff_assoc($attributesBefore, $attributesAfter);
         $inAfterOnly = array_diff_assoc($attributesAfter, $attributesBefore);
         $expectedInBefore = array(
-            'firstname',
-            'lastname',
             'email',
-            'entity_id',
-            'password_hash',
+            'firstname',
+            'id',
+            'lastname'
         );
         sort($expectedInBefore);
         $actualInBeforeOnly = array_keys($inBeforeOnly);
         sort($actualInBeforeOnly);
         $this->assertEquals($expectedInBefore, $actualInBeforeOnly);
         $expectedInAfter = array(
+            'created_in',
+            'email',
             'firstname',
+            'id',
             'lastname',
-            'email',
-            'entity_id',
-            'created_in',
-            'password_hash',
         );
         sort($expectedInAfter);
         $actualInAfterOnly = array_keys($inAfterOnly);
@@ -502,8 +503,8 @@ class CustomerServiceTest extends \PHPUnit_Framework_TestCase
         $this->assertNotNull($customerId);
         $savedCustomer = $this->_service->getCustomer($customerId);
         $dataInService = $savedCustomer->getAttributes();
-        $expectedDifferences = ['created_at', 'updated_at', 'email', 'is_active', 'entity_id', 'password_hash',
-            'attribute_set_id', 'confirmation'];
+        $expectedDifferences = ['created_at', 'updated_at', 'email', 'is_active', 'entity_id', 'entity_type_id',
+            'password_hash', 'attribute_set_id', 'disable_auto_group_change', 'confirmation'];
         foreach ($dataInModel as $key => $value) {
             if (!in_array($key, $expectedDifferences)) {
                 if (is_null($value)) {
@@ -513,12 +514,10 @@ class CustomerServiceTest extends \PHPUnit_Framework_TestCase
                 }
             }
         }
-        $this->assertArrayNotHasKey('is_active', $dataInService);
-        $this->assertNotNull($dataInService['created_at']);
-        $this->assertNotNull($dataInService['updated_at']);
-        $this->assertNotNull($dataInService['entity_id']);
-        $this->assertNotNull($dataInService['password_hash']);
         $this->assertEquals($email2, $dataInService['email']);
+        $this->assertArrayNotHasKey('is_active', $dataInService);
+        $this->assertArrayNotHasKey('updated_at', $dataInService);
+        $this->assertArrayNotHasKey('password_hash', $dataInService);
     }
 
     /**
@@ -613,6 +612,73 @@ class CustomerServiceTest extends \PHPUnit_Framework_TestCase
         $this->assertNull($customer->getAttribute('rp_token'));
     }
 
+    /**
+     * @magentoAppArea adminhtml
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoAppIsolation enabled
+     * @expectedException \Magento\Exception\NoSuchEntityException
+     * @expectedExceptionMessage No such entity with customerId = 1
+     */
+    public function testDeleteCustomer()
+    {
+        // _files/customer.php sets the customer id to 1
+        $this->_service->deleteCustomer(1);
+        $this->_service->getCustomer(1);
+    }
+
+    /**
+     *
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
+     * @expectedException \Magento\Exception\NoSuchEntityException
+     * @expectedExceptionMessage No such entity with customerId = 1
+     */
+    public function testDeleteCustomerWithAddress()
+    {
+        $this->markTestSkipped('Investigate how to ensure that addresses are deleted. Currently it is false negative');
+        //Verify address is created for the customer;
+        $result = $this->_addressService->getAddresses(1);
+        $this->assertEquals(2, count($result));
+        // _files/customer.php sets the customer id to 1
+        $this->_service->deleteCustomer(1);
+
+        // Verify by directly loading the address by id
+        $this->verifyDeletedAddress(1);
+        $this->verifyDeletedAddress(2);
+
+        //Verify by calling the Address Service. This will throw the expected exception since customerId doesn't exist
+        $result = $this->_addressService->getAddresses(1);
+        $this->assertTrue(empty($result));
+    }
+
+    /**
+     * Check if the Address with the give addressid is deleted
+     *
+     * @param int $addressId
+     */
+    protected function verifyDeletedAddress($addressId)
+    {
+        /** @var $addressFactory \Magento\Customer\Model\AddressFactory */
+        $addressFactory = $this->_objectManager
+            ->create('Magento\Customer\Model\AddressFactory');
+        $addressModel = $addressFactory->create()->load($addressId);
+        $addressData = $addressModel->getData();
+        $this->assertTrue(empty($addressData));
+    }
+
+    /**
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoAppIsolation enabled
+     * @expectedException
+     * V1\Exception
+     * @expectedExceptionMessage Cannot complete this operation from non-admin area.
+     */
+    public function testDeleteCustomerNonSecureArea()
+    {
+        /** _files/customer.php sets the customer id to 1 */
+        $this->_service->deleteCustomer(1);
+    }
+
     /**
      * @magentoDbIsolation enabled
      */
@@ -641,4 +707,40 @@ class CustomerServiceTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('Tested', $customer->getFirstname());
         $this->assertEquals($lastname, $customer->getLastname());
     }
+
+    /**
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     */
+    public function testGetCustomerByEmail()
+    {
+        $websiteId = 1;
+        /** _files/customer.php sets the customer with id = 1 and email = customer@example.com */
+        $customer = $this->_service->getCustomerByEmail('customer@example.com', $websiteId);
+        $this->assertEquals(1, $customer->getCustomerId());
+    }
+
+    /**
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @expectedException \Magento\Core\Exception
+     * @expectedExceptionMessage Customer website ID must be specified when using the website scope
+     */
+    public function testGetCustomerByEmailNoWebsiteSpecified()
+    {
+        /** _files/customer.php sets the customer with id = 1 and email = customer@example.com */
+        $this->_service->getCustomerByEmail('customer@example.com');
+    }
+
+    /**
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @expectedException \Magento\Exception\NoSuchEntityException
+     * @expectedExceptionMessage No such entity with email = nonexistent@example.com
+     */
+    public function testGetCustomerByEmailNonExistentEmail()
+    {
+        $websiteId = 1;
+        /** _files/customer.php sets the customer with id = 1 and email = customer@example.com */
+        $customer = $this->_service->getCustomerByEmail('nonexistent@example.com', $websiteId);
+        assertEquals(null, $customer->getCustomerId());
+    }
 }
+
diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_address.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_address.php
index af41246a765..245ceafbf93 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_address.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_address.php
@@ -28,7 +28,7 @@
 $customerAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
     ->create('Magento\Customer\Model\Address');
 $customerAddress->isObjectNew(true);
-$customerAddress->setCustomerId(1)
+$customerAddress
     ->setData(array(
         'entity_id' => 1,
         'attribute_set_id' => 2,
@@ -41,5 +41,6 @@ $customerAddress->setCustomerId(1)
         'firstname' => 'John',
         'parent_id' => 1,
         'region_id' => 1
-    ));
+    ))
+    ->setCustomerId(1);
 $customerAddress->save();
diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_two_addresses.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_two_addresses.php
index 5ac194c7aec..2e423c7ae07 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_two_addresses.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_two_addresses.php
@@ -30,7 +30,7 @@ require 'customer_address.php';
 $customerAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
     ->create('Magento\Customer\Model\Address');
 $customerAddress->isObjectNew(true);
-$customerAddress->setCustomerId(1)
+$customerAddress
     ->setData(array(
         'entity_id' => 2,
         'attribute_set_id' => 2,
@@ -43,5 +43,6 @@ $customerAddress->setCustomerId(1)
         'firstname' => 'John',
         'parent_id' => 1,
         'region_id' => 1
-    ));
+    ))
+    ->setCustomerId(1);
 $customerAddress->save();
diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php
index ad0565912d7..96d6c2ef46c 100644
--- a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php
+++ b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php
@@ -67,7 +67,7 @@ class LinksTest
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')
+        $objectManager->get('Magento\Registry')
             ->register('product', new \Magento\Object(array('type_id' => 'simple')));
         $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface')
             ->createBlock('Magento\Downloadable\Block\Adminhtml\Catalog\Product\Edit\Tab\Downloadable\Links');
@@ -90,7 +90,7 @@ class LinksTest
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('product', new \Magento\Object(array(
+        $objectManager->get('Magento\Registry')->register('product', new \Magento\Object(array(
             'type_id' => $productType,
             'id' => '1',
             'links_title' => $linksTitle
diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php
index 2754a6f4eb0..e805d42d4a0 100644
--- a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php
@@ -45,7 +45,7 @@ class SamplesTest
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')
+        $objectManager->get('Magento\Registry')
             ->register('current_product', new \Magento\Object(array('type_id' => 'simple')));
         $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface')
             ->createBlock('Magento\Downloadable\Block\Adminhtml\Catalog\Product\Edit\Tab\Downloadable\Samples');
@@ -67,7 +67,7 @@ class SamplesTest
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_product', new \Magento\Object(array(
+        $objectManager->get('Magento\Registry')->register('current_product', new \Magento\Object(array(
             'type_id' => $productType,
             'id' => '1',
             'samples_title' => $samplesTitle
diff --git a/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php
index c2cfe40fc95..a5ff7ec651f 100644
--- a/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php
@@ -49,13 +49,13 @@ class AbstractTest
             ->getEntityType('customer');
         $model = $objectManager->create('Magento\Customer\Model\Attribute');
         $model->setEntityTypeId($entityType->getId());
-        $objectManager->get('Magento\Core\Model\Registry')->register('entity_attribute', $model);
+        $objectManager->get('Magento\Registry')->register('entity_attribute', $model);
 
         $block = $this->getMockForAbstractClass(
             'Magento\Eav\Block\Adminhtml\Attribute\Edit\Main\AbstractMain',
             array(
                 $objectManager->get('Magento\Backend\Block\Template\Context'),
-                $objectManager->get('Magento\Core\Model\Registry'),
+                $objectManager->get('Magento\Registry'),
                 $objectManager->get('Magento\Data\FormFactory'),
                 $objectManager->get('Magento\Eav\Helper\Data'),
                 $objectManager->get('Magento\Backend\Model\Config\Source\YesnoFactory'),
diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php
index 17e2c6923cb..370b41e89f5 100644
--- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php
@@ -48,9 +48,9 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
         $this->_model = $this->getMockBuilder('Magento\Email\Model\Template')
             ->setMethods(array('_getMail'))
             ->setConstructorArgs(array(
-                $objectManager->get('Magento\Core\Model\Context'),
+                $objectManager->get('Magento\Model\Context'),
                 $objectManager->get('Magento\View\DesignInterface'),
-                $objectManager->get('Magento\Core\Model\Registry'),
+                $objectManager->get('Magento\Registry'),
                 $objectManager->get('Magento\Core\Model\App\Emulation'),
                 $objectManager->get('Magento\Core\Model\StoreManager'),
                 $objectManager->create('Magento\App\Filesystem'),
@@ -174,79 +174,13 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
         $this->assertStringEndsWith($expectedViewUrl, $this->_model->getProcessedTemplateSubject(array()));
     }
 
-    /**
-     * @covers \Magento\Email\Model\Template::send
-     * @covers \Magento\Email\Model\Template::addBcc
-     * @covers \Magento\Email\Model\Template::setReturnPath
-     * @covers \Magento\Email\Model\Template::setReplyTo
-     */
-    public function testSend()
-    {
-        \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')
-            ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load();
-        $this->_mail->expects($this->exactly(2))->method('send');
-        $this->_mail->expects($this->once())->method('addBcc')->with('bcc@example.com');
-        $this->_mail->expects($this->once())->method('setReturnPath')->with('return@example.com');
-        $this->_mail->expects($this->once())->method('setReplyTo')->with('replyto@example.com');
-
-        $this->_model->addBcc('bcc@example.com')
-            ->setReturnPath('return@example.com')
-            ->setReplyTo('replyto@example.com')
-        ;
-        $this->assertNull($this->_model->getSendingException());
-        $this->assertTrue($this->_model->send('test@example.com'));
-        $this->assertNull($this->_model->getSendingException());
-
-        // send once again to make sure bcc, return path and reply-to were not invoked second time
-        $this->assertTrue($this->_model->send('test@example.com'));
-    }
-
-    public function testSendMultipleRecipients()
-    {
-        \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')
-            ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load();
-        $this->_mail->expects($this->at(0))->method('addTo')->with('one@example.com', '=?utf-8?B?TmFtZSBPbmU=?=');
-        $this->_mail->expects($this->at(1))->method('addTo')->with('two@example.com', '=?utf-8?B?dHdv?=');
-        $this->assertTrue($this->_model->send(array('one@example.com', 'two@example.com'), array('Name One')));
-    }
-
-    public function testSendFailure()
-    {
-        $exception = new \Exception('test');
-        $this->_mail->expects($this->once())->method('send')->will($this->throwException($exception));
-
-        $this->assertNull($this->_model->getSendingException());
-        $this->assertFalse($this->_model->send('test@example.com'));
-        $this->assertSame($exception, $this->_model->getSendingException());
-    }
-
-    public function testSendTransactional()
-    {
-        \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')
-            ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load();
-        $this->_model->sendTransactional('customer_create_account_email_template',
-            array('name' => 'Sender Name', 'email' => 'sender@example.com'), 'recipient@example.com', 'Recipient Name'
-        );
-        $this->assertEquals('customer_create_account_email_template', $this->_model->getId());
-        $this->assertTrue($this->_model->getSentSuccess());
-    }
-
-    /**
-     * @expectedException \UnexpectedValueException
-     * @expectedExceptionMessage Email template 'wrong_id' is not defined
-     */
-    public function testSendTransactionalWrongId()
-    {
-        $this->_model->sendTransactional('wrong_id',
-            array('name' => 'Sender Name', 'email' => 'sender@example.com'), 'recipient@example.com', 'Recipient Name'
-        );
-    }
-
     /**
      * @magentoAppIsolation enabled
      */
     public function testGetDefaultEmailLogo()
     {
+        \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')
+            ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load();
         $this->assertStringEndsWith(
             'static/frontend/magento_plushe/en_US/Magento_Email/logo_email.gif',
             $this->_model->getDefaultEmailLogo()
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollectionTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollectionTest.php
index ec54e2dd8ab..596e2592daa 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollectionTest.php
@@ -39,7 +39,7 @@ class AssociatedProductsCollectionTest
         $product->load(9);
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_product', $product);
+        $objectManager->get('Magento\Registry')->register('current_product', $product);
 
         /** @var \Magento\GroupedProduct\Model\Resource\Product\Type\Grouped\AssociatedProductsCollection $collection */
         $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Image/Adapter/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Image/Adapter/ConfigTest.php
similarity index 91%
rename from dev/tests/integration/testsuite/Magento/Core/Model/Image/Adapter/ConfigTest.php
rename to dev/tests/integration/testsuite/Magento/Image/Adapter/ConfigTest.php
index adae2668e98..c6479d8c717 100644
--- a/dev/tests/integration/testsuite/Magento/Core/Model/Image/Adapter/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Image/Adapter/ConfigTest.php
@@ -21,7 +21,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Core\Model\Image\Adapter;
+namespace Magento\Image\Adapter;
 
 class ConfigTest extends \PHPUnit_Framework_TestCase
 {
@@ -29,7 +29,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
     {
         /** @var Config $config */
         $config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Core\Model\Image\Adapter\Config');
+            ->create('Magento\Image\Adapter\Config');
         $this->assertEquals(\Magento\Image\Adapter\AdapterInterface::ADAPTER_GD2, $config->getAdapterAlias());
     }
 }
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php
index 6a9b64d4263..5e7f0b1c94c 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php
@@ -101,7 +101,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
 
         // Get addresses
         /** @var $customers \Magento\Customer\Model\Customer[] */
-        $customers = $objectManager->get('Magento\Core\Model\Registry')
+        $customers = $objectManager->get('Magento\Registry')
             ->registry('_fixture/Magento_ImportExport_Customers_Array');
         foreach ($customers as $customer) {
             /** @var $address \Magento\Customer\Model\Address */
@@ -174,7 +174,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
 
         // Get expected address count
         /** @var $customers \Magento\Customer\Model\Customer[] */
-        $customers = $objectManager->get('Magento\Core\Model\Registry')
+        $customers = $objectManager->get('Magento\Registry')
             ->registry('_fixture/Magento_ImportExport_Customers_Array');
         $expectedCount = 0;
         foreach ($customers as $customer) {
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php
index 06588a9e429..2ed8edf9960 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php
@@ -78,7 +78,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
         /** @var $customers \Magento\Customer\Model\Customer[] */
-        $customers = $objectManager->get('Magento\Core\Model\Registry')
+        $customers = $objectManager->get('Magento\Registry')
             ->registry('_fixture/Magento_ImportExport_Customer_Collection');
         foreach ($customers as $key => $customer) {
             foreach ($expectedAttributes as $code) {
@@ -168,7 +168,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
         /**
          * Change created_at date of first customer for future filter test.
          */
-        $customers = $objectManager->get('Magento\Core\Model\Registry')
+        $customers = $objectManager->get('Magento\Registry')
             ->registry('_fixture/Magento_ImportExport_Customer_Collection');
         $customers[0]->setCreatedAt($createdAtDate);
         $customers[0]->save();
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php
index cedf1ffa82e..9e12004760f 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php
@@ -151,7 +151,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
         // get addressed from fixture
-        $customers = $objectManager->get('Magento\Core\Model\Registry')->registry($this->_fixtureKey);
+        $customers = $objectManager->get('Magento\Registry')->registry($this->_fixtureKey);
         $correctAddresses = array();
         /** @var $customer \Magento\Customer\Model\Customer */
         foreach ($customers as $customer) {
@@ -222,7 +222,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
-        $customers = $objectManager->get('Magento\Core\Model\Registry')->registry($this->_fixtureKey);
+        $customers = $objectManager->get('Magento\Registry')->registry($this->_fixtureKey);
         /** @var $customer \Magento\Customer\Model\Customer */
         $customer = reset($customers);
         $customerId = $customer->getId();
@@ -309,7 +309,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
         // get not default address
-        $customers = $objectManager->get('Magento\Core\Model\Registry')->registry($this->_fixtureKey);
+        $customers = $objectManager->get('Magento\Registry')->registry($this->_fixtureKey);
         /** @var $notDefaultAddress \Magento\Customer\Model\Address */
         $notDefaultAddress = null;
         /** @var $addressCustomer \Magento\Customer\Model\Customer */
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php
index bcf8b3321e5..45096e5742a 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php
@@ -106,7 +106,7 @@ class CustomerImportTest extends \PHPUnit_Framework_TestCase
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
-        $existingCustomer = $objectManager->get('Magento\Core\Model\Registry')
+        $existingCustomer = $objectManager->get('Magento\Registry')
             ->registry('_fixture/Magento_ImportExport_Customer');
 
         $updatedCustomer = $customers[$existingCustomer->getId()];
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Resource/Import/DataTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Resource/Import/DataTest.php
index 1802a7ea506..857da55577e 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Resource/Import/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Resource/Import/DataTest.php
@@ -55,7 +55,7 @@ class DataTest extends \PHPUnit_Framework_TestCase
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
-        $expectedBunches = $objectManager->get('Magento\Core\Model\Registry')
+        $expectedBunches = $objectManager->get('Magento\Registry')
             ->registry('_fixture/Magento_ImportExport_Import_Data');
 
         $this->assertEquals($expectedBunches[0]['entity'], $this->_model->getUniqueColumnData('entity'));
@@ -79,7 +79,7 @@ class DataTest extends \PHPUnit_Framework_TestCase
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
-        $expectedBunches = $objectManager->get('Magento\Core\Model\Registry')
+        $expectedBunches = $objectManager->get('Magento\Registry')
             ->registry('_fixture/Magento_ImportExport_Import_Data');
 
         $this->assertEquals($expectedBunches[0]['behavior'], $this->_model->getBehavior());
@@ -93,7 +93,7 @@ class DataTest extends \PHPUnit_Framework_TestCase
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
-        $expectedBunches = $objectManager->get('Magento\Core\Model\Registry')
+        $expectedBunches = $objectManager->get('Magento\Registry')
             ->registry('_fixture/Magento_ImportExport_Import_Data');
 
         $this->assertEquals($expectedBunches[0]['entity'], $this->_model->getEntityTypeCode());
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/_files/customer.php b/dev/tests/integration/testsuite/Magento/ImportExport/_files/customer.php
index a7e42c99bff..84e98e2517a 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/_files/customer.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/_files/customer.php
@@ -69,5 +69,5 @@ $customer->save();
 
 /** @var $objectManager \Magento\TestFramework\ObjectManager */
 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-$objectManager->get('Magento\Core\Model\Registry')->unregister('_fixture/Magento_ImportExport_Customer');
-$objectManager->get('Magento\Core\Model\Registry')->register('_fixture/Magento_ImportExport_Customer', $customer);
+$objectManager->get('Magento\Registry')->unregister('_fixture/Magento_ImportExport_Customer');
+$objectManager->get('Magento\Registry')->register('_fixture/Magento_ImportExport_Customer', $customer);
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/_files/customer_with_addresses.php b/dev/tests/integration/testsuite/Magento/ImportExport/_files/customer_with_addresses.php
index a645b3e028c..e7c817137a4 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/_files/customer_with_addresses.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/_files/customer_with_addresses.php
@@ -168,7 +168,7 @@ $customers[] = $customer;
 
 /** @var $objectManager \Magento\TestFramework\ObjectManager */
 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-$objectManager->get('Magento\Core\Model\Registry')
+$objectManager->get('Magento\Registry')
     ->unregister('_fixture/Magento_ImportExport_Customers_Array');
-$objectManager->get('Magento\Core\Model\Registry')
+$objectManager->get('Magento\Registry')
     ->register('_fixture/Magento_ImportExport_Customers_Array', $customers);
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/_files/customers.php b/dev/tests/integration/testsuite/Magento/ImportExport/_files/customers.php
index cc01e475fac..972e328538b 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/_files/customers.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/_files/customers.php
@@ -86,6 +86,6 @@ $customers[] = $customer;
 
 /** @var $objectManager \Magento\TestFramework\ObjectManager */
 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-$objectManager->get('Magento\Core\Model\Registry')->unregister('_fixture/Magento_ImportExport_Customer_Collection');
-$objectManager->get('Magento\Core\Model\Registry')
+$objectManager->get('Magento\Registry')->unregister('_fixture/Magento_ImportExport_Customer_Collection');
+$objectManager->get('Magento\Registry')
     ->register('_fixture/Magento_ImportExport_Customer_Collection', $customers);
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/_files/import_data.php b/dev/tests/integration/testsuite/Magento/ImportExport/_files/import_data.php
index 9ec09a7686a..ad5f1195af5 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/_files/import_data.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/_files/import_data.php
@@ -138,5 +138,5 @@ foreach ($bunches as $bunch) {
 
 /** @var $objectManager \Magento\TestFramework\ObjectManager */
 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-$objectManager->get('Magento\Core\Model\Registry')->unregister('_fixture/Magento_ImportExport_Import_Data');
-$objectManager->get('Magento\Core\Model\Registry')->register('_fixture/Magento_ImportExport_Import_Data', $bunches);
+$objectManager->get('Magento\Registry')->unregister('_fixture/Magento_ImportExport_Import_Data');
+$objectManager->get('Magento\Registry')->register('_fixture/Magento_ImportExport_Import_Data', $bunches);
diff --git a/dev/tests/integration/testsuite/Magento/Less/PreProcessorTest.php b/dev/tests/integration/testsuite/Magento/Less/PreProcessorTest.php
index ae37acaed40..bd514f4a8fc 100644
--- a/dev/tests/integration/testsuite/Magento/Less/PreProcessorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Less/PreProcessorTest.php
@@ -25,11 +25,6 @@ namespace Magento\Less;
 
 class PreProcessorTest extends \PHPUnit_Framework_TestCase
 {
-    /**
-     * @var \Magento\Css\PreProcessor\Less
-     */
-    protected $model;
-
     /**
      * @var \Magento\ObjectManager
      */
@@ -45,7 +40,6 @@ class PreProcessorTest extends \PHPUnit_Framework_TestCase
         ));
         $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
         $this->objectManager->get('Magento\App\State')->setAreaCode('frontend');
-        $this->model = $this->objectManager->create('Magento\Css\PreProcessor\Less');
     }
 
     /**
@@ -55,6 +49,8 @@ class PreProcessorTest extends \PHPUnit_Framework_TestCase
      */
     public function testProcess()
     {
+        /** @var $lessPreProcessor \Magento\Css\PreProcessor\Less */
+        $lessPreProcessor = $this->objectManager->create('Magento\Css\PreProcessor\Less');
         /** @var $filesystem \Magento\Filesystem */
         $filesystem = $this->objectManager->get('Magento\Filesystem');
         $targetDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::TMP_DIR);
@@ -62,9 +58,48 @@ class PreProcessorTest extends \PHPUnit_Framework_TestCase
         /** @var \Magento\View\Service $viewService */
         $viewService = $this->objectManager->get('Magento\View\Service');
         $viewService->updateDesignParams($designParams);
-        $cssTargetFile = $this->model->process('source/source.css', $designParams, $targetDirectory);
+        /** @var $file \Magento\View\Publisher\CssFile */
+        $cssFile = $this->objectManager->create('Magento\View\Publisher\CssFile', [
+            'filePath'         => 'source/source.css',
+            'allowDuplication' => true,
+            'viewParams'       => $designParams
+        ]);
+        $cssTargetFile = $lessPreProcessor->process($cssFile, $targetDirectory);
         /** @var $viewFilesystem \Magento\View\FileSystem */
         $viewFilesystem = $this->objectManager->get('Magento\View\FileSystem');
-        $this->assertFileEquals($viewFilesystem->getViewFile('source.css', $designParams), $cssTargetFile);
+        $this->assertFileEquals(
+            $viewFilesystem->getViewFile('source.css', $designParams),
+            $cssTargetFile->getSourcePath()
+        );
+    }
+
+    /**
+     * @magentoDataFixture Magento/Less/_files/themes.php
+     * @magentoAppIsolation enabled
+     * @magentoAppArea frontend
+     */
+    public function testCircularDependency()
+    {
+        $designParams = array('area' => 'frontend', 'theme' => 'test_pre_process');
+        /** @var \Magento\View\Service $viewService */
+        $viewService = $this->objectManager->get('Magento\View\Service');
+        $viewService->updateDesignParams($designParams);
+        /** @var $preProcessor \Magento\Less\PreProcessor */
+        $preProcessor = $this->objectManager->create('Magento\Less\PreProcessor');
+        $fileList = $preProcessor->processLessInstructions('circular_dependency/import1.less', $designParams);
+        $files = [];
+        /** @var $lessFile \Magento\Less\PreProcessor\File\Less */
+        foreach ($fileList as $lessFile) {
+            $this->assertFileExists($lessFile->getPublicationPath());
+            $files[] = $lessFile;
+        }
+        $this->assertNotEmpty($files);
+        $files[] = array_shift($files);
+        $importedFile = reset($files);
+        foreach ($fileList as $lessFile) {
+            $importedFilePath = preg_quote($importedFile->getPublicationPath());
+            $this->assertRegExp("#{$importedFilePath}#", file_get_contents($lessFile->getPublicationPath()));
+            $importedFile = next($files);
+        }
     }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test/magento_import.less b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test/magento_import.less
deleted file mode 100644
index c30ba74d767..00000000000
--- a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test/magento_import.less
+++ /dev/null
@@ -1,3 +0,0 @@
-div.test {
-  color: white;
-}
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test/some_dir/import_dir/import_in_magento_import.less b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test/some_dir/import_dir/import_in_magento_import.less
new file mode 100644
index 00000000000..1315c25625e
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test/some_dir/import_dir/import_in_magento_import.less
@@ -0,0 +1,3 @@
+div.import_in_magento_import_module {
+  color: white;
+}
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test/some_dir/magento_import.less b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test/some_dir/magento_import.less
new file mode 100644
index 00000000000..41ab05d69c2
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test/some_dir/magento_import.less
@@ -0,0 +1,4 @@
+@import "import_dir/import_in_magento_import.less";
+div.test {
+  color: white;
+}
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test2/magento_import.less b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test2/some_dir/magento_import.less
similarity index 100%
rename from dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test2/magento_import.less
rename to dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/Magento_Test2/some_dir/magento_import.less
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/circular_dependency/import1.less b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/circular_dependency/import1.less
new file mode 100644
index 00000000000..3644b3f4ddd
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/circular_dependency/import1.less
@@ -0,0 +1 @@
+@import 'import2.less';
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/circular_dependency/import2.less b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/circular_dependency/import2.less
new file mode 100644
index 00000000000..ba6a32c7aa0
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/circular_dependency/import2.less
@@ -0,0 +1 @@
+@import 'import3.less';
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/circular_dependency/import3.less b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/circular_dependency/import3.less
new file mode 100644
index 00000000000..0a5bda87da3
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/circular_dependency/import3.less
@@ -0,0 +1 @@
+@import 'import1.less';
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/some_dir/import_dir/import_in_magento_import.less b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/some_dir/import_dir/import_in_magento_import.less
new file mode 100644
index 00000000000..505f320eed4
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/some_dir/import_dir/import_in_magento_import.less
@@ -0,0 +1,3 @@
+div.import_in_magento_import_theme {
+  color: white;
+}
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/source.css b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/source.css
index a7563807b03..ab1c45799ce 100644
--- a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/source.css
+++ b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/source.css
@@ -7,9 +7,15 @@
 div.module_test {
   color: red;
 }
+div.import_in_magento_import_theme {
+  color: white;
+}
 div.magento_import_lib {
   color: green;
 }
+div.import_in_magento_import_module {
+  color: white;
+}
 div.test {
   color: white;
 }
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/source/source.less b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/source/source.less
index 66720b2c364..fdbc50b090d 100644
--- a/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/source/source.less
+++ b/dev/tests/integration/testsuite/Magento/Less/_files/design/frontend/test_pre_process/source/source.less
@@ -2,7 +2,7 @@
 @import (less) "../less/import2";
 @import "Magento_Test3::import";
 @import "../less/not_existed_file.less";
-//@magento_import "../magento_import.less";
+//@magento_import "../some_dir/magento_import.less";
 //@magento_import "../not_existed_magento_import.less";
 
 .end_class {
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/lib/magento_import.less b/dev/tests/integration/testsuite/Magento/Less/_files/lib/magento_import.less
deleted file mode 100644
index 4fb146ecbca..00000000000
--- a/dev/tests/integration/testsuite/Magento/Less/_files/lib/magento_import.less
+++ /dev/null
@@ -1,3 +0,0 @@
-div.magento_import_lib {
-  color: green;
-}
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/lib/some_dir/import_dir/import_in_magento_import.less b/dev/tests/integration/testsuite/Magento/Less/_files/lib/some_dir/import_dir/import_in_magento_import.less
new file mode 100644
index 00000000000..f66cc2bbe5b
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Less/_files/lib/some_dir/import_dir/import_in_magento_import.less
@@ -0,0 +1,3 @@
+div.import_in_magento_import_lib {
+  color: white;
+}
diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/lib/some_dir/magento_import.less b/dev/tests/integration/testsuite/Magento/Less/_files/lib/some_dir/magento_import.less
new file mode 100644
index 00000000000..edf3817c255
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Less/_files/lib/some_dir/magento_import.less
@@ -0,0 +1,4 @@
+@import "import_dir/import_in_magento_import.less";
+div.magento_import_lib {
+  color: green;
+}
diff --git a/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/Address/SelectTest.php b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/Address/SelectTest.php
new file mode 100644
index 00000000000..f0b42602845
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/Address/SelectTest.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Multishipping\Block\Checkout\Address;
+
+use Magento\TestFramework\Helper\Bootstrap;
+
+/**
+ * @magentoAppArea frontend
+ */
+class SelectTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\Multishipping\Block\Checkout\Address\Select */
+    protected $_selectBlock;
+
+    protected function setUp()
+    {
+        $this->_selectBlock = Bootstrap::getObjectManager()->create(
+            'Magento\Multishipping\Block\Checkout\Address\Select'
+        );
+        parent::setUp();
+    }
+
+    /**
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
+     */
+    public function testGetAddressAsHtml()
+    {
+        /** @var \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService */
+        $addressService = Bootstrap::getObjectManager()->create(
+            'Magento\Customer\Service\V1\CustomerAddressServiceInterface'
+        );
+        $fixtureAddressId = 1;
+        $address = $addressService->getAddressById($fixtureAddressId);
+        $addressAsHtml = $this->_selectBlock->getAddressAsHtml($address);
+        $this->assertEquals(
+            "John Smith<br/>Green str, 67<br />CityM,  Alabama, 75477<br/><br/>T: 3468676",
+            str_replace("\n", '', $addressAsHtml),
+            "Address was represented as HTML incorrectly"
+        );
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Multishipping/Model/Checkout/Type/MultishippingTest.php b/dev/tests/integration/testsuite/Magento/Multishipping/Model/Checkout/Type/MultishippingTest.php
new file mode 100644
index 00000000000..5eb35d9b00f
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Multishipping/Model/Checkout/Type/MultishippingTest.php
@@ -0,0 +1,188 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_Checkout
+ */
+
+namespace Magento\Multishipping\Model\Checkout\Type;
+
+use Magento\TestFramework\Helper\Bootstrap;
+
+/**
+ * @magentoAppArea frontend
+ */
+class MultishippingTest extends \PHPUnit_Framework_TestCase
+{
+    const ADDRESS_TYPE_SHIPPING = 'shipping';
+    const ADDRESS_TYPE_BILLING = 'billing';
+
+    /** @var \Magento\Multishipping\Model\Checkout\Type\Multishipping */
+    protected $_multishippingCheckout;
+
+    protected function setUp()
+    {
+        $this->_multishippingCheckout = Bootstrap::getObjectManager()->create(
+            'Magento\Multishipping\Model\Checkout\Type\Multishipping'
+        );
+        parent::setUp();
+    }
+
+    /**
+     * Test case when default billing and shipping addresses are set and they are different.
+     *
+     * @param string $addressType
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
+     * @magentoAppIsolation enabled
+     * @dataProvider getCustomerDefaultAddressDataProvider
+     */
+    public function testGetCustomerDefaultAddress($addressType)
+    {
+        /**
+         * Preconditions:
+         * - second address is default address of {$addressType},
+         * - current customer is set to customer session
+         */
+        $fixtureCustomerId = 1;
+        $secondFixtureAddressId = 2;
+        $secondFixtureAddressStreet = ['Black str, 48'];
+        /** @var \Magento\Customer\Model\Customer $customer */
+        $customer = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Customer')->load($fixtureCustomerId);
+        if ($addressType == self::ADDRESS_TYPE_SHIPPING) {
+            $customer->setDefaultShipping($secondFixtureAddressId)->save();
+        } else { // billing
+            $customer->setDefaultBilling($secondFixtureAddressId)->save();
+        }
+        /** @var \Magento\Customer\Model\Session $customerSession */
+        $customerSession = Bootstrap::getObjectManager()->get('Magento\Customer\Model\Session');
+        $customerSession->setCustomer($customer);
+
+        /** Execute SUT */
+        if ($addressType == self::ADDRESS_TYPE_SHIPPING) {
+            $address = $this->_multishippingCheckout->getCustomerDefaultShippingAddress();
+        } else { // billing
+            $address = $this->_multishippingCheckout->getCustomerDefaultBillingAddress();
+        }
+        $this->assertInstanceOf('\Magento\Customer\Service\V1\Dto\Address', $address, "Address was not loaded.");
+        $this->assertEquals($secondFixtureAddressId, $address->getId(), "Invalid address loaded.");
+        $this->assertEquals(
+            $secondFixtureAddressStreet,
+            $address->getStreet(),
+            "Street in default {$addressType} address is invalid."
+        );
+
+        /** Ensure that results are cached properly by changing default address and invoking SUT once again */
+        $firstFixtureAddressId = 1;
+        if ($addressType == self::ADDRESS_TYPE_SHIPPING) {
+            $customer->setDefaultShipping($firstFixtureAddressId)->save();
+            $address = $this->_multishippingCheckout->getCustomerDefaultShippingAddress();
+        } else { // billing
+            $customer->setDefaultBilling($firstFixtureAddressId)->save();
+            $address = $this->_multishippingCheckout->getCustomerDefaultBillingAddress();
+        }
+        $this->assertEquals($secondFixtureAddressId, $address->getId(), "Method results are not cached properly.");
+    }
+
+    /**
+     * Test case when customer has addresses, but default {$addressType} address is not set.
+     *
+     * @param string $addressType
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
+     * @magentoAppIsolation enabled
+     * @dataProvider getCustomerDefaultAddressDataProvider
+     */
+    public function testGetCustomerDefaultAddressDefaultAddressNotSet($addressType)
+    {
+        /**
+         * Preconditions:
+         * - customer has addresses, but default address of {$addressType} is not set
+         * - current customer is set to customer session
+         */
+        $fixtureCustomerId = 1;
+        $firstFixtureAddressId = 1;
+        $firstFixtureAddressStreet = ['Green str, 67'];
+        /** @var \Magento\Customer\Model\Customer $customer */
+        $customer = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Customer')->load($fixtureCustomerId);
+        if ($addressType == self::ADDRESS_TYPE_SHIPPING) {
+            $customer->setDefaultShipping(null)->save();
+        } else { // billing
+            $customer->setDefaultBilling(null)->save();
+        }
+        /** @var \Magento\Customer\Model\Session $customerSession */
+        $customerSession = Bootstrap::getObjectManager()->get('Magento\Customer\Model\Session');
+        $customerSession->setCustomer($customer);
+
+        /** Execute SUT */
+        if ($addressType == self::ADDRESS_TYPE_SHIPPING) {
+            $address = $this->_multishippingCheckout->getCustomerDefaultShippingAddress();
+        } else { // billing
+            $address = $this->_multishippingCheckout->getCustomerDefaultBillingAddress();
+        }
+        $this->assertInstanceOf('\Magento\Customer\Service\V1\Dto\Address', $address, "Address was not loaded.");
+        $this->assertEquals($firstFixtureAddressId, $address->getId(), "Invalid address loaded.");
+        $this->assertEquals(
+            $firstFixtureAddressStreet,
+            $address->getStreet(),
+            "Street in default {$addressType} address is invalid."
+        );
+    }
+
+    /**
+     * Test case when customer has no addresses.
+     *
+     * @param string $addressType
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoAppIsolation enabled
+     * @dataProvider getCustomerDefaultAddressDataProvider
+     */
+    public function testGetCustomerDefaultAddressCustomerWithoutAddresses($addressType)
+    {
+        /**
+         * Preconditions:
+         * - customer has no addresses
+         * - current customer is set to customer session
+         */
+        $fixtureCustomerId = 1;
+        /** @var \Magento\Customer\Model\Customer $customer */
+        $customer = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Customer')->load($fixtureCustomerId);
+        $customer->setDefaultShipping(null)->setDefaultBilling(null)->save();
+        /** @var \Magento\Customer\Model\Session $customerSession */
+        $customerSession = Bootstrap::getObjectManager()->get('Magento\Customer\Model\Session');
+        $customerSession->setCustomer($customer);
+
+        /** Execute SUT */
+        if ($addressType == self::ADDRESS_TYPE_SHIPPING) {
+            $address = $this->_multishippingCheckout->getCustomerDefaultShippingAddress();
+        } else { // billing
+            $address = $this->_multishippingCheckout->getCustomerDefaultBillingAddress();
+        }
+        $this->assertNull($address, "When customer has no addresses, null is expected.");
+    }
+
+    public function getCustomerDefaultAddressDataProvider()
+    {
+        return array(
+            self::ADDRESS_TYPE_SHIPPING => array(self::ADDRESS_TYPE_SHIPPING),
+            self::ADDRESS_TYPE_BILLING => array(self::ADDRESS_TYPE_BILLING)
+        );
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/Queue/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/Queue/Edit/FormTest.php
index cb9d1618ce1..a39b0ee892d 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/Queue/Edit/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/Queue/Edit/FormTest.php
@@ -38,19 +38,26 @@ class FormTest extends \PHPUnit_Framework_TestCase
      */
     public function testPrepareForm()
     {
-        \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface')
+        $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+        $queue = $objectManager->get('Magento\Newsletter\Model\Queue');
+        /** @var \Magento\Registry $registry */
+        $registry = $objectManager->get('\Magento\Registry');
+        $registry->register('current_queue', $queue);
+
+        $objectManager->get('Magento\View\DesignInterface')
             ->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE)
             ->setDefaultDesignTheme();
-        \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+        $objectManager
             ->get('Magento\Config\ScopeInterface')
             ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE);
-        $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Newsletter\Block\Adminhtml\Queue\Edit\Form');
+        $block = $objectManager
+            ->create('Magento\Newsletter\Block\Adminhtml\Queue\Edit\Form', array(
+                'registry' => $registry,
+            ));
         $prepareFormMethod = new \ReflectionMethod(
             'Magento\Newsletter\Block\Adminhtml\Queue\Edit\Form', '_prepareForm');
         $prepareFormMethod->setAccessible(true);
 
-        $queue = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Newsletter\Model\Queue');
         $statuses = array(\Magento\Newsletter\Model\Queue::STATUS_NEVER, \Magento\Newsletter\Model\Queue::STATUS_PAUSE);
         foreach ($statuses as $status) {
             $queue->setQueueStatus($status);
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php
index 9be42c395e3..b7f525ff45c 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php
@@ -39,65 +39,35 @@ class QueueTest extends \PHPUnit_Framework_TestCase
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
-        $themes = array('frontend' => 'magento_blank');
-        /** @var $design \Magento\Core\Model\View\Design */
-        $design = $objectManager->create('Magento\View\DesignInterface', array('themes' => $themes));
-        $objectManager->addSharedInstance($design, 'Magento\Core\Model\View\Design\Proxy');
-        /** @var $appEmulation \Magento\Core\Model\App\Emulation */
-        $appEmulation = $objectManager->create('Magento\Core\Model\App\Emulation', array('viewDesign' => $design));
-        $objectManager->addSharedInstance($appEmulation, 'Magento\Core\Model\App\Emulation');
         /** @var $app \Magento\TestFramework\App */
         $app = $objectManager->get('Magento\Core\Model\App');
         $app->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND);
 
-        $collection = $objectManager->create('Magento\Core\Model\Resource\Theme\Collection');
-        $themeId = $collection->getThemeByFullPath('frontend/magento_blank')->getId();
-        /** @var $storeManager \Magento\Core\Model\StoreManagerInterface */
-        $storeManager = $objectManager->get('Magento\Core\Model\StoreManagerInterface');
-        $storeManager->getStore('fixturestore')->setConfig(
-            \Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId
-        );
-
-        $subscriberOne = $this->getMock('Zend_Mail', array('send', 'setBodyHTML'), array('utf-8'));
-        $subscriberOne->expects($this->any())->method('send');
-        $subscriberTwo = clone $subscriberOne;
-        $subscriberOne->expects($this->once())->method('setBodyHTML')->with(
-            $this->stringEndsWith('/static/frontend/magento_plushe/en_US/images/logo.gif')
-        );
-        $subscriberTwo->expects($this->once())->method('setBodyHTML')->with(
-            $this->stringEndsWith('/static/frontend/magento_blank/de_DE/images/logo.gif')
-        );
         /** @var $filter \Magento\Newsletter\Model\Template\Filter */
         $filter = $objectManager->get('Magento\Newsletter\Model\Template\Filter');
 
-        $emailTemplate = $this->getMock('Magento\Email\Model\Template',
-            array('_getMail', '_getLogoUrl', '__wakeup', 'setTemplateFilter'),
-            array(
-                $objectManager->get('Magento\Core\Model\Context'),
-                $design,
-                $objectManager->get('Magento\Core\Model\Registry'),
-                $appEmulation,
-                $objectManager->get('Magento\Core\Model\StoreManagerInterface'),
-                $objectManager->get('Magento\App\Filesystem'),
-                $objectManager->get('Magento\View\Url'),
-                $objectManager->get('Magento\View\FileSystem'),
-                $objectManager->get('Magento\Core\Model\Store\ConfigInterface'),
-                $objectManager->get('Magento\App\ConfigInterface'),
-                $objectManager->get('Magento\Email\Model\Template\FilterFactory'),
-                $objectManager->get('Magento\Email\Model\Template\Config'),
-            )
-        );
-        $emailTemplate->expects($this->once())
-            ->method('setTemplateFilter')
-            ->with($filter);
-
-        $emailTemplate->expects($this->exactly(2))->method('_getMail')->will($this->onConsecutiveCalls(
-            $subscriberOne, $subscriberTwo
-        ));
+        $transport = $this->getMock('\Magento\Mail\TransportInterface');
+        $transport->expects($this->exactly(2))
+            ->method('sendMessage')
+            ->will($this->returnSelf());
+
+        $builder = $this->getMock('\Magento\Newsletter\Model\Queue\TransportBuilder',
+            array('getTransport', 'setFrom', 'addTo'),
+            array(), '', false);
+        $builder->expects($this->exactly(2))
+            ->method('getTransport')
+            ->will($this->returnValue($transport));
+        $builder->expects($this->exactly(2))
+            ->method('setFrom')
+            ->will($this->returnSelf());
+        $builder->expects($this->exactly(2))
+            ->method('addTo')
+            ->will($this->returnSelf());
+
         /** @var $queue \Magento\Newsletter\Model\Queue */
         $queue = $objectManager->create('Magento\Newsletter\Model\Queue', array(
             'filter' => $filter,
-            'data'   => array('email_template' => $emailTemplate)
+            'transportBuilder' => $builder,
         ));
         $queue->load('Subject', 'newsletter_subject'); // fixture
         $queue->sendPerSubscriber();
@@ -109,47 +79,41 @@ class QueueTest extends \PHPUnit_Framework_TestCase
      */
     public function testSendPerSubscriberProblem()
     {
-        \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')
-            ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND);
-        $mail = $this->getMock('Zend_Mail', array('send'), array('utf-8'));
-        $brokenMail = $this->getMock('Zend_Mail', array('send'), array('utf-8'));
         $errorMsg = md5(microtime());
-        $brokenMail->expects($this->any())->method('send')->will($this->throwException(new \Exception($errorMsg, 99)));
+
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $template = $this->getMock('Magento\Email\Model\Template',
-            array('_getMail', '_getLogoUrl', '__wakeup'),
-            array(
-                $objectManager->get('Magento\Core\Model\Context'),
-                $objectManager->get('Magento\Core\Model\View\Design'),
-                $objectManager->get('Magento\Core\Model\Registry'),
-                $objectManager->get('Magento\Core\Model\App\Emulation'),
-                $objectManager->get('Magento\Core\Model\StoreManagerInterface'),
-                $objectManager->get('Magento\App\Filesystem'),
-                $objectManager->get('Magento\View\Url'),
-                $objectManager->get('Magento\View\FileSystem'),
-                $objectManager->get('Magento\Core\Model\Store\ConfigInterface'),
-                $objectManager->get('Magento\App\ConfigInterface'),
-                $objectManager->get('Magento\Email\Model\Template\FilterFactory'),
-                $objectManager->get('Magento\Email\Model\Template\Config'),
-            )
-        );
-        $template->expects($this->any())->method('_getMail')->will($this->onConsecutiveCalls($mail, $brokenMail));
-
-        $storeConfig = $objectManager->get('Magento\Core\Model\Store\Config');
-        $coreStoreConfig = new \ReflectionProperty($template, '_coreStoreConfig');
-        $coreStoreConfig->setAccessible(true);
-        $coreStoreConfig->setValue($template, $storeConfig);
-
-        $queue = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Newsletter\Model\Queue',
-            array('data' => array('email_template' => $template))
-        );
+        $objectManager->get('Magento\Core\Model\App')
+            ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND);
+
+        $transport = $this->getMock('\Magento\Mail\TransportInterface');
+        $transport->expects($this->any())
+            ->method('sendMessage')
+            ->will($this->throwException(new \Magento\Mail\Exception($errorMsg, 99)));
+
+        $builder = $this->getMock('\Magento\Newsletter\Model\Queue\TransportBuilder',
+            array('getTransport', 'setFrom', 'addTo'),
+            array(), '', false);
+        $builder->expects($this->any())
+            ->method('getTransport')
+            ->will($this->returnValue($transport));
+        $builder->expects($this->any())
+            ->method('setFrom')
+            ->will($this->returnSelf());
+        $builder->expects($this->any())
+            ->method('addTo')
+            ->will($this->returnSelf());
+
+        /** @var $queue \Magento\Newsletter\Model\Queue */
+        $queue = $objectManager->create('Magento\Newsletter\Model\Queue', array(
+            'transportBuilder' => $builder,
+        ));
         $queue->load('Subject', 'newsletter_subject'); // fixture
-        $problem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Newsletter\Model\Problem');
+
+        $problem = $objectManager->create('Magento\Newsletter\Model\Problem');
         $problem->load($queue->getId(), 'queue_id');
         $this->assertEmpty($problem->getId());
 
+
         $queue->sendPerSubscriber();
 
         $problem->load($queue->getId(), 'queue_id');
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Block/Billing/Agreement/ViewTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Block/Billing/Agreement/ViewTest.php
index e1d2465cede..5a8b30bc65c 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Block/Billing/Agreement/ViewTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Block/Billing/Agreement/ViewTest.php
@@ -82,7 +82,7 @@ class ViewTest extends \Magento\Backend\Utility\Controller
         $billingAgreement = $billingAgreementCollection->getFirstItem();
         $billingAgreement->addOrderRelation($orderA->getId())->save();
 
-        $registry = Bootstrap::getObjectManager()->get('Magento\Core\Model\Registry');
+        $registry = Bootstrap::getObjectManager()->get('Magento\Registry');
         $registry->register('current_billing_agreement', $billingAgreement);
 
         $relatedOrders = $this->_block->getRelatedOrders();
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Block/Payment/Form/Billing/AgreementTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Block/Payment/Form/Billing/AgreementTest.php
new file mode 100644
index 00000000000..b5678dc47f9
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Block/Payment/Form/Billing/AgreementTest.php
@@ -0,0 +1,65 @@
+<?php
+/**
+ * Test for \Magento\Paypal\Block\Payment\Form\Billing\Agreement
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Paypal\Block\Payment\Form\Billing;
+
+class AgreementTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\Paypal\Block\Payment\Form\Billing\Agreement */
+    protected $_block;
+
+    protected function setUp()
+    {
+        $quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\Sales\Model\Resource\Quote\Collection')
+            ->getFirstItem();
+        /** @var \Magento\View\LayoutInterface $layout */
+        $layout = $this->getMockBuilder('Magento\View\LayoutInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $layout->expects($this->once())
+            ->method('getBlock')
+            ->will($this->returnValue(new \Magento\Object(['quote' => $quote])));
+        $layout->expects($this->once())
+            ->method('getParentName')
+            ->will($this->returnValue('billing_agreement_form'));
+
+        $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\Paypal\Block\Payment\Form\Billing\Agreement');
+        $this->_block->setLayout($layout);
+    }
+
+    /**
+     * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php
+     * @magentoDataFixture Magento/Paypal/_files/billing_agreement.php
+     */
+    public function testGetBillingAgreements()
+    {
+        $billingAgreements = $this->_block->getBillingAgreements();
+        $this->assertEquals(1, count($billingAgreements));
+        $this->assertEquals('REF-ID-TEST-678', array_shift($billingAgreements));
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreementTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreementTest.php
new file mode 100644
index 00000000000..d543a612f88
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreementTest.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Paypal\Model\Payment\Method\Billing;
+
+use \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgreement;
+
+class AbstractAgreementTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\Paypal\Model\Method\Agreement */
+    protected $_model;
+
+    protected function setUp()
+    {
+        $config = $this->getMockBuilder('\Magento\Paypal\Model\Config')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $config->expects($this->any())
+            ->method('isMethodAvailable')
+            ->will($this->returnValue(true));
+        $proMock = $this->getMockBuilder('Magento\Paypal\Model\Pro')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $proMock->expects($this->any())
+            ->method('getConfig')
+            ->will($this->returnValue($config));
+        $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\Paypal\Model\Method\Agreement', ['data' => [$proMock]]);
+    }
+
+    /**
+     * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php
+     * @magentoDataFixture Magento/Paypal/_files/billing_agreement.php
+     */
+    public function testIsActive()
+    {
+        $quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\Sales\Model\Resource\Quote\Collection')
+            ->getFirstItem();
+        $this->assertTrue($this->_model->isAvailable($quote));
+    }
+
+    /**
+     * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php
+     * @magentoDataFixture Magento/Paypal/_files/billing_agreement.php
+     */
+    public function testAssignData()
+    {
+        /** @var \Magento\Sales\Model\Resource\Quote\Collection $collection */
+        $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\Sales\Model\Resource\Quote\Collection');
+        /** @var \Magento\Sales\Model\Quote $quote */
+        $quote = $collection->getFirstItem();
+
+        /** @var \Magento\Payment\Model\Info $info */
+        $info = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\Payment\Model\Info')
+            ->setQuote($quote);
+        $this->_model->setData('info_instance', $info);
+        $billingAgreement = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\Paypal\Model\Resource\Billing\Agreement\Collection')
+            ->getFirstItem();
+        $data = [
+            AbstractAgreement::TRANSPORT_BILLING_AGREEMENT_ID =>
+                $billingAgreement->getId()
+        ];
+        $this->_model->assignData($data);
+        $this->assertEquals(
+            'REF-ID-TEST-678',
+            $info->getAdditionalInformation(
+                AbstractAgreement::PAYMENT_INFO_REFERENCE_ID)
+        );
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Resource/Billing/Agreement/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Resource/Billing/Agreement/CollectionTest.php
new file mode 100644
index 00000000000..6913f08743a
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Resource/Billing/Agreement/CollectionTest.php
@@ -0,0 +1,66 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Paypal\Model\Resource\Billing\Agreement;
+
+use Magento\TestFramework\Helper\Bootstrap;
+
+class CollectionTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDataFixture Magento/Paypal/_files/billing_agreement.php
+     */
+    public function testAddCustomerDetails()
+    {
+        /** @var \Magento\Paypal\Model\Resource\Billing\Agreement\Collection $billingAgreementCollection */
+        $billingAgreementCollection = Bootstrap::getObjectManager()
+            ->create('Magento\Paypal\Model\Resource\Billing\Agreement\Collection');
+
+        $billingAgreementCollection->addCustomerDetails();
+
+        $this->assertEquals(1, $billingAgreementCollection->count(), "Invalid collection items quantity.");
+        /** @var \Magento\Paypal\Model\Billing\Agreement $billingAgreement */
+        $billingAgreement = $billingAgreementCollection->getFirstItem();
+
+        $expectedData = [
+            'customer_id' => 1,
+            'method_code' => 'paypal_express',
+            'reference_id' => 'REF-ID-TEST-678',
+            'status' => 'active',
+            'store_id' => 1,
+            'agreement_label' => 'TEST',
+            'customer_email' => 'customer@example.com',
+            'customer_firstname' => 'Firstname',
+            'customer_lastname' => 'Lastname'
+        ];
+        foreach ($expectedData as $field => $expectedValue) {
+            $this->assertEquals(
+                $expectedValue,
+                $billingAgreement->getData($field),
+                "'{$field}' field value is invalid."
+            );
+        }
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php
index 045ff23643a..b44c878ac82 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php
@@ -41,7 +41,7 @@ class VoidTest extends \PHPUnit_Framework_TestCase
         $paymentData = $objectManager->get('Magento\Payment\Helper\Data');
         $coreStoreConfig = $objectManager->get('Magento\Core\Model\Store\Config');
         $logger = $objectManager->get('Magento\Logger');
-        $logAdapterFactory = $objectManager->get('Magento\Core\Model\Log\AdapterFactory');
+        $logAdapterFactory = $objectManager->get('Magento\Logger\AdapterFactory');
         $locale = $objectManager->get('Magento\Core\Model\LocaleInterface');
         $centinelService = $objectManager->get('Magento\Centinel\Model\Service');
         $storeManager = $objectManager->get('Magento\Core\Model\StoreManagerInterface');
diff --git a/dev/tests/integration/testsuite/Magento/RecurringProfile/Block/Catalog/Product/View/ProfileTest.php b/dev/tests/integration/testsuite/Magento/RecurringProfile/Block/Catalog/Product/View/ProfileTest.php
index a01885230c8..2b3b262649f 100644
--- a/dev/tests/integration/testsuite/Magento/RecurringProfile/Block/Catalog/Product/View/ProfileTest.php
+++ b/dev/tests/integration/testsuite/Magento/RecurringProfile/Block/Catalog/Product/View/ProfileTest.php
@@ -38,11 +38,11 @@ class ProfileTest extends \PHPUnit_Framework_TestCase
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
         $objectManager->get('Magento\App\State')->setAreaCode('frontend');
-        
+
         $product = $objectManager->create('Magento\Catalog\Model\Product');
         $product->setIsRecurring('1');
         $product->setRecurringProfile(array('start_date_is_editable' => true));
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_product', $product);
+        $objectManager->get('Magento\Registry')->register('current_product', $product);
         $block = $objectManager->create('Magento\RecurringProfile\Block\Catalog\Product\View\Profile');
         $block->setLayout($objectManager->create('Magento\Core\Model\Layout'));
 
diff --git a/dev/tests/integration/testsuite/Magento/RecurringProfile/Block/Profile/ViewTest.php b/dev/tests/integration/testsuite/Magento/RecurringProfile/Block/Profile/ViewTest.php
index a7620c08225..38df1517b01 100644
--- a/dev/tests/integration/testsuite/Magento/RecurringProfile/Block/Profile/ViewTest.php
+++ b/dev/tests/integration/testsuite/Magento/RecurringProfile/Block/Profile/ViewTest.php
@@ -50,7 +50,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase
             ->create('Magento\RecurringProfile\Model\Profile');
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_recurring_profile', $this->_profile);
+        $objectManager->get('Magento\Registry')->register('current_recurring_profile', $this->_profile);
 
         $this->_layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->get('Magento\View\LayoutInterface');
@@ -61,7 +61,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('current_recurring_profile');
+        $objectManager->get('Magento\Registry')->unregister('current_recurring_profile');
         $this->_profile = null;
         $this->_block = null;
         $this->_layout = null;
diff --git a/dev/tests/integration/testsuite/Magento/Rss/Block/Order/StatusTest.php b/dev/tests/integration/testsuite/Magento/Rss/Block/Order/StatusTest.php
index 25ececafcae..a34e847b015 100644
--- a/dev/tests/integration/testsuite/Magento/Rss/Block/Order/StatusTest.php
+++ b/dev/tests/integration/testsuite/Magento/Rss/Block/Order/StatusTest.php
@@ -39,7 +39,7 @@ class StatusTest extends \PHPUnit_Framework_TestCase
         $order = $this->getMock('Magento\Object', array('formatPrice'), array(array('id' => $uniqid,)));
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_order', $order);
+        $objectManager->get('Magento\Registry')->register('current_order', $order);
         $this->assertContains($uniqid, $block->toHtml());
     }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/FormTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/FormTest.php
index c59abe386d0..eaef5c66bcb 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/FormTest.php
@@ -36,6 +36,9 @@ class FormTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Sales\Block\Adminhtml\Order\Create\Form */
     protected $_orderCreateBlock;
 
+    /** @var \Magento\ObjectManager */
+    protected $_objectManager;
+
     /**
      * @magentoDataFixture Magento/Sales/_files/quote.php
      */
@@ -160,4 +163,4 @@ ORDER_DATA_JSON;
 
         return $addressService->saveAddresses(1, [$addressDto1, $addressDto2]);
     }
-}
\ No newline at end of file
+}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/View/InfoTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/View/InfoTest.php
index 1f228012406..f8794d34c88 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/View/InfoTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/View/InfoTest.php
@@ -94,11 +94,11 @@ class InfoTest extends \Magento\Backend\Utility\Controller
 
     /**
      * @param array $additionalOrderData
-     * @return \Magento\Core\Model\Registry|\PHPUnit_Framework_MockObject_MockObject
+     * @return \Magento\Registry|\PHPUnit_Framework_MockObject_MockObject
      */
     protected function _putOrderIntoRegistry(array $additionalOrderData = [])
     {
-        $registry = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $registry = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->getMock();
 
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/CreditmemoTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/CreditmemoTest.php
index ac931b026ef..5996f335770 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/CreditmemoTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/CreditmemoTest.php
@@ -38,7 +38,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase
             ->create('Magento\Sales\Model\Order');
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_order', $order);
+        $objectManager->get('Magento\Registry')->register('current_order', $order);
         $payment = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\Sales\Model\Order\Payment');
         $payment->setMethod('checkmo');
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/InvoiceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/InvoiceTest.php
index db8cee8724e..3f671e9e7c7 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/InvoiceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/InvoiceTest.php
@@ -38,7 +38,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
             ->create('Magento\Sales\Model\Order');
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_order', $order);
+        $objectManager->get('Magento\Registry')->register('current_order', $order);
         $payment = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\Sales\Model\Order\Payment');
         $payment->setMethod('checkmo');
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
index 6d85d335c6b..c8199bb5fae 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
@@ -18,33 +18,36 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Sales
- * @subpackage  integration_tests
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
 namespace Magento\Sales\Model\AdminOrder;
 
+use Magento\TestFramework\Helper\Bootstrap;
+
 /**
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  * @magentoAppArea adminhtml
  */
 class CreateTest extends \PHPUnit_Framework_TestCase
 {
     /**
-     * Model instance
-     *
      * @var \Magento\Sales\Model\AdminOrder\Create
      */
     protected $_model;
 
+    /** @var \Magento\Message\ManagerInterface */
+    protected $_messageManager;
+
     protected function setUp()
     {
         parent::setUp();
-
-        $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Sales\Model\AdminOrder\Create');
+        $this->_messageManager = Bootstrap::getObjectManager()->get('Magento\Message\ManagerInterface');
+        $this->_model = Bootstrap::getObjectManager()->create(
+            'Magento\Sales\Model\AdminOrder\Create',
+            ['messageManager' => $this->_messageManager]
+        );
     }
 
     /**
@@ -54,14 +57,13 @@ class CreateTest extends \PHPUnit_Framework_TestCase
     public function testInitFromOrderShippingAddressSameAsBillingWhenEmpty()
     {
         /** @var $order \Magento\Sales\Model\Order */
-        $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Sales\Model\Order');
+        $order = Bootstrap::getObjectManager()->create('Magento\Sales\Model\Order');
         $order->loadByIncrementId('100000001');
         $this->assertFalse($order->getShippingAddress());
 
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
-        $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('rule_data');
+        $objectManager = Bootstrap::getObjectManager();
+        $objectManager->get('Magento\Registry')->unregister('rule_data');
         $this->_model->initFromOrder($order);
 
         $this->assertFalse($order->getShippingAddress());
@@ -75,15 +77,14 @@ class CreateTest extends \PHPUnit_Framework_TestCase
     public function testInitFromOrderShippingAddressSameAsBillingWhenSame()
     {
         /** @var $order \Magento\Sales\Model\Order */
-        $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Sales\Model\Order');
+        $order = Bootstrap::getObjectManager()->create('Magento\Sales\Model\Order');
         $order->loadByIncrementId('100000001');
 
         $this->assertNull($order->getShippingAddress()->getSameAsBilling());
 
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
-        $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('rule_data');
+        $objectManager = Bootstrap::getObjectManager();
+        $objectManager->get('Magento\Registry')->unregister('rule_data');
         $this->_model->initFromOrder($order);
 
         $this->assertTrue($order->getShippingAddress()->getSameAsBilling());
@@ -96,16 +97,16 @@ class CreateTest extends \PHPUnit_Framework_TestCase
      */
     public function testInitFromOrderShippingAddressSameAsBillingWhenDifferent()
     {
+        /** @var $objectManager \Magento\TestFramework\ObjectManager */
+        $objectManager = Bootstrap::getObjectManager();
+
         /** @var $order \Magento\Sales\Model\Order */
-        $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Sales\Model\Order');
+        $order = $objectManager->create('Magento\Sales\Model\Order');
         $order->loadByIncrementId('100000001');
 
         $this->assertNull($order->getShippingAddress()->getSameAsBilling());
 
-        /** @var $objectManager \Magento\TestFramework\ObjectManager */
-        $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('rule_data');
+        $objectManager->get('Magento\Registry')->unregister('rule_data');
         $this->_model->initFromOrder($order);
 
         $this->assertFalse($order->getShippingAddress()->getSameAsBilling());
@@ -116,9 +117,11 @@ class CreateTest extends \PHPUnit_Framework_TestCase
      */
     public function testInitFromOrderCcInformationDeleted()
     {
+        /** @var $objectManager \Magento\TestFramework\ObjectManager */
+        $objectManager = Bootstrap::getObjectManager();
+
         /** @var $order \Magento\Sales\Model\Order */
-        $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Sales\Model\Order');
+        $order = $objectManager->create('Magento\Sales\Model\Order');
         $order->loadByIncrementId('100000001');
 
         $payment = $order->getPayment();
@@ -127,9 +130,7 @@ class CreateTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('AE', $payment->getCcType());
         $this->assertEquals('0005', $payment->getCcLast4());
 
-        /** @var $objectManager \Magento\TestFramework\ObjectManager */
-        $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('rule_data');
+        $objectManager->get('Magento\Registry')->unregister('rule_data');
         $payment = $this->_model->initFromOrder($order)->getQuote()->getPayment();
 
         $this->assertNull($payment->getCcExpMonth());
@@ -143,9 +144,11 @@ class CreateTest extends \PHPUnit_Framework_TestCase
      */
     public function testInitFromOrderSavedCcInformationNotDeleted()
     {
+        /** @var $objectManager \Magento\TestFramework\ObjectManager */
+        $objectManager = Bootstrap::getObjectManager();
+
         /** @var $order \Magento\Sales\Model\Order */
-        $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->create('Magento\Sales\Model\Order');
+        $order = $objectManager->create('Magento\Sales\Model\Order');
         $order->loadByIncrementId('100000001');
 
         $payment = $order->getPayment();
@@ -154,9 +157,7 @@ class CreateTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('AE', $payment->getCcType());
         $this->assertEquals('0005', $payment->getCcLast4());
 
-        /** @var $objectManager \Magento\TestFramework\ObjectManager */
-        $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('rule_data');
+        $objectManager->get('Magento\Registry')->unregister('rule_data');
         $payment = $this->_model->initFromOrder($order)->getQuote()->getPayment();
 
         $this->assertEquals('5', $payment->getCcExpMonth());
@@ -164,4 +165,507 @@ class CreateTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('AE', $payment->getCcType());
         $this->assertEquals('0005', $payment->getCcLast4());
     }
+
+    /**
+     * @magentoAppIsolation enabled
+     */
+    public function testGetCustomerWishlistNoCustomerId()
+    {
+        /** @var \Magento\Backend\Model\Session\Quote $session */
+        $session = Bootstrap::getObjectManager()->create('Magento\Backend\Model\Session\Quote');
+        $session->setCustomerId(null);
+        $this->assertFalse(
+            $this->_model->getCustomerWishlist(true),
+            'If customer ID is not set to session, false is expected to be returned.'
+        );
+    }
+
+    /**
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+     * @magentoAppIsolation enabled
+     * @magentoDbIsolation enabled
+     */
+    public function testGetCustomerWishlist()
+    {
+        $customerIdFromFixture = 1;
+        $productIdFromFixture = 1;
+        /** @var \Magento\Backend\Model\Session\Quote $session */
+        $session = Bootstrap::getObjectManager()->create('Magento\Backend\Model\Session\Quote');
+        $session->setCustomerId($customerIdFromFixture);
+
+        /** Test new wishlist creation for the customer specified above */
+        /** @var \Magento\Wishlist\Model\Wishlist $wishlist */
+        $wishlist = $this->_model->getCustomerWishlist(true);
+        $this->assertInstanceOf(
+            'Magento\Wishlist\Model\Wishlist',
+            $wishlist,
+            'New wishlist is expected to be created if existing customer does not have one yet.'
+        );
+        $this->assertEquals(0, $wishlist->getItemsCount(), 'New wishlist must be empty just after creation.');
+
+        /** Add new item to wishlist and try to get it using getCustomerWishlist once again */
+        $wishlist->addNewItem($productIdFromFixture)->save();
+        $updatedWishlist = $this->_model->getCustomerWishlist(true);
+        $this->assertEquals(
+            1,
+            $updatedWishlist->getItemsCount(),
+            'Wishlist must contain a product which was added to it earlier.'
+        );
+
+        /** Try to load wishlist from cache in the class after it is deleted from DB */
+        $wishlist->delete();
+        $this->assertSame(
+            $updatedWishlist,
+            $this->_model->getCustomerWishlist(false),
+            'Wishlist cached in class variable is expected to be returned.'
+        );
+        $this->assertNotSame(
+            $updatedWishlist,
+            $this->_model->getCustomerWishlist(true),
+            'New wishlist is expected to be created when cache is forced to be refreshed.'
+        );
+    }
+
+    /**
+     * @magentoDbIsolation enabled
+     */
+    public function testSetBillingAddress()
+    {
+        $addressData = $this->_getValidAddressData();
+        /** Validate data before creating address object */
+        $this->_model->setIsValidate(true)->setBillingAddress($addressData);
+        $this->assertInstanceOf(
+            'Magento\Sales\Model\Quote\Address',
+            $this->_model->getBillingAddress(),
+            'Billing address object was not created.'
+        );
+
+        $expectedAddressData = array_merge(
+            $addressData,
+            ['address_type' => 'billing', 'quote_id' => null, 'street' => "Line1\nLine2", 'save_in_address_book' => 0]
+        );
+        $this->assertEquals(
+            $expectedAddressData,
+            $this->_model->getBillingAddress()->getData(),
+            'Created billing address is invalid.'
+        );
+    }
+
+    /**
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoAppIsolation enabled
+     * @magentoDbIsolation enabled
+     */
+    public function testSetBillingAddressValidationErrors()
+    {
+        $customerIdFromFixture = 1;
+        /** @var \Magento\Backend\Model\Session\Quote $session */
+        $session = Bootstrap::getObjectManager()->create('Magento\Backend\Model\Session\Quote');
+        $session->setCustomerId($customerIdFromFixture);
+        $invalidAddressData = array_merge($this->_getValidAddressData(), ['firstname' => '', 'lastname' => '']);
+        /**
+         * Note that validation errors are collected during setBillingAddress() call in the internal class variable,
+         * but they are not set to message manager at this step.
+         * They are set to message manager only during createOrder() call.
+         */
+        $this->_model->setIsValidate(true)->setBillingAddress($invalidAddressData);
+        try{
+            $this->_model->createOrder();
+            $this->fail('Validation errors are expected to lead to exception during createOrder() call.');
+        } catch (\Magento\Core\Exception $e) {
+            /** createOrder is expected to throw exception with empty message when validation error occurs */
+        }
+        $errorMessages = [];
+        /** @var $validationError \Magento\Message\Error */
+        foreach ($this->_messageManager->getMessages()->getItems() as $validationError) {
+            $errorMessages[] = $validationError->getText();
+        }
+        $this->assertTrue(
+            in_array('Billing Address: "First Name" is a required value.', $errorMessages),
+            'Expected validation message is absent.'
+        );
+        $this->assertTrue(
+            in_array('Billing Address: "Last Name" is a required value.', $errorMessages),
+            'Expected validation message is absent.'
+        );
+    }
+
+    /**
+     * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+     * @magentoDbIsolation enabled
+     * @magentoAppIsolation enabled
+     */
+    public function testCreateOrderNewCustomerDifferentAddresses()
+    {
+        $productIdFromFixture = 1;
+        $shippingMethod = 'freeshipping_freeshipping';
+        $paymentMethod = 'checkmo';
+        $shippingAddressAsBilling = 0;
+        $customerEmail = 'new_customer@example.com';
+        $firstNameForShippingAddress = 'FirstNameForShipping';
+        $orderData = [
+            'currency' => 'USD',
+            'account' => [
+                'group_id' => '1',
+                'email' => $customerEmail
+            ],
+            'billing_address' => array_merge($this->_getValidAddressData(), ['save_in_address_book' => '1']),
+            'shipping_address' => array_merge(
+                $this->_getValidAddressData(),
+                ['save_in_address_book' => '1', 'firstname' => $firstNameForShippingAddress]
+            ),
+            'shipping_method' => $shippingMethod,
+            'comment' => ['customer_note' => ''],
+            'send_confirmation' => true
+        ];
+        $paymentData = ['method' => $paymentMethod];
+
+        $this->_preparePreconditionsForCreateOrder(
+            $productIdFromFixture,
+            $customerEmail,
+            $shippingMethod,
+            $shippingAddressAsBilling,
+            $paymentData,
+            $orderData,
+            $paymentMethod
+        );
+        $order = $this->_model->createOrder();
+        $this->_verifyCreatedOrder($order, $shippingMethod);
+        /** @var \Magento\Customer\Model\Customer $customer */
+        $customer = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Customer');
+        $customer->load($order->getCustomerId());
+        $this->assertEquals(
+            $firstNameForShippingAddress,
+            $customer->getPrimaryShippingAddress()->getFirstname(),
+            'Shipping address is saved incorrectly.'
+        );
+    }
+
+    /**
+     * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+     * @magentoDbIsolation enabled
+     * @magentoAppIsolation enabled
+     */
+    public function testCreateOrderNewCustomer()
+    {
+        $productIdFromFixture = 1;
+        $shippingMethod = 'freeshipping_freeshipping';
+        $paymentMethod = 'checkmo';
+        $shippingAddressAsBilling = 1;
+        $customerEmail = 'new_customer@example.com';
+        $orderData = [
+            'currency' => 'USD',
+            'account' => [
+                'group_id' => '1',
+                'email' => $customerEmail
+            ],
+            'billing_address' => array_merge($this->_getValidAddressData(), ['save_in_address_book' => '1']),
+            'shipping_method' => $shippingMethod,
+            'comment' => ['customer_note' => ''],
+            'send_confirmation' => false
+        ];
+        $paymentData = ['method' => $paymentMethod];
+
+        $this->_preparePreconditionsForCreateOrder(
+            $productIdFromFixture,
+            $customerEmail,
+            $shippingMethod,
+            $shippingAddressAsBilling,
+            $paymentData,
+            $orderData,
+            $paymentMethod
+        );
+        $order = $this->_model->createOrder();
+        $this->_verifyCreatedOrder($order, $shippingMethod);
+    }
+
+    /**
+     * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDbIsolation enabled
+     * @magentoAppIsolation enabled
+     */
+    public function testCreateOrderExistingCustomerDifferentAddresses()
+    {
+        $productIdFromFixture = 1;
+        $customerIdFromFixture = 1;
+        $customerEmailFromFixture = 'customer@example.com';
+        $shippingMethod = 'freeshipping_freeshipping';
+        $paymentMethod = 'checkmo';
+        $shippingAddressAsBilling = 0;
+        $firstNameForShippingAddress = 'FirstNameForShipping';
+        $orderData = [
+            'currency' => 'USD',
+            'billing_address' => array_merge($this->_getValidAddressData(), ['save_in_address_book' => '1']),
+            'shipping_address' => array_merge(
+                $this->_getValidAddressData(),
+                ['save_in_address_book' => '1', 'firstname' => $firstNameForShippingAddress]
+            ),
+            'shipping_method' => $shippingMethod,
+            'comment' => ['customer_note' => ''],
+            'send_confirmation' => false
+        ];
+        $paymentData = ['method' => $paymentMethod];
+
+        $this->_preparePreconditionsForCreateOrder(
+            $productIdFromFixture,
+            $customerEmailFromFixture,
+            $shippingMethod,
+            $shippingAddressAsBilling,
+            $paymentData,
+            $orderData,
+            $paymentMethod,
+            $customerIdFromFixture
+        );
+        $order = $this->_model->createOrder();
+        $this->_verifyCreatedOrder($order, $shippingMethod);
+        /** @var \Magento\Customer\Model\Customer $customer */
+        $customer = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Customer');
+        $customer->load($order->getCustomerId());
+        $this->assertEquals(
+            $firstNameForShippingAddress,
+            $customer->getDefaultShippingAddress()->getFirstname(),
+            'Shipping address is saved incorrectly.'
+        );
+    }
+
+    /**
+     * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDbIsolation enabled
+     * @magentoAppIsolation enabled
+     */
+    public function testCreateOrderExistingCustomer()
+    {
+        $productIdFromFixture = 1;
+        $customerIdFromFixture = 1;
+        $customerEmailFromFixture = 'customer@example.com';
+        $shippingMethod = 'freeshipping_freeshipping';
+        $paymentMethod = 'checkmo';
+        $shippingAddressAsBilling = 1;
+        $orderData = [
+            'currency' => 'USD',
+            'billing_address' => array_merge($this->_getValidAddressData(), ['save_in_address_book' => '1']),
+            'shipping_method' => $shippingMethod,
+            'comment' => ['customer_note' => ''],
+            'send_confirmation' => false
+        ];
+        $paymentData = ['method' => $paymentMethod];
+
+        $this->_preparePreconditionsForCreateOrder(
+            $productIdFromFixture,
+            $customerEmailFromFixture,
+            $shippingMethod,
+            $shippingAddressAsBilling,
+            $paymentData,
+            $orderData,
+            $paymentMethod,
+            $customerIdFromFixture
+        );
+        $order = $this->_model->createOrder();
+        $this->_verifyCreatedOrder($order, $shippingMethod);
+    }
+
+    /**
+     * @magentoAppIsolation enabled
+     * @magentoDataFixture Magento/Sales/_files/quote.php
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     */
+    public function testGetCustomerCartExistingCart()
+    {
+        $fixtureCustomerId = 1;
+
+        /** Preconditions */
+        /** @var \Magento\Backend\Model\Session\Quote $session */
+        $session = Bootstrap::getObjectManager()->create('Magento\Backend\Model\Session\Quote');
+        $session->setCustomerId($fixtureCustomerId);
+        /** @var $quoteFixture \Magento\Sales\Model\Quote */
+        $quoteFixture = Bootstrap::getObjectManager()->create('Magento\Sales\Model\Quote');
+        $quoteFixture->load('test01', 'reserved_order_id');
+        $quoteFixture->setCustomerIsGuest(false)->setCustomerId($fixtureCustomerId)->save();
+
+        /** SUT execution */
+        $customerQuote = $this->_model->getCustomerCart();
+        $this->assertEquals($quoteFixture->getId(), $customerQuote->getId(), 'Quote ID is invalid.');
+
+        /** Try to load quote once again to ensure that caching works correctly */
+        $customerQuoteFromCache = $this->_model->getCustomerCart();
+        $this->assertSame($customerQuote, $customerQuoteFromCache, 'Customer quote caching does not work correctly.');
+    }
+
+    /**
+     * @magentoAppIsolation enabled
+     * @magentoDbIsolation enabled
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     */
+    public function testGetCustomerCartNewCart()
+    {
+        $customerIdFromFixture = 1;
+        $customerEmailFromFixture = 'customer@example.com';
+
+        /** Preconditions */
+        /** @var \Magento\Backend\Model\Session\Quote $session */
+        $session = Bootstrap::getObjectManager()->create('Magento\Backend\Model\Session\Quote');
+        $session->setCustomerId($customerIdFromFixture);
+
+        /** SUT execution */
+        $customerQuote = $this->_model->getCustomerCart();
+        $this->assertNotEmpty($customerQuote->getId(), 'Quote ID is invalid.');
+        $this->assertEquals(
+            $customerEmailFromFixture,
+            $customerQuote->getCustomerEmail(),
+            'Customer data is preserved incorrectly in a newly quote.'
+        );
+    }
+
+    /**
+     * Prepare preconditions for createOrder method invocation.
+     *
+     * @param int $productIdFromFixture
+     * @param string $customerEmail
+     * @param string $shippingMethod
+     * @param int $shippingAddressAsBilling
+     * @param array $paymentData
+     * @param array $orderData
+     * @param string $paymentMethod
+     * @param int|null $customerIdFromFixture
+     */
+    protected function _preparePreconditionsForCreateOrder(
+        $productIdFromFixture,
+        $customerEmail,
+        $shippingMethod,
+        $shippingAddressAsBilling,
+        $paymentData,
+        $orderData,
+        $paymentMethod,
+        $customerIdFromFixture = null
+    ) {
+        /** Disable product options */
+        /** @var \Magento\Catalog\Model\Product $product */
+        $product = Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product');
+        $product->load($productIdFromFixture)->setHasOptions(false)->save();
+
+        /** Set current customer */
+        /** @var \Magento\Backend\Model\Session\Quote $session */
+        $session = Bootstrap::getObjectManager()->get('Magento\Backend\Model\Session\Quote');
+        if (!is_null($customerIdFromFixture)) {
+            $session->setCustomerId($customerIdFromFixture);
+
+            /** Unset fake IDs for default billing and shipping customer addresses */
+            /** @var \Magento\Customer\Model\Customer $customer */
+            $customer = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Customer');
+            $customer->load($customerIdFromFixture)->setDefaultBilling(null)->setDefaultShipping(null)->save();
+        } else {
+            /**
+             * Customer ID must be set to session to pass \Magento\Sales\Model\AdminOrder\Create::_validate()
+             * This code emulates order placement via admin panel.
+             */
+            $session->setCustomerId(0);
+        }
+
+        /** Emulate availability of shipping method (all are disabled by default) */
+        /** @var $rate \Magento\Sales\Model\Quote\Address\Rate */
+        $rate = Bootstrap::getObjectManager()->create('Magento\Sales\Model\Quote\Address\Rate');
+        $rate->setCode($shippingMethod);
+        $this->_model->getQuote()->getShippingAddress()->addShippingRate($rate);
+
+        $this->_model->setShippingAsBilling($shippingAddressAsBilling);
+        $this->_model->addProduct($productIdFromFixture, ['qty' => 1]);
+        $this->_model->setPaymentData($paymentData);
+        $this->_model->setIsValidate(true)->importPostData($orderData);
+
+        /** Check preconditions */
+
+        $this->assertEquals(
+            0,
+            $this->_messageManager->getMessages()->getCount(),
+            "Precondition failed: Errors occurred before SUT execution."
+        );
+        /** Selectively check quote data */
+        $createOrderData = $this->_model->getData();
+        $this->assertEquals(
+            $shippingMethod,
+            $createOrderData['shipping_method'],
+            'Precondition failed: Shipping method specified in create order model is invalid'
+        );
+        $this->assertEquals(
+            'FirstName',
+            $createOrderData['billing_address']['firstname'],
+            'Precondition failed: Address data is invalid in create order model'
+        );
+        $this->assertEquals(
+            'Simple Product',
+            $this->_model->getQuote()->getAllItems()[0]->getData('name'),
+            'Precondition failed: Quote items data is invalid in create order model'
+        );
+        $this->assertEquals(
+            $customerEmail,
+            $this->_model->getQuote()->getCustomer()->getData('email'),
+            'Precondition failed: Customer data is invalid in create order model'
+        );
+        $this->assertEquals(
+            $paymentMethod,
+            $this->_model->getQuote()->getPaymentsCollection()->getItems()[0]->getData('method'),
+            'Precondition failed: Payment method data is invalid in create order model'
+        );
+    }
+
+    /**
+     * Ensure that order is created correctly via createOrder().
+     *
+     * @param \Magento\Sales\Model\Order $order
+     * @param string $shippingMethod
+     */
+    protected function _verifyCreatedOrder($order, $shippingMethod)
+    {
+        /** Selectively check order data */
+        $orderData = $order->getData();
+        $this->assertNotEmpty($orderData['increment_id'], 'Order increment ID is empty.');
+        $this->assertEquals($this->_model->getQuote()->getId(), $orderData['quote_id'], 'Quote ID is invalid.');
+        $this->assertEquals(
+            $this->_model->getQuote()->getCustomer()->getEmail(),
+            $orderData['customer_email'],
+            'Customer email is invalid.'
+        );
+        $this->assertEquals(
+            $this->_model->getQuote()->getCustomer()->getFirstname(),
+            $orderData['customer_firstname'],
+            'Customer first name is invalid.'
+        );
+        $this->assertEquals(
+            $shippingMethod,
+            $orderData['shipping_method'],
+            'Customer first name is invalid.'
+        );
+    }
+
+    /**
+     * Get valid address data for address creation.
+     *
+     * @return array
+     */
+    protected function _getValidAddressData()
+    {
+        return [
+            'prefix' => 'prefix',
+            'firstname' => 'FirstName',
+            'middlename' => 'MiddleName',
+            'lastname' => 'LastName',
+            'suffix' => 'suffix',
+            'company' => 'Company Name',
+            'street' => [
+                0 => 'Line1',
+                1 => 'Line2',
+            ],
+            'city' => 'City',
+            'country_id' => 'US',
+            'region' => '',
+            'region_id' => '1',
+            'postcode' => '76868',
+            'telephone' => '+8709273498729384',
+            'fax' => '',
+            'vat_id' => '',
+        ];
+    }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Observer/Backend/CustomerQuoteTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Observer/Backend/CustomerQuoteTest.php
new file mode 100644
index 00000000000..c564171eefb
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Observer/Backend/CustomerQuoteTest.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Sales\Model\Observer\Backend;
+
+use Magento\TestFramework\Helper\Bootstrap;
+
+/**
+ * @magentoAppArea adminhtml
+ */
+class CustomerQuoteTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Ensure that customer group is updated in customer quote, when it is changed for the customer.
+     *
+     * @magentoDataFixture Magento/Sales/_files/quote.php
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     */
+    public function testCustomerSaveQuoteObserver()
+    {
+        /** @var \Magento\Customer\Model\Customer $customer */
+        $customer = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Customer');
+        $customer->load(1);
+
+        /** @var \Magento\Sales\Model\Quote $quote */
+        $quote = Bootstrap::getObjectManager()->create('Magento\Sales\Model\Quote');
+        $quote->load('test01', 'reserved_order_id');
+        $quote->setCustomerIsGuest(false)->setCustomerId(1)->setCustomerGroupId($customer->getGroupId())->save();
+
+        $this->assertNotNull($customer->getGroupId(), "Precondition failed: Customer group is not set.");
+        $this->assertEquals(
+            $customer->getGroupId(),
+            $quote->getCustomerGroupId(),
+            "Precondition failed: Customer group in quote is invalid."
+        );
+
+        /**
+         * 'customer_save_after_dto' event is expected to be dispatched when customer save is invoked.
+         * \Magento\Sales\Model\Observer\Backend\CustomerQuote::dispatch() is an observer of this event.
+         */
+        $newCustomerGroupId = 2;
+        $customer->setGroupId($newCustomerGroupId)->save();
+
+        $quote->load('test01', 'reserved_order_id');
+        $this->assertEquals(
+            $newCustomerGroupId,
+            $quote->getCustomerGroupId(),
+            'Customer group in quote was not updated on "customer_save_after_dto" event '
+                . 'by Magento\Sales\Model\Observer\Backend\CustomerQuote::dispatch().'
+        );
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Quote/AddressTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Quote/AddressTest.php
index 9fcb90060ce..4cf2fdf7f72 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Quote/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Quote/AddressTest.php
@@ -27,10 +27,11 @@
 
 namespace Magento\Sales\Model\Quote;
 
+use Magento\TestFramework\Helper\Bootstrap;
+
 /**
- * @magentoDataFixture Magento/Customer/_files/customer.php
+ * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php
  * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
- * @magentoDataFixture Magento/Sales/_files/quote.php
  */
 class AddressTest extends \PHPUnit_Framework_TestCase
 {
@@ -40,6 +41,9 @@ class AddressTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Customer\Model\Customer $customer */
     protected $_customer;
 
+    /** @var \Magento\Sales\Model\Quote\Address */
+    protected $_address;
+
     /**
      * Initialize quote and customer fixtures
      */
@@ -54,6 +58,12 @@ class AddressTest extends \PHPUnit_Framework_TestCase
         $this->_customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\Customer\Model\Customer');
         $this->_customer->load(1);
+
+        /** @var \Magento\Sales\Model\Order\Address $address */
+        $this->_address = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\Sales\Model\Quote\Address');
+        $this->_address->load(1);
+        $this->_address->setQuote($this->_quote);
     }
 
     /**
@@ -116,13 +126,16 @@ class AddressTest extends \PHPUnit_Framework_TestCase
      *
      * @param bool $unsetId
      * @dataProvider unsetAddressIdDataProvider
+     * @magentoDbIsolation enabled
      */
     public function testSameAsBillingWhenCustomerHasNoDefaultShippingAddress($unsetId)
     {
-        $this->_customer->setDefaultShipping(-1);
+        $this->_customer->setDefaultShipping(-1)
+            ->save(); // we should save the customer data in order to be able to use it
         $this->_quote->setCustomer($this->_customer);
         $this->_setCustomerAddressAndSave($unsetId);
-        $this->assertEquals((int)$unsetId, $this->_quote->getShippingAddress()->getSameAsBilling());
+        $sameAsBilling = $this->_quote->getShippingAddress()->getSameAsBilling();
+        $this->assertEquals((int)$unsetId, $sameAsBilling);
     }
 
     /**
@@ -130,6 +143,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
      *
      * @param bool $unsetId
      * @dataProvider unsetAddressIdDataProvider
+     * @magentoDbIsolation enabled
      */
     public function testSameAsBillingWhenCustomerHasBillingSameShipping($unsetId)
     {
@@ -143,13 +157,16 @@ class AddressTest extends \PHPUnit_Framework_TestCase
      *
      * @param bool $unsetId
      * @dataProvider unsetAddressIdDataProvider
+     * @magentoDbIsolation enabled
      */
     public function testSameAsBillingWhenCustomerHasDefaultShippingAddress($unsetId)
     {
-        $this->_customer->setDefaultShipping(2);
+        $this->_customer->setDefaultShipping(2)
+            ->save(); // we should save the customer data in order to be able to use it
         $this->_quote->setCustomer($this->_customer);
         $this->_setCustomerAddressAndSave($unsetId);
-        $this->assertEquals(0, $this->_quote->getShippingAddress()->getSameAsBilling());
+        $sameAsBilling = $this->_quote->getShippingAddress()->getSameAsBilling();
+        $this->assertEquals(0, $sameAsBilling);
     }
 
     /**
@@ -175,4 +192,98 @@ class AddressTest extends \PHPUnit_Framework_TestCase
             array(false),
         );
     }
+
+    /**
+     * Import customer address to quote address
+     */
+    public function testImportCustomerAddressDataWithCustomer()
+    {
+        $customerIdFromFixture = 1;
+        $customerEmailFromFixture = 'customer@example.com';
+        $city = 'TestCity';
+        $street = 'Street1';
+
+        /** @var \Magento\Customer\Service\V1\Dto\AddressBuilder $addressBuilder */
+        $addressBuilder = Bootstrap::getObjectManager()->create('Magento\Customer\Service\V1\Dto\AddressBuilder');
+        $addressDto = $addressBuilder
+            ->setCustomerId($customerIdFromFixture)
+            ->setCity($city)
+            ->setStreet($street)
+            ->create();
+        $this->_address->setQuote($this->_quote);
+        $this->_address->importCustomerAddressData($addressDto);
+
+        $this->assertEquals($customerEmailFromFixture, $this->_address->getEmail(), 'Email was imported incorrectly.');
+        $this->assertEquals(
+            $city,
+            $this->_address->getCity(),
+            'City was imported incorrectly.'
+        );
+        $this->assertEquals(
+            $street,
+            $this->_address->getStreetFull(),
+            'Imported street is invalid.'
+        );
+    }
+
+    /**
+     * Export customer address from quote address
+     */
+    public function testExportCustomerAddressData()
+    {
+        $street = ['Street1'];
+        $company = 'TestCompany';
+
+        $this->_address->setStreet($street);
+        $this->_address->setCompany($company);
+
+        $customerAddress = $this->_address->exportCustomerAddressData();
+
+        $this->assertEquals($street, $customerAddress->getStreet(), 'Street was exported incorrectly.');
+        $this->assertEquals($company, $customerAddress->getCompany(), 'Company was exported incorrectly.');
+    }
+
+    /**
+     * Import order address to quote address
+     */
+    public function testImportOrderAddress()
+    {
+        $street = 'Street1';
+        $email = 'test_email@example.com';
+
+        /** @var \Magento\Sales\Model\Order\Address $orderAddress */
+        $orderAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\Sales\Model\Order\Address');
+
+        $orderAddress->setStreet($street);
+        $orderAddress->setEmail($email);
+        $this->_address->importOrderAddress($orderAddress);
+
+        $this->assertEquals($street, $this->_address->getStreet1(), 'Expected street does not exists');
+        $this->assertEquals($email, $orderAddress->getEmail(), 'Expected email does not exists');
+    }
+
+    public function testPopulateBeforeSaveData()
+    {
+        /** Preconditions */
+        $customerId = 1;
+        $customerAddressId = 1;
+
+        $this->_address->setQuote($this->_quote);
+        $this->assertNotEquals($customerId, $this->_address->getCustomerId(),
+            "Precondition failed: Customer ID was not set.");
+        $this->assertNotEquals(1, $this->_address->getQuoteId(), "Precondition failed: Quote ID was not set.");
+        $this->assertNotEquals($customerAddressId, $this->_address->getCustomerAddressId(),
+            "Precondition failed: Customer address ID was not set.");
+
+        /** @var \Magento\Customer\Model\Address $customerAddress */
+        $customerAddress = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Address');
+        $customerAddress->setId($customerAddressId);
+        $this->_address->setCustomerAddress($customerAddress);
+        $this->_address->save();
+
+        $this->assertEquals($customerId, $this->_address->getCustomerId());
+        $this->assertEquals($this->_quote->getId(), $this->_address->getQuoteId());
+        $this->assertEquals($customerAddressId, $this->_address->getCustomerAddressId());
+    }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/QuoteTest.php
index 7880356e0d6..7d1cd8e8342 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/QuoteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/QuoteTest.php
@@ -50,4 +50,72 @@ class QuoteTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(20, $quote->getGrandTotal());
         $this->assertEquals(20, $quote->getBaseGrandTotal());
     }
+
+    public function testSetCustomerData()
+    {
+        /** @var \Magento\Sales\Model\Quote $quote */
+        $quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\Sales\Model\Quote');
+
+        $customerBuilder = new \Magento\Customer\Service\V1\Dto\CustomerBuilder();
+        $expected = $this->_getCustomerDataArray();
+        $customerBuilder->populateWithArray($expected);
+
+        $customerDataSet = $customerBuilder->create();
+        $this->assertEquals($expected, $customerDataSet->__toArray());
+        $quote->setCustomerData($customerDataSet);
+
+        $customerDataRetrieved = $quote->getCustomerData();
+        $this->assertEquals($expected, $customerDataRetrieved->__toArray());
+        $this->assertEquals('qa@example.com', $quote->getCustomerEmail());
+    }
+
+    public function testUpdateCustomerData()
+    {
+        /** @var \Magento\Sales\Model\Quote $quote */
+        $quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\Sales\Model\Quote');
+
+        $customerBuilder = new \Magento\Customer\Service\V1\Dto\CustomerBuilder();
+        $expected = $this->_getCustomerDataArray();
+
+        $customerBuilder->populateWithArray($expected);
+        $customerDataSet = $customerBuilder->create();
+        $this->assertEquals($expected, $customerDataSet->__toArray());
+        $quote->setCustomerData($customerDataSet);
+
+        $expected[\Magento\Customer\Service\V1\Dto\Customer::EMAIL] = 'test@example.com';
+        $customerBuilder->populateWithArray($expected);
+        $customerDataUpdated = $customerBuilder->create();
+
+        $quote->updateCustomerData($customerDataUpdated);
+        $customerDataRetrieved = $quote->getCustomerData();
+        $this->assertEquals($expected, $customerDataRetrieved->__toArray());
+        $this->assertEquals('test@example.com', $quote->getCustomerEmail());
+    }
+
+    protected function _getCustomerDataArray()
+    {
+        return [
+            \Magento\Customer\Service\V1\Dto\Customer::ID => 1,
+            \Magento\Customer\Service\V1\Dto\Customer::CONFIRMATION => 'test',
+            \Magento\Customer\Service\V1\Dto\Customer::CREATED_AT => '2/3/2014',
+            \Magento\Customer\Service\V1\Dto\Customer::CREATED_IN => 'Default',
+            \Magento\Customer\Service\V1\Dto\Customer::DEFAULT_BILLING => 'test',
+            \Magento\Customer\Service\V1\Dto\Customer::DEFAULT_SHIPPING => 'test',
+            \Magento\Customer\Service\V1\Dto\Customer::DOB => '2/3/2014',
+            \Magento\Customer\Service\V1\Dto\Customer::EMAIL => 'qa@example.com',
+            \Magento\Customer\Service\V1\Dto\Customer::FIRSTNAME => 'Joe',
+            \Magento\Customer\Service\V1\Dto\Customer::GENDER => 'Male',
+            \Magento\Customer\Service\V1\Dto\Customer::GROUP_ID
+            => \Magento\Customer\Service\V1\CustomerGroupService::NOT_LOGGED_IN_ID,
+            \Magento\Customer\Service\V1\Dto\Customer::LASTNAME => 'Dou',
+            \Magento\Customer\Service\V1\Dto\Customer::MIDDLENAME => 'Ivan',
+            \Magento\Customer\Service\V1\Dto\Customer::PREFIX => 'Dr.',
+            \Magento\Customer\Service\V1\Dto\Customer::STORE_ID => 1,
+            \Magento\Customer\Service\V1\Dto\Customer::SUFFIX => 'Jr.',
+            \Magento\Customer\Service\V1\Dto\Customer::TAXVAT => 1,
+            \Magento\Customer\Service\V1\Dto\Customer::WEBSITE_ID => 1
+        ];
+    }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/Report/Order/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/Report/Order/CollectionTest.php
index adf76cdb856..a4294ccf1e4 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/Report/Order/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/Report/Order/CollectionTest.php
@@ -44,6 +44,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
 
     /**
      * @magentoDataFixture Magento/Sales/_files/invoice.php
+     * @magentoDataFixture Magento/Sales/_files/invoice_fixture_store_order.php
      * @magentoDataFixture Magento/Sales/_files/report_order.php
      */
     public function testGetItems()
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/Sale/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/Sale/CollectionTest.php
new file mode 100644
index 00000000000..16beb72e055
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/Sale/CollectionTest.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Sales\Model\Resource\Sale;
+
+use Magento\TestFramework\Helper\Bootstrap;
+
+class CollectionTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @magentoDataFixture Magento/Sales/_files/order_with_customer.php
+     */
+    public function testSetCustomerFilter()
+    {
+        $collectionModel = Bootstrap::getObjectManager()->create('Magento\Sales\Model\Resource\Sale\Collection');
+        $this->assertEquals(1, $collectionModel->setCustomerFilter(1)->count());
+        $collectionModel = Bootstrap::getObjectManager()->create('Magento\Sales\Model\Resource\Sale\Collection');
+        $this->assertEquals(0, $collectionModel->setCustomerFilter(2)->count());
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Service/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Service/QuoteTest.php
new file mode 100644
index 00000000000..fcda438e2fc
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Service/QuoteTest.php
@@ -0,0 +1,349 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Sales\Model\Service;
+
+use Magento\TestFramework\Helper\Bootstrap;
+use Magento\Customer\Service\V1\Dto\CustomerBuilder;
+use Magento\Customer\Service\V1\Dto\AddressBuilder;
+use Magento\Customer\Service\V1\Dto\Region;
+use Magento\Customer\Service\V1\Dto\Customer as CustomerDto;
+use Magento\Customer\Service\V1\CustomerAccountServiceInterface;
+use Magento\Customer\Service\V1\CustomerServiceInterface;
+use Magento\Customer\Service\V1\CustomerAddressServiceInterface;
+
+/**
+ * @magentoAppArea adminhtml
+ */
+class QuoteTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Sales\Model\Service\Quote
+     */
+    protected $_serviceQuote;
+
+    /**
+     * @var CustomerBuilder
+     */
+    private $_customerBuilder;
+
+    /**
+     * @var CustomerServiceInterface
+     */
+    protected $_customerService;
+
+    /**
+     * @var CustomerAccountServiceInterface
+     */
+    protected $_customerAccountService;
+
+    /**
+     * @var CustomerAddressServiceInterface
+     */
+    protected $_customerAddressService;
+
+    /**
+     * @var AddressBuilder
+     */
+    protected $_customerAddressBuilder;
+
+
+    public function setUp()
+    {
+        $this->_addressBuilder = Bootstrap::getObjectManager()->get(
+            'Magento\Customer\Service\V1\Dto\AddressBuilder'
+        );
+        $this->_customerBuilder = Bootstrap::getObjectManager()->get(
+            'Magento\Customer\Service\V1\Dto\CustomerBuilder'
+        );
+        $this->_customerAccountService = Bootstrap::getObjectManager()->get(
+            'Magento\Customer\Service\V1\CustomerAccountService'
+        );
+        $this->_customerService = Bootstrap::getObjectManager()->get(
+            'Magento\Customer\Service\V1\CustomerService'
+        );
+        $this->_customerAddressService = Bootstrap::getObjectManager()->get(
+            'Magento\Customer\Service\V1\CustomerAddressService'
+        );
+    }
+
+    /**
+     * @magentoDataFixture Magento/Sales/_files/quote.php
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     */
+    public function testSubmitGuestOrder()
+    {
+        $this->_prepareQuote(true);
+        /** @var $order \Magento\Sales\Model\Order */
+        $order = $this->_serviceQuote->submitOrderWithDto();
+        //Makes sure that the customer for guest checkout is not saved
+        $this->assertNull($order->getCustomerId());
+    }
+
+    /**
+     * @magentoDataFixture Magento/Sales/_files/quote.php
+     * @expectedException \Magento\Exception\InputException
+     * @expectedExceptionMessage One or more input exceptions have occurred.
+     */
+    public function testSubmitOrderInvalidCustomerData()
+    {
+        $this->_prepareQuote(false);
+        /** @var $order \Magento\Sales\Model\Order */
+        $this->_serviceQuote->submitOrderWithDto();
+    }
+
+    /**
+     * @magentoDataFixture Magento/Sales/_files/quote.php
+     */
+    public function testSubmitOrderExistingCustomer()
+    {
+        $this->_prepareQuote(false);
+
+        $response = $this->_customerAccountService->createAccount(
+            $this->getSampleCustomerEntity(),
+            $this->getSampleAddressEntity(),
+            'password'
+        );
+
+        $this->assertEquals('registered', $response->getStatus());
+
+        $existingCustomerId = $response->getCustomerId();
+        $customerDto = $this->_customerService->getCustomer($existingCustomerId);
+        $customerDto = $this->_customerBuilder->mergeDtoWithArray(
+            $customerDto,
+            [CustomerDto::EMAIL => 'new@example.com']
+        );
+        $addresses = $this->_customerAddressService->getAddresses($existingCustomerId);
+        $this->_serviceQuote->getQuote()->setCustomerData($customerDto);
+        $this->_serviceQuote->getQuote()->setCustomerAddressData($addresses);
+        $this->_serviceQuote->submitOrderWithDto();
+        $customerId = $this->_serviceQuote->getQuote()->getCustomerData()->getCustomerId();
+        $this->assertNotNull($customerId);
+        //Make sure no new customer is created
+        $this->assertEquals($existingCustomerId, $customerId);
+        $customerDto = $this->_customerService->getCustomer($existingCustomerId);
+        $this->assertEquals('new@example.com', $customerDto->getEmail());
+    }
+
+    /**
+     * @magentoDbIsolation enabled
+     * @magentoDataFixture Magento/Sales/_files/quote.php
+     */
+    public function testSubmitOrderNewCustomer()
+    {
+        $this->_prepareQuote(false);
+        $this->_serviceQuote->getQuote()->setCustomerData($this->getSampleCustomerEntity());
+        $this->_serviceQuote->getQuote()->setCustomerAddressData($this->getSampleAddressEntity());
+        $this->_serviceQuote->submitOrderWithDto();
+        $customerId = $this->_serviceQuote->getQuote()->getCustomerData()->getCustomerId();
+        $this->assertNotNull($customerId);
+        foreach ($this->_serviceQuote->getQuote()->getCustomerAddressData() as $address) {
+            $this->assertNotNull($address->getId());
+            $this->assertEquals($customerId, $address->getCustomerId());
+        }
+    }
+
+    /**
+     * @magentoAppArea adminhtml
+     * @magentoDbIsolation enabled
+     * @magentoAppIsolation enabled
+     * @magentoDataFixture Magento/Sales/_files/quote.php
+     */
+    public function testSubmitOrderRollbackNewCustomer()
+    {
+        $this->_prepareQuoteWithMockTransaction();
+        $this->_serviceQuote->getQuote()->setCustomerData($this->getSampleCustomerEntity());
+        $this->_serviceQuote->getQuote()->setCustomerAddressData($this->getSampleAddressEntity());
+        try {
+            $this->_serviceQuote->submitOrderWithDto();
+        } catch (\Exception $e) {
+            $this->assertEquals('submitorder exception', $e->getMessage());
+        }
+        $this->assertNull($this->_serviceQuote->getQuote()->getCustomerData()->getCustomerId());
+    }
+
+    /**
+     * @magentoAppArea adminhtml
+     * @magentoAppIsolation enabled
+     * @magentoDataFixture Magento/Sales/_files/quote.php
+     */
+    public function testSubmitOrderRollbackExistingCustomer()
+    {
+        $this->_prepareQuoteWithMockTransaction();
+        $response = $this->_customerAccountService->createAccount(
+            $this->getSampleCustomerEntity(),
+            $this->getSampleAddressEntity(),
+            'password'
+        );
+        $this->assertEquals('registered', $response->getStatus());
+
+        $existingCustomerId = $response->getCustomerId();
+        $customerDto = $this->_customerService->getCustomer($existingCustomerId);
+        $customerDto = $this->_customerBuilder->mergeDtoWithArray(
+            $customerDto,
+            [CustomerDto::EMAIL => 'new@example.com']
+        );
+        $addresses = $this->_customerAddressService->getAddresses($existingCustomerId);
+        $this->_serviceQuote->getQuote()->setCustomerData($customerDto);
+        $this->_serviceQuote->getQuote()->setCustomerAddressData($addresses);
+        try {
+            $this->_serviceQuote->submitOrderWithDto();
+        } catch (\Exception $e) {
+            $this->assertEquals('submitorder exception', $e->getMessage());
+        }
+        $this->assertEquals('email@example.com', $this->_customerService->getCustomer($existingCustomerId)->getEmail());
+    }
+
+    /**
+     * Function to setup Quote for order
+     *
+     * @param bool $customerIsGuest
+     */
+    private function _prepareQuote($customerIsGuest)
+    {
+        $quoteFixture = $this->_prepareQuoteFixture($customerIsGuest);
+        $this->_serviceQuote = Bootstrap::getObjectManager()->create(
+            'Magento\Sales\Model\Service\Quote',
+            array('quote' => $quoteFixture)
+        );
+    }
+
+    /**
+     * Prepare quote data
+     *
+     * @param bool $customerIsGuest
+     * @return \Magento\Sales\Model\Quote
+     */
+    private function _prepareQuoteFixture($customerIsGuest)
+    {
+        $method = 'freeshipping_freeshipping';
+        /** @var $quoteFixture \Magento\Sales\Model\Quote */
+        $quoteFixture = Bootstrap::getObjectManager()->create('Magento\Sales\Model\Quote');
+        $quoteFixture->load('test01', 'reserved_order_id');
+        $rate = Bootstrap::getObjectManager()->create('Magento\Sales\Model\Quote\Address\Rate');
+        $rate->setCode($method);
+        $quoteFixture->getShippingAddress()->addShippingRate($rate);
+        $quoteFixture->getShippingAddress()->setShippingMethod($method);
+        $quoteFixture->setCustomerIsGuest($customerIsGuest);
+        return $quoteFixture;
+    }
+
+    /**
+     * Sample customer data
+     *
+     * @return CustomerDto
+     */
+    private function getSampleCustomerEntity()
+    {
+        $email = 'email@example.com';
+        $storeId = 1;
+        $firstname = 'Tester';
+        $lastname = 'McTest';
+        $groupId = 1;
+
+        $this->_customerBuilder->setStoreId($storeId)
+            ->setEmail($email)
+            ->setFirstname($firstname)
+            ->setLastname($lastname)
+            ->setGroupId($groupId);
+        return $this->_customerBuilder->create();
+    }
+
+    /**
+     * Sample Address data
+     *
+     * @return array
+     */
+    private function getSampleAddressEntity()
+    {
+        $this->_addressBuilder
+            ->setCountryId('US')
+            ->setDefaultBilling(true)
+            ->setDefaultShipping(true)
+            ->setPostcode('75477')
+            ->setRegion(
+                new Region([
+                    'region_code' => 'AL',
+                    'region' => 'Alabama',
+                    'region_id' => 1
+                ])
+            )
+            ->setStreet(['Green str, 67'])
+            ->setTelephone('3468676')
+            ->setCity('CityM')
+            ->setFirstname('John')
+            ->setLastname('Smith');
+        $address1 = $this->_addressBuilder->create();
+
+        $this->_addressBuilder
+            ->setCountryId('US')
+            ->setDefaultBilling(false)
+            ->setDefaultShipping(false)
+            ->setPostcode('47676')
+            ->setRegion(
+                new Region([
+                    'region_code' => 'AL',
+                    'region' => 'Alabama',
+                    'region_id' => 1
+                ])
+            )
+            ->setStreet(['Black str, 48'])
+            ->setCity('CityX')
+            ->setTelephone('3234676')
+            ->setFirstname('John')
+            ->setLastname('Smith');
+        $address2 = $this->_addressBuilder->create();
+
+        return [$address1, $address2];
+    }
+
+    /**
+     * Setup $this->_serviceQuote with mock transaction object
+     */
+    private function _prepareQuoteWithMockTransaction()
+    {
+        $mockTransactionFactory = $this->getMockBuilder('\Magento\Core\Model\Resource\TransactionFactory')
+            ->disableOriginalConstructor()->setMethods(['create'])->getMock();
+        $mockTransaction = $this->getMockBuilder('\Magento\Core\Model\Resource\TransactionFactory')
+            ->disableOriginalConstructor()->setMethods(['addObject', 'addCommitCallback', 'save'])->getMock();
+
+        $mockTransactionFactory->expects($this->once())
+            ->method('create')
+            ->will($this->returnValue($mockTransaction));
+
+        $mockTransaction->expects($this->any())
+            ->method('addObject');
+        $mockTransaction->expects($this->any())
+            ->method('addCommitCallback');
+        $mockTransaction->expects($this->once())
+            ->method('save')
+            ->will($this->throwException(new \Exception('submitorder exception')));
+
+        $quoteFixture = $this->_prepareQuoteFixture(false);
+        $this->_serviceQuote = Bootstrap::getObjectManager()->create(
+            '\Magento\Sales\Model\Service\Quote',
+            array('quote' => $quoteFixture, 'transactionFactory' => $mockTransactionFactory)
+        );
+    }
+} 
\ No newline at end of file
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php
new file mode 100644
index 00000000000..a35d67b7ebf
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * Paid invoice fixture.
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+require 'order_fixture_store.php';
+/** @var \Magento\Sales\Model\Order $order */
+
+$orderService = \Magento\TestFramework\ObjectManager::getInstance()->create('Magento\Sales\Model\Service\Order',
+    array('order' => $order));
+$invoice = $orderService->prepareInvoice();
+$invoice->register();
+$order->setIsInProcess(true);
+$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\Core\Model\Resource\Transaction');
+$transactionSave->addObject($invoice)->addObject($order)->save();
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order.php
index 561b46c818b..03bccb96b17 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/_files/order.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order.php
@@ -29,26 +29,25 @@ require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php';
 /** @var \Magento\Catalog\Model\Product $product */
 
 $addressData = include(__DIR__ . '/address_data.php');
-$billingAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-    ->create('Magento\Sales\Model\Order\Address', array('data' => $addressData));
+
+$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+
+$billingAddress = $objectManager->create('Magento\Sales\Model\Order\Address', array('data' => $addressData));
 $billingAddress->setAddressType('billing');
 
 $shippingAddress = clone $billingAddress;
 $shippingAddress->setId(null)
     ->setAddressType('shipping');
 
-$payment = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-    ->create('Magento\Sales\Model\Order\Payment');
+$payment = $objectManager->create('Magento\Sales\Model\Order\Payment');
 $payment->setMethod('checkmo');
 
 /** @var \Magento\Sales\Model\Order\Item $orderItem */
-$orderItem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-    ->create('Magento\Sales\Model\Order\Item');
+$orderItem = $objectManager->create('Magento\Sales\Model\Order\Item');
 $orderItem->setProductId($product->getId())->setQtyOrdered(2);
 
 /** @var \Magento\Sales\Model\Order $order */
-$order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-    ->create('Magento\Sales\Model\Order');
+$order = $objectManager->create('Magento\Sales\Model\Order');
 $order->setIncrementId('100000001')
     ->setState(\Magento\Sales\Model\Order::STATE_PROCESSING)
     ->setSubtotal(100)
@@ -57,10 +56,7 @@ $order->setIncrementId('100000001')
     ->setCustomerEmail('customer@null.com')
     ->setBillingAddress($billingAddress)
     ->setShippingAddress($shippingAddress)
-    ->setStoreId(
-        \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')
-            ->getStore()->getId()
-    )
+    ->setStoreId($objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getId())
     ->addItem($orderItem)
     ->setPayment($payment);
 $order->save();
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php
new file mode 100644
index 00000000000..a357801553c
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_Sales
+ * @subpackage  integration_tests
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+require __DIR__ . '/../../../Magento/Core/_files/store.php';
+
+require __DIR__ . '/../../../Magento/Catalog/_files/product_simple_duplicated.php';
+/** @var \Magento\Catalog\Model\Product $product */
+
+$addressData = include(__DIR__ . '/address_data.php');
+
+$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+
+$billingAddress = $objectManager->create('Magento\Sales\Model\Order\Address', array('data' => $addressData));
+$billingAddress->setAddressType('billing');
+
+$shippingAddress = clone $billingAddress;
+$shippingAddress->setId(null)
+    ->setAddressType('shipping');
+
+$payment = $objectManager->create('Magento\Sales\Model\Order\Payment');
+$payment->setMethod('checkmo');
+
+/** @var \Magento\Sales\Model\Order\Item $orderItem */
+$orderItem = $objectManager->create('Magento\Sales\Model\Order\Item');
+$orderItem->setProductId($product->getId())->setQtyOrdered(2);
+
+/** @var \Magento\Sales\Model\Order $order */
+$order = $objectManager->create('Magento\Sales\Model\Order');
+$order->setIncrementId('100000004')
+    ->setState(\Magento\Sales\Model\Order::STATE_PROCESSING)
+    ->setSubtotal(100)
+    ->setBaseSubtotal(100)
+    ->setCustomerIsGuest(true)
+    ->setCustomerEmail('customer@null.com')
+    ->setBillingAddress($billingAddress)
+    ->setShippingAddress($shippingAddress)
+    ->setStoreId($objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore('fixturestore')->getId())
+    ->addItem($orderItem)
+    ->setPayment($payment);
+$order->save();
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_with_customer.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_with_customer.php
new file mode 100644
index 00000000000..3ce9393d30a
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_with_customer.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+include (__DIR__ . '/order.php');
+include (__DIR__ . '/../../../Magento/Customer/_files/customer.php');
+
+$customerIdFromFixture = 1;
+/** @var $order \Magento\Sales\Model\Order */
+$order->setCustomerId($customerIdFromFixture)->setCustomerIsGuest(false)->save();
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_customer.php b/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_customer.php
new file mode 100644
index 00000000000..0cb560befa2
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_customer.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_Sales
+ * @subpackage  integration_tests
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+include (__DIR__ . '/quote.php');
+include (__DIR__ . '/../../../Magento/Customer/_files/customer.php');
+
+$customerIdFromFixture = 1;
+$quote->setCustomerId($customerIdFromFixture)->setCustomerIsGuest(false)->save();
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php
index 9d9b3b79afb..3c8561578bf 100644
--- a/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php
@@ -43,7 +43,7 @@ class MainTest extends \PHPUnit_Framework_TestCase
         $objectManager->get('Magento\View\DesignInterface')
             ->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE)
             ->setDefaultDesignTheme();
-        $objectManager->get('Magento\Core\Model\Registry')
+        $objectManager->get('Magento\Registry')
             ->register('current_promo_quote_rule', $objectManager->create('Magento\SalesRule\Model\Rule'));
 
         $layout = $objectManager->create('Magento\Core\Model\Layout');
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Resource/Rule/CollectionTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Resource/Rule/CollectionTest.php
new file mode 100644
index 00000000000..27904a74a8f
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Resource/Rule/CollectionTest.php
@@ -0,0 +1,65 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Resource\Rule;
+
+/**
+ * @magentoDataFixture Magento/SalesRule/_files/rules.php
+ * @magentoDataFixture Magento/SalesRule/_files/coupons.php
+ */
+class CollectionTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @dataProvider setValidationFilterDataProvider()
+     * @param string $couponCode
+     * @param array $expectedItems
+     */
+    public function testSetValidationFilter($couponCode, $expectedItems)
+    {
+        $this->_collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\SalesRule\Model\Resource\Rule\Collection');
+        $items = array_values($this->_collection->setValidationFilter(1, 0, $couponCode)->getItems());
+
+        $ids = array();
+        foreach ($items as $key => $item) {
+            $this->assertEquals($item->getName(), $expectedItems[$key]);
+            if (in_array($item->getId(), $ids)) {
+                $this->fail('Item should be unique in result collection');
+            }
+            $ids[] = $item->getId();
+        }
+    }
+
+    public function setValidationFilterDataProvider()
+    {
+        return array(
+            'Check type COUPON' => array('coupon_code', array('#1', '#2', '#5')),
+            'Check type NO_COUPON' => array('', array('#2', '#5')),
+            'Check type COUPON_AUTO' => array('coupon_code_auto', array('#2', '#4', '#5')),
+            'Check result with auto generated coupon' => array('autogenerated_3_1', array('#2', '#3', '#5')),
+            'Check result with non actual previously generated coupon' => array('autogenerated_2_1', array('#2', '#5')),
+            'Check result with wrong code' => array('wrong_code', array('#2', '#5')),
+        );
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/coupons.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/coupons.php
new file mode 100644
index 00000000000..48aac0b89e1
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/coupons.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+$this->_collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\SalesRule\Model\Resource\Rule\Collection');
+$items = array_values($this->_collection->getItems());
+
+// type SPECIFIC with code
+$coupon = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\SalesRule\Model\Coupon');
+$coupon->setRuleId($items[0]->getId())
+    ->setCode('coupon_code')
+    ->setType(0)
+    ->save();
+
+// type NO_COUPON with non actual previously generated coupon codes
+$coupon = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\SalesRule\Model\Coupon');
+$coupon->setRuleId($items[1]->getId())
+    ->setCode('autogenerated_2_1')
+    ->setType(1)
+    ->save();
+$coupon = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\SalesRule\Model\Coupon');
+$coupon->setRuleId($items[1]->getId())
+    ->setCode('autogenerated_2_2')
+    ->setType(1)
+    ->save();
+
+// type SPECIFIC with generated coupons
+$coupon = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\SalesRule\Model\Coupon');
+$coupon->setRuleId($items[2]->getId())
+    ->setCode('autogenerated_3_1')
+    ->setType(1)
+    ->save();
+$coupon =  \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\SalesRule\Model\Coupon');
+$coupon->setRuleId($items[2]->getId())
+    ->setCode('autogenerated_3_2')
+    ->setType(1)
+    ->save();
+
+// type AUTO
+$coupon = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\SalesRule\Model\Coupon');
+$coupon->setRuleId($items[3]->getId())
+    ->setCode('coupon_code_auto')
+    ->setType(0)
+    ->save();
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules.php
new file mode 100644
index 00000000000..ef0d7c8a9ea
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules.php
@@ -0,0 +1,88 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+/** @var \Magento\SalesRule\Model\Rule $rule */
+$rule = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\SalesRule\Model\Rule');
+$rule->setName('#1')
+    ->setIsActive(1)
+    ->setStopRulesProcessing(0)
+    ->setIsAdvanced(1)
+    ->setCouponType(Magento\SalesRule\Model\Rule::COUPON_TYPE_SPECIFIC)
+    ->setUseAutoGeneration(0)
+    ->setWebsiteIds('1')
+    ->setCustomerGroupIds('0')
+    ->save();
+
+/** @var \Magento\SalesRule\Model\Rule $rule */
+$rule = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\SalesRule\Model\Rule');
+$rule->setName('#2')
+    ->setIsActive(1)
+    ->setStopRulesProcessing(0)
+    ->setIsAdvanced(1)
+    ->setCouponType(Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON)
+    ->setUseAutoGeneration(0)
+    ->setWebsiteIds('1')
+    ->setCustomerGroupIds('0')
+    ->save();
+
+/** @var \Magento\SalesRule\Model\Rule $rule */
+$rule = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\SalesRule\Model\Rule');
+$rule->setName('#3')
+    ->setIsActive(1)
+    ->setStopRulesProcessing(0)
+    ->setIsAdvanced(1)
+    ->setCouponType(Magento\SalesRule\Model\Rule::COUPON_TYPE_SPECIFIC)
+    ->setUseAutoGeneration(1)
+    ->setWebsiteIds('1')
+    ->setCustomerGroupIds('0')
+    ->save();
+
+/** @var \Magento\SalesRule\Model\Rule $rule */
+$rule = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\SalesRule\Model\Rule');
+$rule->setName('#4')
+    ->setIsActive(1)
+    ->setStopRulesProcessing(0)
+    ->setIsAdvanced(1)
+    ->setCouponType(Magento\SalesRule\Model\Rule::COUPON_TYPE_AUTO)
+    ->setUseAutoGeneration(0)
+    ->setWebsiteIds('1')
+    ->setCustomerGroupIds('0')
+    ->save();
+
+/** @var \Magento\SalesRule\Model\Rule $rule */
+$rule = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->create('Magento\SalesRule\Model\Rule');
+$rule->setName('#5')
+    ->setIsActive(1)
+    ->setStopRulesProcessing(0)
+    ->setIsAdvanced(1)
+    ->setCouponType(Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON)
+    ->setUseAutoGeneration(0)
+    ->setWebsiteIds('1')
+    ->setCustomerGroupIds('0')
+    ->save();
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RuleTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RuleTest.php
index a8f70855fa7..b07ea263dca 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RuleTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RuleTest.php
@@ -145,12 +145,12 @@ class RuleTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * @return \Magento\Core\Model\Registry
+     * @return \Magento\Registry
      */
     protected function _getRegistryClassMock()
     {
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        return $objectManager->get('Magento\Core\Model\Registry');
+        return $objectManager->get('Magento\Registry');
     }
 
     /**
@@ -180,9 +180,9 @@ class RuleTest extends \PHPUnit_Framework_TestCase
             'Magento\Tax\Model\ClassModel',
             array('getCollection'),
             array(
-                $this->_objectManager->create('Magento\Core\Model\Context'),
-                $this->_objectManager->get('Magento\Core\Model\Registry'),
-                $this->_objectManager->get('Magento\Tax\Model\TaxClass\Factory'),                
+                $this->_objectManager->create('Magento\Model\Context'),
+                $this->_objectManager->get('Magento\Registry'),
+                $this->_objectManager->get('Magento\Tax\Model\TaxClass\Factory'),
             ),
             '',
             true
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php
index 5f137be874a..ba3bc12de37 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php
@@ -103,8 +103,8 @@ class ClassTest extends \PHPUnit_Framework_TestCase
      */
     public function testCheckClassCanBeDeletedCustomerClassUsedInTaxRule()
     {
-        /** @var $registry \Magento\Core\Model\Registry */
-        $registry = $this->_objectManager->get('Magento\Core\Model\Registry');
+        /** @var $registry \Magento\Registry */
+        $registry = $this->_objectManager->get('Magento\Registry');
         /** @var $taxRule \Magento\Tax\Model\Calculation\Rule */
         $taxRule = $registry->registry('_fixture/Magento_Tax_Model_Calculation_Rule');
         $customerClasses = $taxRule->getCustomerTaxClasses();
@@ -123,8 +123,8 @@ class ClassTest extends \PHPUnit_Framework_TestCase
      */
     public function testCheckClassCanBeDeletedProductClassUsedInTaxRule()
     {
-        /** @var $registry \Magento\Core\Model\Registry */
-        $registry = $this->_objectManager->get('Magento\Core\Model\Registry');
+        /** @var $registry \Magento\Registry */
+        $registry = $this->_objectManager->get('Magento\Registry');
         /** @var $taxRule \Magento\Tax\Model\Calculation\Rule */
         $taxRule = $registry->registry('_fixture/Magento_Tax_Model_Calculation_Rule');
         $productClasses = $taxRule->getProductTaxClasses();
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/CalculationTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/CalculationTest.php
index 6c2bb796d34..198082299e3 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/CalculationTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/CalculationTest.php
@@ -39,11 +39,11 @@ class CalculationTest extends \PHPUnit_Framework_TestCase
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
 
-        $taxRule = $objectManager->get('Magento\Core\Model\Registry')
+        $taxRule = $objectManager->get('Magento\Registry')
             ->registry('_fixture/Magento_Tax_Model_Calculation_Rule');
         $customerTaxClasses = $taxRule->getTaxCustomerClass();
         $productTaxClasses = $taxRule->getTaxProductClass();
-        $taxRate =  $objectManager->get('Magento\Core\Model\Registry')
+        $taxRate =  $objectManager->get('Magento\Registry')
             ->registry('_fixture/Magento_Tax_Model_Calculation_Rate');
         $data = new \Magento\Object();
         $data->setData(array(
diff --git a/dev/tests/integration/testsuite/Magento/Tax/_files/tax_classes.php b/dev/tests/integration/testsuite/Magento/Tax/_files/tax_classes.php
index e65547e7815..b312cb5f61f 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/_files/tax_classes.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/_files/tax_classes.php
@@ -56,7 +56,7 @@ $taxRate = array(
 );
 $rate = $objectManager->create('Magento\Tax\Model\Calculation\Rate')->setData($taxRate)->save();
 
-$objectManager->get('Magento\Core\Model\Registry')->register('_fixture/Magento_Tax_Model_Calculation_Rate', $rate);
+$objectManager->get('Magento\Registry')->register('_fixture/Magento_Tax_Model_Calculation_Rate', $rate);
 
 $ruleData = array(
     'code' => 'Test Rule',
@@ -69,7 +69,7 @@ $ruleData = array(
 
 $taxRule = $objectManager->create('Magento\Tax\Model\Calculation\Rule')->setData($ruleData)->save();
 
-$objectManager->get('Magento\Core\Model\Registry')->register('_fixture/Magento_Tax_Model_Calculation_Rule', $taxRule);
+$objectManager->get('Magento\Registry')->register('_fixture/Magento_Tax_Model_Calculation_Rule', $taxRule);
 
 $ruleData['code'] = 'Test Rule Duplicate';
 
diff --git a/dev/tests/integration/testsuite/Magento/TestFixture/Controller/Adminhtml/Index.php b/dev/tests/integration/testsuite/Magento/TestFixture/Controller/Adminhtml/Index.php
new file mode 100644
index 00000000000..8373d1d6701
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/TestFixture/Controller/Adminhtml/Index.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\TestFixture\Controller\Adminhtml;
+
+/**
+ * Mock index controller class
+ */
+class Index
+{
+    /**
+     * No route action
+     */
+    public function norouteAction()
+    {
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/GeneralTest.php b/dev/tests/integration/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/GeneralTest.php
index b9b1bafa407..d0b3dbe6dfa 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/GeneralTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/GeneralTest.php
@@ -57,7 +57,7 @@ class GeneralTest extends \PHPUnit_Framework_TestCase
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_theme', $this->_theme);
+        $objectManager->get('Magento\Registry')->register('current_theme', $this->_theme);
         $this->_block->setArea('adminhtml');
 
         $this->_block->toHtml();
diff --git a/dev/tests/integration/testsuite/Magento/User/Block/User/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/User/Block/User/Edit/Tab/MainTest.php
index c5815ea7646..f9236710180 100644
--- a/dev/tests/integration/testsuite/Magento/User/Block/User/Edit/Tab/MainTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Block/User/Edit/Tab/MainTest.php
@@ -47,12 +47,12 @@ class MainTest extends \Magento\Backend\Utility\Controller
         parent::setUp();
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        
+
         $this->_block = $objectManager->create('Magento\User\Block\User\Edit\Tab\Main');
         $this->_block->setArea('adminhtml');
         $this->_user = $objectManager->create('Magento\User\Model\User');
 
-        $objectManager->get('Magento\Core\Model\Registry')->register('permissions_user', $this->_user);
+        $objectManager->get('Magento\Registry')->register('permissions_user', $this->_user);
     }
 
     protected function tearDown()
@@ -61,7 +61,7 @@ class MainTest extends \Magento\Backend\Utility\Controller
         $this->_user = null;
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('permissions_user');
+        $objectManager->get('Magento\Registry')->unregister('permissions_user');
         parent::tearDown();
     }
 
diff --git a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php
index 2b36d5f27cf..a53290a8f3e 100644
--- a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php
@@ -184,23 +184,6 @@ class UserTest extends \PHPUnit_Framework_TestCase
             $this->_model->getCollection());
     }
 
-    public function testSendPasswordResetConfirmationEmail()
-    {
-        /** @var $config \Magento\Backend\App\ConfigInterface */
-        $config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->get('Magento\Backend\App\ConfigInterface');
-        $mailer = $this->getMock('Magento\Email\Model\Template\Mailer', array(), array(
-            $this->getMock('Magento\Email\Model\TemplateFactory', array(), array(), '', false)
-        ));
-        $mailer->expects($this->once())
-            ->method('setTemplateId')
-            ->with($config->getValue(\Magento\User\Model\User::XML_PATH_FORGOT_EMAIL_TEMPLATE));
-        $mailer->expects($this->once())
-            ->method('send');
-        $this->_model->setMailer($mailer);
-        $this->_model->sendPasswordResetConfirmationEmail();
-    }
-
     public function testGetName()
     {
         $this->_model->loadByUsername(\Magento\TestFramework\Bootstrap::ADMIN_NAME);
diff --git a/dev/tests/integration/testsuite/Magento/View/PublicationTest.php b/dev/tests/integration/testsuite/Magento/View/PublicationTest.php
index ed613756028..c84ade2ae21 100644
--- a/dev/tests/integration/testsuite/Magento/View/PublicationTest.php
+++ b/dev/tests/integration/testsuite/Magento/View/PublicationTest.php
@@ -30,31 +30,31 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
     /**
      * @var \Magento\View\DesignInterface
      */
-    protected $_model;
+    protected $model;
 
     /**
      * @var \Magento\View\Service
      */
-    protected $_viewService;
+    protected $viewService;
 
     /**
      * @var \Magento\View\FileSystem
      */
-    protected $_fileSystem;
+    protected $fileSystem;
 
     /**
      * @var \Magento\View\Url
      */
-    protected $_viewUrl;
+    protected $viewUrl;
 
     protected function setUp()
     {
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
         $objectManager->get('Magento\App\State')->setAreaCode('frontend');
-        $this->_viewService = $objectManager->create('Magento\View\Service');
-        $this->_fileSystem = $objectManager->create('Magento\View\FileSystem');
-        $this->_viewUrl = $objectManager->create('Magento\View\Url');
-        $this->_model = $objectManager->get('Magento\View\DesignInterface');
+        $this->viewService = $objectManager->create('Magento\View\Service');
+        $this->fileSystem = $objectManager->create('Magento\View\FileSystem');
+        $this->viewUrl = $objectManager->create('Magento\View\Url');
+        $this->model = $objectManager->get('Magento\View\DesignInterface');
     }
 
     protected function tearDown()
@@ -64,7 +64,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
         $publicDir = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::STATIC_VIEW_DIR);
         $publicDir->delete('adminhtml');
         $publicDir->delete('frontend');
-        $this->_model = null;
+        $this->model = null;
     }
 
     /**
@@ -75,7 +75,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
         /** @var $filesystem Filesystem */
         $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem');
         $expectedPublicDir = $filesystem->getPath(\Magento\App\Filesystem::STATIC_VIEW_DIR);
-        $this->assertEquals($expectedPublicDir, $this->_viewService->getPublicDir());
+        $this->assertEquals($expectedPublicDir, $this->viewService->getPublicDir());
     }
 
     /**
@@ -92,9 +92,9 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
 
         \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\LocaleInterface')
             ->setLocale($locale);
-        $url = $this->_viewUrl->getViewFileUrl($file);
+        $url = $this->viewUrl->getViewFileUrl($file);
         $this->assertStringEndsWith($expectedUrl, $url);
-        $viewFile = $this->_fileSystem->getViewFile($file);
+        $viewFile = $this->fileSystem->getViewFile($file);
         $this->assertFileExists($viewFile);
     }
 
@@ -172,7 +172,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
      */
     public function testGetViewUrlException($file)
     {
-        $this->_viewUrl->getViewFileUrl($file);
+        $this->viewUrl->getViewFileUrl($file);
     }
 
     /**
@@ -200,7 +200,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
     public function testTemplatePublicationVulnerability($designParams, $filePath)
     {
         $this->_initTestTheme();
-        $this->_viewUrl->getViewFileUrl($filePath, $designParams);
+        $this->viewUrl->getViewFileUrl($filePath, $designParams);
     }
 
     /**
@@ -245,15 +245,15 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
     {
         $this->_initTestTheme();
 
-        $expectedFile = $this->_viewService->getPublicDir() . '/' . $expectedFile;
+        $expectedFile = $this->viewService->getPublicDir() . '/' . $expectedFile;
 
         // test doesn't make sense if the original file doesn't exist or the target file already exists
-        $originalFile = $this->_fileSystem->getViewFile($file, $designParams);
+        $originalFile = $this->fileSystem->getViewFile($file, $designParams);
         $this->assertFileExists($originalFile);
 
         // getViewUrl() will trigger publication in development mode
         $this->assertFileNotExists($expectedFile, 'Please verify isolation from previous test(s).');
-        $this->_viewUrl->getViewFileUrl($file, $designParams);
+        $this->viewUrl->getViewFileUrl($file, $designParams);
         $this->assertFileExists($expectedFile);
 
         // as soon as the files are published, they must have the same mtime as originals
@@ -301,19 +301,19 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
     {
         $this->_initTestTheme();
 
-        $expectedFile = $this->_viewService->getPublicDir() . '/' . $expectedFile;
+        $expectedFile = $this->viewService->getPublicDir() . '/' . $expectedFile;
 
         // test doesn't make sense if the original file doesn't exist or the target file already exists
-        $originalFile = $this->_fileSystem->getViewFile($file, $designParams);
+        $originalFile = $this->fileSystem->getViewFile($file, $designParams);
         $this->assertFileNotExists($originalFile);
 
         // getViewUrl() will trigger publication in development mode
         $this->assertFileNotExists($expectedFile, 'Please verify isolation from previous test(s).');
-        $this->_viewUrl->getViewFileUrl($file, $designParams);
+        $this->viewUrl->getViewFileUrl($file, $designParams);
         $this->assertFileExists($expectedFile);
 
         $this->assertEquals(
-            trim(file_get_contents($this->_fileSystem->getViewFile($contentFile, $designParams))),
+            trim(file_get_contents($this->fileSystem->getViewFile($contentFile, $designParams))),
             file_get_contents($expectedFile)
         );
     }
@@ -356,9 +356,9 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
             'Namespace_Module/absolute_valid_module.gif',
             'Magento_Theme/favicon.ico', // non-fixture file from real module
         );
-        $publishedDir = $this->_viewService->getPublicDir() . '/frontend/vendor_default/en_US';
+        $publishedDir = $this->viewService->getPublicDir() . '/frontend/vendor_default/en_US';
         $this->assertFileNotExists($publishedDir, 'Please verify isolation from previous test(s).');
-        $this->_viewUrl->getViewFileUrl('css/file.css', array(
+        $this->viewUrl->getViewFileUrl('css/file.css', array(
             'theme'   => 'vendor_default',
             'locale'  => 'en_US'
         ));
@@ -379,9 +379,9 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
     ) {
         \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')
             ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND);
-        $this->_viewUrl->getViewFileUrl($cssViewFile, $designParams);
+        $this->viewUrl->getViewFileUrl($cssViewFile, $designParams);
 
-        $expectedCssFile = $this->_viewService->getPublicDir() . '/' . $expectedCssFile;
+        $expectedCssFile = $this->viewService->getPublicDir() . '/' . $expectedCssFile;
         $this->assertFileExists($expectedCssFile);
         $actualCssContent = file_get_contents($expectedCssFile);
 
@@ -396,7 +396,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
         }
 
         foreach ($expectedRelatedFiles as $expectedFile) {
-            $expectedFile = $this->_viewService->getPublicDir() . '/' . $expectedFile;
+            $expectedFile = $this->viewService->getPublicDir() . '/' . $expectedFile;
             $this->assertFileExists($expectedFile);
         }
     }
@@ -488,19 +488,22 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
         $objectManager->get('Magento\App\State')->setAreaCode('frontend');
 
-        $this->_model = $objectManager->get('Magento\View\DesignInterface');
-        $this->_model->setDesignTheme('test_default');
+        $this->model = $objectManager->get('Magento\View\DesignInterface');
+        $this->model->setDesignTheme('test_default');
 
-        $this->_viewService = $objectManager->create('Magento\View\Service');
-        $this->_fileSystem = $objectManager->create('Magento\View\FileSystem');
-        $this->_viewUrl = $objectManager->create('Magento\View\Url');
+        $this->viewService = $objectManager->create('Magento\View\Service');
+        $this->fileSystem = $objectManager->create('Magento\View\FileSystem');
+        $this->viewUrl = $objectManager->create('Magento\View\Url');
 
-        $themePath = $this->_model->getDesignTheme()->getFullPath();
+        $themePath = $this->model->getDesignTheme()->getFullPath();
         
         $fixtureViewPath = "$appInstallDir/media_for_change/$themePath/";
-        $publishedPath = $this->_viewService->getPublicDir() . "/$themePath/en_US/";
+        $publishedPath = $this->viewService->getPublicDir() . "/$themePath/en_US/";
 
-        $this->_viewUrl->getViewFileUrl('style.css', array('locale' => 'en_US'));
+        $this->viewUrl->getViewFileUrl('style.css', array('locale' => 'en_US'));
+
+        //It's added to make 'mtime' really different for source and origin files
+        sleep(1);
 
         // Change main file and referenced files - everything changed and referenced must appear
         file_put_contents(
@@ -513,7 +516,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
             '.sub2 {border: 1px solid magenta}',
             FILE_APPEND
         );
-        $this->_viewUrl->getViewFileUrl('style.css', array('locale' => 'en_US'));
+        $this->viewUrl->getViewFileUrl('style.css', array('locale' => 'en_US'));
 
         $assertFileComparison = $expectedPublished ? 'assertFileEquals' : 'assertFileNotEquals';
         $this->$assertFileComparison($fixtureViewPath . 'style.css', $publishedPath . 'style.css');
@@ -577,18 +580,21 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
         $objectManager->get('Magento\App\State')->setAreaCode('frontend');
 
-        $this->_model = $objectManager->get('Magento\View\DesignInterface');
-        $this->_model->setDesignTheme('test_default');
+        $this->model = $objectManager->get('Magento\View\DesignInterface');
+        $this->model->setDesignTheme('test_default');
 
-        $this->_viewService = $objectManager->create('Magento\View\Service');
-        $this->_fileSystem = $objectManager->create('Magento\View\FileSystem');
-        $this->_viewUrl = $objectManager->create('Magento\View\Url');
+        $this->viewService = $objectManager->create('Magento\View\Service');
+        $this->fileSystem = $objectManager->create('Magento\View\FileSystem');
+        $this->viewUrl = $objectManager->create('Magento\View\Url');
 
-        $themePath = $this->_model->getDesignTheme()->getFullPath();
+        $themePath = $this->model->getDesignTheme()->getFullPath();
         $fixtureViewPath = "$appInstallDir/media_for_change/$themePath/";
-        $publishedPath = $this->_viewService->getPublicDir() . "/$themePath/en_US/";
+        $publishedPath = $this->viewService->getPublicDir() . "/$themePath/en_US/";
+
+        $this->viewUrl->getViewFileUrl('style.css', array('locale' => 'en_US'));
 
-        $this->_viewUrl->getViewFileUrl('style.css', array('locale' => 'en_US'));
+        //It's added to make 'mtime' really different for source and origin files
+        sleep(1);
 
         // Change referenced files
         copy($fixtureViewPath . 'images/rectangle.gif', $fixtureViewPath . 'images/square.gif');
@@ -599,7 +605,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
             FILE_APPEND
         );
 
-        $this->_viewUrl->getViewFileUrl('style.css', array('locale' => 'en_US'));
+        $this->viewUrl->getViewFileUrl('style.css', array('locale' => 'en_US'));
 
         $assertFileComparison = $expectedPublished ? 'assertFileEquals' : 'assertFileNotEquals';
         $this->$assertFileComparison($fixtureViewPath . 'sub.css', $publishedPath . 'sub.css');
@@ -616,27 +622,42 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
     {
         \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array(
             \Magento\App\Filesystem::PARAM_APP_DIRS => array(
-                \Magento\App\Filesystem::THEMES_DIR => array('path' => dirname(__DIR__) . '/Core/Model/_files/design/')
+                \Magento\App\Filesystem::THEMES_DIR => array('path' => dirname(__DIR__) . '/Core/Model/_files/design')
             )
         ));
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
         $objectManager->get('Magento\App\State')->setAreaCode('frontend');
 
         if ($allowDuplication !== null) {
-            $publisher = $objectManager->create(
-                'Magento\View\Publisher',
-                array('allowDuplication' => $allowDuplication)
-            );
-            $objectManager->addSharedInstance($publisher, 'Magento\View\Publisher');
+            $objectManager->configure(array(
+                'Magento\View\Publisher\CssFile' => array(
+                    'arguments' => array(
+                        'allowDuplication' => array(
+                            'name' => 'allowDuplication',
+                            \Magento\ObjectManager\Config\Reader\Dom::TYPE_ATTRIBUTE => 'boolean',
+                            'value' => $allowDuplication
+                        )
+                    )
+                ),
+                'Magento\View\Publisher\File' => array(
+                    'arguments' => array(
+                        'allowDuplication' => array(
+                            'name' => 'allowDuplication',
+                            \Magento\ObjectManager\Config\Reader\Dom::TYPE_ATTRIBUTE => 'boolean',
+                            'value' => $allowDuplication
+                        )
+                    )
+                ),
+            ));
         }
 
         // Reinit model with new directories
-        $this->_model = $objectManager->get('Magento\View\DesignInterface');
-        $this->_model->setDesignTheme('test_default');
+        $this->model = $objectManager->get('Magento\View\DesignInterface');
+        $this->model->setDesignTheme('test_default');
 
-        $this->_viewService = $objectManager->create('Magento\View\Service');
-        $this->_fileSystem = $objectManager->create('Magento\View\FileSystem');
-        $this->_viewUrl = $objectManager->create('Magento\View\Url');
+        $this->viewService = $objectManager->create('Magento\View\Service');
+        $this->fileSystem = $objectManager->create('Magento\View\FileSystem');
+        $this->viewUrl = $objectManager->create('Magento\View\Url');
     }
 
     /**
@@ -665,20 +686,20 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
             ->getFirstItem()
             ->save();
 
-        $publishedPath = $this->_viewService->getPublicDir() . '/frontend/vendor_default/en_US';
+        $publishedPath = $this->viewService->getPublicDir() . '/frontend/vendor_default/en_US';
         $params =  array(
             'area'    => 'frontend',
             'theme'   => 'vendor_default',
             'locale'  => 'en_US',
             'themeModel' => $theme
         );
-        $filePath = $this->_fileSystem->getViewFile('css/base64.css', $params);
+        $filePath = $this->fileSystem->getViewFile('css/base64.css', $params);
 
         // publish static content
-        $this->_viewUrl->getViewFileUrl('css/base64.css', $params);
+        $this->viewUrl->getViewFileUrl('css/base64.css', $params);
         $this->assertFileEquals($filePath, "{$publishedPath}/css/base64.css");
 
-        $this->_model->setDesignTheme(\Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+        $this->model->setDesignTheme(\Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\View\Design\ThemeInterface'));
     }
 
@@ -696,10 +717,10 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
     {
         $this->_initTestTheme();
 
-        $expectedFile = $this->_viewService->getPublicDir() . '/' . $expectedFile;
+        $expectedFile = $this->viewService->getPublicDir() . '/' . $expectedFile;
 
         $this->assertFileNotExists($expectedFile, 'Please verify isolation from previous test(s).');
-        $this->_viewUrl->getViewFilePublicPath($file, $designParams);
+        $this->viewUrl->getViewFilePublicPath($file, $designParams);
         $this->assertFileExists($expectedFile);
     }
 
@@ -710,7 +731,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase
                 ->getPath(\Magento\App\Filesystem::PUB_LIB_DIR) . '/' . $filePath;
         $this->assertFileExists($expectedFile, 'Please verify existence of public library file');
 
-        $actualFile = $this->_viewUrl->getViewFilePublicPath($filePath);
+        $actualFile = $this->viewUrl->getViewFilePublicPath($filePath);
         $this->assertFileEquals($expectedFile, $actualFile);
     }
 }
diff --git a/dev/tests/integration/testsuite/Magento/View/RelatedFileTest.php b/dev/tests/integration/testsuite/Magento/View/RelatedFileTest.php
index d0c1ef7f5bf..a96821ce635 100644
--- a/dev/tests/integration/testsuite/Magento/View/RelatedFileTest.php
+++ b/dev/tests/integration/testsuite/Magento/View/RelatedFileTest.php
@@ -45,7 +45,6 @@ class RelatedFileTest extends \PHPUnit_Framework_TestCase
     {
         $path = $this->model->buildPath(
             $arguments['relatedFilePath'],
-            $arguments['parentPath'],
             $arguments['parentRelativePath'],
             $arguments['params']
         );
@@ -58,14 +57,10 @@ class RelatedFileTest extends \PHPUnit_Framework_TestCase
      */
     public function buildPathDataProvider()
     {
-        $themesPath = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
-            ->get('Magento\App\Filesystem')->getPath(\Magento\App\Filesystem::THEMES_DIR);
-
         return array(
             array(
                 'arguments' => array(
                     'relatedFilePath' => '../directory/file.css',
-                    'parentPath' => '/root/app/design/frontend/magento_plushe/css/source.css',
                     'parentRelativePath' => 'css/source.css',
                     'params' => ['module' => false]
                 ),
@@ -77,7 +72,6 @@ class RelatedFileTest extends \PHPUnit_Framework_TestCase
             array(
                 'arguments' => array(
                     'relatedFilePath' => '../some_dir/file.css',
-                    'parentPath' => ($themesPath . '/frontend/magento_plushe/css/source.css'),
                     'parentRelativePath' => 'css/source.css',
                     'params' => ['module' => 'Magento_Theme']
                 ),
@@ -89,7 +83,6 @@ class RelatedFileTest extends \PHPUnit_Framework_TestCase
             array(
                 'arguments' => array(
                     'relatedFilePath' => 'Magento_Theme::some_dir/file.css',
-                    'parentPath' => ($themesPath . '/frontend/magento_plushe/css/source.css'),
                     'parentRelativePath' => 'css/source.css',
                     'params' => ['module' => false]
                 ),
diff --git a/dev/tests/integration/testsuite/Magento/Weee/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Weee/Model/ObserverTest.php
index e55332b5557..37342fec79c 100644
--- a/dev/tests/integration/testsuite/Magento/Weee/Model/ObserverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Weee/Model/ObserverTest.php
@@ -48,14 +48,14 @@ class ObserverTest extends \PHPUnit_Framework_TestCase
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->unregister('current_product');
+        $objectManager->get('Magento\Registry')->unregister('current_product');
         $eventObserver = $this->_createEventObserverForUpdateConfigurableProductOptions();
         $this->_model->updateProductOptions($eventObserver);
         $this->assertEquals(array(), $eventObserver->getEvent()->getResponseObject()->getAdditionalOptions());
 
         $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\Catalog\Model\Product');
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_product', $product->load(1));
+        $objectManager->get('Magento\Registry')->register('current_product', $product->load(1));
 
         foreach (array(\Magento\Weee\Model\Tax::DISPLAY_INCL, \Magento\Weee\Model\Tax::DISPLAY_INCL_DESCR) as $mode) {
             \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php
index 5b21b055bf3..2d7590124ce 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php
@@ -36,7 +36,7 @@ class MainTest extends \PHPUnit_Framework_TestCase
     {
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_widget_instance', new \Magento\Object());
+        $objectManager->get('Magento\Registry')->register('current_widget_instance', new \Magento\Object());
         $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface')
             ->createBlock('Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Tab\Main');
         $block->setTemplate(null);
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/EditTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/EditTest.php
index e580119b117..08c0825bea8 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/EditTest.php
@@ -55,7 +55,7 @@ class EditTest extends \PHPUnit_Framework_TestCase
             ->save();
         /** @var $objectManager \Magento\TestFramework\ObjectManager */
         $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $objectManager->get('Magento\Core\Model\Registry')->register('current_widget_instance', $widgetInstance);
+        $objectManager->get('Magento\Registry')->register('current_widget_instance', $widgetInstance);
 
         \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\RequestInterface')
             ->setParam('instance_id', $widgetInstance->getId());
diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php
index 2e316607fc3..e02955f7ac4 100644
--- a/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php
@@ -40,7 +40,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase
         $this->_block = $this->getMockForAbstractClass('Magento\Wishlist\Block\AbstractBlock', array(
             $objectManager->get('Magento\View\Element\Template\Context'),
             $objectManager->get('Magento\Catalog\Model\Config'),
-            $objectManager->get('Magento\Core\Model\Registry'),
+            $objectManager->get('Magento\Registry'),
             $objectManager->get('Magento\Tax\Helper\Data'),
             $objectManager->get('Magento\Catalog\Helper\Data'),
             $objectManager->get('Magento\Math\Random'),
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php
index 93c26582dcd..297c5519441 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php
@@ -129,7 +129,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase
     public function libraryDataProvider()
     {
         // @TODO: remove this code when class Magento\Data\Collection will fixed
-        include_once BP . '/app/code/Magento/Core/Model/Option/ArrayInterface.php';
+        include_once BP . '/lib/Magento/Option/ArrayInterface.php';
         $blackList = file(__DIR__ . '/_files/blacklist.txt', FILE_IGNORE_NEW_LINES);
         $dataProvider = Files::init()->getClassFiles(false, false, false, false, false, true, true);
 
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt
index 4443eb218ec..c62d65bccd5 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt
@@ -19,4 +19,5 @@
 \Magento\Core\Model\Translate\String
 \Magento\Core\Model\Translate\Inline\Config
 \Magento\Core\Model\Translate\Inline\Parser
-\Magento\Translate
\ No newline at end of file
+\Magento\Translate
+\Magento\Email\Model\Template
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
index 3e443644ee7..9260e13d43e 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
@@ -744,13 +744,16 @@ return array(
     array('Mage_Core_Model_Config_System'),
     array('Mage_Core_Model_Design_Source_Apply'),
     array('Mage_Core_Model_Language'),
-    array('Magento\Core\Model\Email\Info', 'Magento\Email\Model\Info'),
-    array('Magento\Core\Model\Email\Sender', 'Magento\Email\Model\Sender'),
+    array('Magento\Core\Model\Email\Info', 'Magento\Mail\MessageInterface'),
+    array('Magento\Core\Model\Email\Sender', 'Magento\Mail\Template\TransportBuilder'),
+    array('Magento\Core\Model\Email\Template\Mailer', 'Magento\Mail\Template\TransportBuilder'),
+    array('Magento\Email\Model\Info', 'Magento\Mail\MessageInterface'),
+    array('Magento\Email\Model\Sender', 'Magento\Mail\Template\TransportBuilder'),
+    array('Magento\Email\Model\Template\Mailer', 'Magento\Mail\Template\TransportBuilder'),
     array('Magento\Core\Model\Email\Template', 'Magento\Email\Model\Template'),
     array('Magento\Core\Model\Email\Transport', 'Magento\Email\Model\Transport'),
     array('Magento\Core\Model\Email\Template\Config', 'Magento\Email\Model\Template\Config'),
     array('Magento\Core\Model\Email\Template\Filter', 'Magento\Email\Model\Template\Filter'),
-    array('Magento\Core\Model\Email\Template\Mailer', 'Magento\Email\Model\Template\Mailer'),
     array('Magento\Core\Model\Email\Template\Config\Converter', 'Magento\Email\Model\Template\Config\Converter'),
     array('Magento\Core\Model\Template\Config\Data', 'Magento\Email\Model\Template\Config\Data'),
     array('Magento\Core\Model\Template\Config\SchemaLocator', 'Magento\Email\Model\Template\Config\SchemaLocator'),
@@ -1171,6 +1174,15 @@ return array(
     array(
         'Magento\Sales\Model\Observer\Backend\RecurringProfile\FormRenderer', 'Magento\RecurringProfile\Model\Observer'
     ),
+    array('Magento\Sales\Model\Quote\Address\Total\Nominal\AbstractRecurring',
+        'Magento\RecurringProfile\Model\Quote\Total\AbstractRecurring'
+    ),
+    array('Magento\Sales\Model\Quote\Address\Total\Nominal\Recurring\Initial',
+        'Magento\RecurringProfile\Model\Quote\Total\Initial'
+    ),
+    array('Magento\Sales\Model\Quote\Address\Total\Nominal\Recurring\Trial',
+        'Magento\RecurringProfile\Model\Quote\Total\Trial'
+    ),
     array('Magento\Sales\Model\ResourceFactory'),
     array('Magento\Sales\Model\Resource\Helper\Mysql4', 'Magento\Sales\Model\Resource\Helper'),
     array('Magento\Core\Model\Resource\Helper\Mysql4', 'Magento\Core\Model\Resource\Helper'),
@@ -1256,6 +1268,8 @@ return array(
     array('Magento\Core\Model\Db\UpdaterInterface'),
     array('Magento\Core\Model\Router\NoRouteHandlerInterface'),
     array('Magento\Core\Model\UrlInterface'),
+    array('Magento\Sales\Model\AdminOrder'),
+    array('Magento\Sales\Model\AdminOrder\Random'),
     array('Magento\Sales\Model\Resource\Order\Attribute\Backend\Parent'),
     array('Magento\Sales\Model\Resource\Order\Creditmemo\Attribute\Backend\Parent'),
     array('Magento\Sales\Model\Resource\Order\Invoice\Attribute\Backend\Parent'),
@@ -2132,4 +2146,17 @@ return array(
     array('Magento\Catalog\Model\Resource\Product\Collection\AssociatedProductUpdater'),
     ['Magento\Sales\Controller\Adminhtml\Recurring\Profile', 'Magento\RecurringProfile\Controller\Adminhtml\Profile'],
     ['Magento\Sales\Controller\Recurring\Profile', 'Magento\RecurringProfile\Controller\Profile'],
+    ['Magento\Core\Model\Image\Adapter\Config', 'Magento\Image\Adapter\Config'],
+    ['Magento\Core\Model\AbstractShell', 'Magento\App\AbstractShell'],
+    ['Magento\Core\Model\Calculator', 'Magento\Math\Calculator'],
+    ['Magento\Core\Model\Log\Adapter', 'Magento\Logger\Adapter'],
+    ['Magento\Core\Model\Input\Filter', 'Magento\Filter\Input'],
+    ['Magento\Core\Model\Input\Filter\MaliciousCode', 'Magento\Filter\Input\MaliciousCode'],
+    ['Magento\Core\Model\Option\ArrayInterface', 'Magento\Option\ArrayInterface'],
+    ['Magento\Core\Model\Option\ArrayPool', 'Magento\Option\ArrayPool'],
+    ['Magento\Core\Helper\String', 'Magento\Code\NameBuilder'],
+    ['Magento\Core\Model\Context', 'Magento\Model\Context'],
+    ['Magento\Core\Model\Registry', 'Magento\Registry'],
+    ['Magento\Catalog\Helper\Product\Flat'],
+    ['Magento\Catalog\Helper\Flat\AbstractFlat']
 );
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php
index e2b363f58ad..e21573de224 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php
@@ -88,9 +88,9 @@ return array(
     '/config/global/catalog/product/flat/attribute_groups' =>
         'This configuration moved to Di configuration of \Magento\Catalog\Model\Resource\Product\Flat\Indexer',
     '/config/global/catalog/product/flat/add_filterable_attributes' =>
-        'This configuration moved to Di configuration of \Magento\Catalog\Helper\Product\Flat',
+        'This configuration moved to Di configuration of \Magento\Catalog\Helper\Product\Flat\Indexer',
     '/config/global/catalog/product/flat/add_child_data' =>
-        'This configuration moved to Di configuration of \Magento\Catalog\Helper\Product\Flat',
+        'This configuration moved to Di configuration of \Magento\Catalog\Helper\Product\Flat\Indexer',
     '/config/global/catalog/content/template_filter' =>
         'This configuration moved to Di configuration of \Magento\Catalog\Helper\Data',
     '/config/frontend/catalog/per_page_values/list' =>
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php
index 703ef2e1d81..55c3b4fe457 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php
@@ -114,16 +114,31 @@ return array(
         'Magento\Core\Model\Design\PackageInterface',
         'Magento_Core_Model_Design_Package::PUBLIC_MODULE_DIR'
     ),
+    array(
+        'PUBLIC_MODULE_DIR',
+        'Magento\View\Publisher',
+        'Magento\View\Publisher\FileInterface::PUBLIC_MODULE_DIR'
+    ),
     array(
         'PUBLIC_THEME_DIR',
         'Magento\Core\Model\Design\PackageInterface',
         'Magento_Core_Model_Design_Package::PUBLIC_THEME_DIR'
     ),
+    array(
+        'PUBLIC_THEME_DIR',
+        'Magento\View\Publisher',
+        'Magento\View\Publisher\FileInterface::PUBLIC_THEME_DIR'
+    ),
     array(
         'PUBLIC_VIEW_DIR',
         'Magento\Core\Model\Design\PackageInterface',
         'Magento_Core_Model_Design_Package::PUBLIC_VIEW_DIR'
     ),
+    array(
+        'PUBLIC_VIEW_DIR',
+        'Magento\View\Publisher',
+        'Magento\View\Publisher\FileInterface::PUBLIC_VIEW_DIR'
+    ),
     array('REGISTRY_FORM_PARAMS_KEY', null, 'direct value'),
     array('SCOPE_TYPE_GROUP', 'Magento\Core\Model\App', 'Magento_Core_Model_StoreManagerInterface::SCOPE_TYPE_GROUP'),
     array('SCOPE_TYPE_STORE', 'Magento\Core\Model\App', 'Magento_Core_Model_StoreManagerInterface::SCOPE_TYPE_STORE'),
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
index a57c4d7e64a..0def4c17ae0 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
@@ -169,13 +169,17 @@ return array(
     array('_saveCache', 'Magento\Backend\Model\Menu\Config'),
     array('_saveCache', 'Magento\Core\Model\Config'),
     array('_saveCustomerAfterOrder', 'Magento\Sales\Model\AdminOrder\Create'),
+    array('_getCustomerAddressForm', 'Magento\Sales\Model\AdminOrder\Create'),
     array('_saveCustomers', 'Magento\Sales\Model\AdminOrder\Create'),
     array('_saveSectionCache', 'Magento\Core\Model\Config'),
     array('_sendUploadResponse', 'Magento\Backend\Controller\Customer'),
+    array('isInStore', 'Magento\Customer\Model\Customer'),
     array('_sendUploadResponse', 'Magento\Newsletter\Controller\Adminhtml\Subscriber'),
     array('_setAttribteValue'),
     array('_shouldSkipProcessUpdates', 'Magento\Core\Model\App'),
     array('_sort', 'Magento\Backend\Model\Config\Structure\Converter'),
+    array('_submitRecurringPaymentProfiles', 'Magento\Sales\Model\Service\Quote',
+        '\Magento\RecurringProfile\Model\Observer::submitRecurringPaymentProfiles'),
     array('_toHtml', 'Magento\Backend\Block\Widget\Container'),
     array('_unhookQueries', 'Magento\Core\Model\Resource\Setup'),
     array('_updateMediaPathUseRewrites', 'Magento\Core\Model\Store', '_getMediaScriptUrl'),
@@ -320,7 +324,6 @@ return array(
     array('getAclPrivilegeSet', 'Magento\Admin\Model\Config'),
     array('getAclResourceList', 'Magento\Admin\Model\Config'),
     array('getAclResourceTree', 'Magento\Admin\Model\Config'),
-    array('getAddress', 'Magento\Customer\Block\Form\Register'),
     array('getAddNewButtonHtml', 'Magento\Backend\Block\Catalog\Product'),
     array('getAddNewButtonHtml', 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions'),
     array('getAddToCartItemUrl', 'Magento\Wishlist\Block\Customer\Sidebar'),
@@ -376,7 +379,6 @@ return array(
     array('getDirectOutput', 'Magento\Core\Model\Layout'),
     array('getDirectOutput', 'Magento\View\LayoutInterface'),
     array('getDistroServerVars', 'Magento\Core\Model\Config', 'getDistroBaseUrl'),
-    array('getDuplicateButtonHtml', 'Magento\Catalog\Block\Adminhtml\Product\Edit'),
     array('getElementClass', 'Magento\Core\Model\Layout\Update'),
     array('getEngineFactory', 'Magento\View\Element\Template\Context', 'getEnginePool'),
     array('getEntityIdsToIncrementIds', 'Magento\Rss\Model\Resource\Order'),
@@ -386,7 +388,6 @@ return array(
     array('getFacets'),
     array('getFallbackTheme'),
     array('getFileLayoutUpdatesXml', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'),
-    array('getFormHtml', 'Magento\Sales\Block\Adminhtml\Order\Create'),
     array('getFormated', '', "getFormated(true) -> format('html'), getFormated() -> format('text')"),
     array('getFormObject', 'Magento\Backend\Block\Widget\Form'),
     array('getGiftmessageHtml', 'Magento\Sales\Block\Adminhtml\Order\View\Tab\Info'),
@@ -471,8 +472,6 @@ return array(
     array('getPriceFormatted', 'Magento\Customer\Block\Adminhtml\Edit\Tab\View\Sales'),
     array('getPrices', 'Magento\Bundle\Model\Product\Price', 'getTotalPrices()'),
     array('getPricesDependingOnTax', 'Magento\Bundle\Model\Product\Price', 'getTotalPrices()'),
-    array('getPrimaryBillingAddress', 'Magento\Customer\Block\Address\Book', 'getDefaultBilling'),
-    array('getPrimaryShippingAddress', 'Magento\Customer\Block\Address\Book', 'getDefaultShipping'),
     array('getPrintUrl', 'Magento\Checkout\Block\Onepage\Success'),
     array('getPrintUrl', 'Magento\Sales\Block\Order\Info'),
     array('getProduct', 'Magento\Catalog\Model\Product\Type\AbstractType'),
@@ -485,6 +484,13 @@ return array(
     array('getQuoteItemOption', 'Magento\Catalog\Model\Product\Option\Type\DefaultType'),
     array('getQuoteOrdersHtml', 'Magento\GoogleAnalytics\Block\Ga'),
     array('getRefererParamName', 'Magento\Backend\Block\Page\Footer'),
+    array(
+        'getRecurringProfileMethods',
+        'Magento\Payment\Helper\Data',
+        'Magento\RecurringProfile\Model\Method\PaymentMethodsList::toOptionArray'
+    ),
+    array('getRecurringPaymentProfiles', 'Magento\Paypal\Model\Express\Checkout'),
+    array('getRecurringPaymentProfiles', 'Magento\Sales\Model\Service\Quote'),
     array('getRelativePath', 'Magento\Core\Model\Theme\Files'),
     array('getRemoveItemUrl', 'Magento\Wishlist\Block\Customer\Sidebar'),
     array('getReorderUrl', 'Magento\Sales\Block\Order\Info'),
@@ -562,7 +568,6 @@ return array(
     array('getTrackingPopUpUrlByShipId', '', 'getTrackingPopupUrlBySalesModel'),
     array('getTrackingPopUpUrlByTrackId', '', 'getTrackingPopupUrlBySalesModel'),
     array('getUnixProcessMemoryUsage', 'Magento\TestFramework\Helper\Memory', 'getRealMemoryUsage'),
-    array('getUnassignableAttributes', 'Magento\Catalog\Helper\Product'),
     array('getUnprocessedEvents', 'Magento\Index\Model\Resource\Event',
         'Magento_Index_Model_EventRepository::getUnprocessed()'
     ),
@@ -589,6 +594,8 @@ return array(
     array('getXmlConfig','Magento\Persistent\Model\Persistent\Config'),
     array('getXmlElementByType','Magento\Widget\Model\Widget', 'getWidgetByClassType'),
     array('hasItems', 'Magento\Wishlist\Helper\Data'),
+    array('hasRecurringItems', 'Magento\Sales\Model\Quote'),
+    array('hasRecurringItems', 'Magento\Checkout\Block\Onepage\Payment'),
     array('htmlEscape', '', 'escapeHtml'),
     array('imageAction', 'Magento\Catalog\Controller\Product'),
     array('implodeStreetAddress', 'Magento\Customer\Model\Address\AbstractAddress'),
@@ -630,12 +637,12 @@ return array(
     array('loadDb', 'Magento\Core\Model\Config'),
     array('loadDiConfiguration', 'Magento\Core\Model\Config'),
     array('loadEventObservers', 'Magento\Core\Model\Config'),
-    array('loadLabel', 'Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute'),
+    array('loadLabel', 'Magento\Catalog\Model\Resource\Product\Type\Configurable\Attribute'),
     array('loadModules', 'Magento\Core\Model\Config'),
     array('loadModulesCache', 'Magento\Core\Model\Config'),
     array('loadModulesConfiguration', 'Magento\Core\Model\Config'),
     array('loadParentProductIds', 'Magento\Catalog\Model\Product'),
-    array('loadPrices', 'Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute'),
+    array('loadPrices', 'Magento\Catalog\Model\Resource\Product\Type\Configurable\Attribute'),
     array('loadProductPrices', 'Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice'),
     array('lockOrderInventoryData', 'Magento\CatalogInventory\Model\Observer'),
     array('logEncryptionKeySave'),
@@ -669,6 +676,8 @@ return array(
     array('prepareItemInfo', 'Magento\Sales\Block\Recurring\Profile\View'),
     array('preparePriceAlertData', 'Magento\ProductAlert\Block\Product\View'),
     array('prepareProfilesGrid', 'Magento\Sales\Block\Recurring\Profile'),
+    array('prepareRecurringPaymentProfiles', 'Magento\Sales\Model\Quote',
+        '\Magento\RecurringProfile\Model\Observer::_prepareRecurringPaymentProfiles'),
     array('prepareReferenceInfo', 'Magento\Sales\Block\Recurring\Profile\View'),
     array('prepareRelatedOrdersFrontendGrid', 'Magento\Sales\Block\Recurring\Profile\View'),
     array('prepareScheduleInfo', 'Magento\Sales\Block\Recurring\Profile\View'),
@@ -748,9 +757,8 @@ return array(
     array('sortChildren'),
     array('overrideProductThumbnail', 'Magento\Checkout\Block\Cart\Item\Renderer'),
     array('_getThumbnail', 'Magento\Checkout\Block\Cart\Item\Renderer'),
-    array('getConfigurableProduct', 'Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable'),
-    array('getConfigurableOptions', 'Magento\Catalog\Helper\Product\Configuration'),
-    array('getProductAttributes', 'Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable'),
+    array('getConfigurableProduct', 'Magento\Checkout\Block\Cart\Item\Renderer\Configurable'),
+    array('getProductAttributes', 'Magento\Checkout\Block\Cart\Item\Renderer\Configurable'),
     array('substDistroServerVars', 'Magento\Core\Model\Config'),
     array('superGroupGridOnlyAction', 'Magento\Catalog\Controller\Adminhtml\Product'),
     array('toOptionArray', 'Magento\Cms\Model\Resource\Page\Collection'),
@@ -828,7 +836,7 @@ return array(
     array('_showSingle', 'Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option', 'showSingle'),
     array('_getDefaultValues', 'Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option', 'getDefaultValues'),
     array('_isSelected', 'Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option', 'isSelected'),
-    array('_getProduct', 'Magento\ConfigurableProduct\Block\Product\Configurable\AssociatedSelector\Backend\Grid\ColumnSet',
+    array('_getProduct', 'Magento\Catalog\Block\Product\Configurable\AssociatedSelector\Backend\Grid\ColumnSet',
         'getProduct'),
     array('_getProduct', 'Magento\CatalogInventory\Block\Stockqty\AbstractStockqty', 'getProduct'),
     array('_getProduct', 'Magento\CatalogInventory\Block\Qtyincrements', 'getProduct'),
@@ -845,6 +853,7 @@ return array(
     array('_getSelectedRoles', 'Magento\User\Block\User\Edit\Tab\Roles', 'getSelectedRoles'),
     array('_prepareSelect', 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection'),
     array('_prepareSelect', 'Magento\Data\Collection\Db'),
+    array('_createOrderFromAddress', 'Magento\Checkout\Model\Type\AbstractType'),
     array('castField', 'Magento\Core\Model\Resource\Helper'),
     array('getQueryUsingAnalyticFunction', 'Magento\Core\Model\Resource\Helper'),
     array('limitUnion', 'Magento\Core\Model\Resource\Helper'),
@@ -875,8 +884,10 @@ return array(
     array('_getSessionEnvironment', 'Magento\Core\Model\Session\AbstractSession'),
     array('getValidateHttpUserAgentSkip', 'Magento\Core\Model\Session\AbstractSession'),
     array('addProductAttributes', 'Magento\SalesRule\Model\Observer'),
+    array('addRecurringProfilesFilter', 'Magento\Sales\Model\Resource\Order',
+        '\Magento\RecurringProfile\Model\Resource\Order\CollectionFilter::byIds'),
     array('_helper', 'Magento\Catalog\Model\Product\Type\AbstractType'),
-    array('getHelper', 'Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute\Collection'),
+    array('getHelper', 'Magento\Catalog\Model\Resource\Product\Type\Configurable\Attribute\Collection'),
     array('getHelper', 'Magento\Cms\Model\Wysiwyg\Images\Storage'),
     array('getHelper', 'Magento\Core\Model\App'),
     array('getCatalogHelper', 'Magento\Backend\Block\Catalog\Category\Tabs'),
@@ -954,8 +965,6 @@ return array(
     ),
     array('getMerchantVatNumber', '\Magento\Core\Helper\Data', '\Magento\Customer\Helper\Data::getMerchantVatNumber'),
     array('isCountryInEU', '\Magento\Core\Helper\Data', '\Magento\Customer\Helper\Data::isCountryInEU'),
-    array('isConfigurable', 'Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Inventory'),
-    array('isConfigurable', 'Magento\Catalog\Model\Product'),
     array('assocToXml', '\Magento\Core\Helper\Data', '\Magento\Convert\ConvertArray::assocToXml'),
     array('xmlToAssoc', '\Magento\Core\Helper\Data', '\Magento\Convert\Xml::xmlToAssoc'),
     array('checkLfiProtection', '\Magento\Core\Helper\Data', '\Magento\Filesystem::checkLfiProtection'),
@@ -1002,7 +1011,6 @@ return array(
     array('preDispatch', '\Magento\Core\Controller\Varien\Action'),
     array('postDispatch', '\Magento\Core\Controller\Varien\Action'),
     array('hasAction', '\Magento\Core\Controller\Varien\Action'),
-    array('hasConfigurableAttributes', '\Magento\Catalog\Model\Product\Attribute\Group'),
     array('_startSession', '\Magento\Core\Controller\Varien\Action',
         '\Magento\Core\App\Action\Plugin\Session::aroundDispatch'
     ),
@@ -1050,9 +1058,6 @@ return array(
     array('addActionLayoutHandles', '\Magento\Core\Controller\Varien\Action',
         '\Magento\App\ViewInterface::addActionLayoutHandles'
     ),
-    array('addAttributeAction', 'Magento\Catalog\Controller\Adminhtml\Product',
-        'Magento\ConfigurableProduct\Controller\Adminhtml\Product'
-    ),
     array('getTranslator', '\Magento\App\Helper\Context'),
     array('getTranslator', '\Magento\Core\Helper\Data'),
     array('_loadCache', '\Magento\App\Helper\AbstractHelper'),
@@ -1201,40 +1206,6 @@ return array(
     array('copyInventoryData', 'Magento\CatalogInventory\Model\Observer',
         '\Magento\CatalogInventory\Model\Product\CopyConstructor\CatalogInventory::build'
     ),
-    array('isEnabled', '\Magento\Catalog\Helper\Category\Flat',
-        '\Magento\Catalog\Model\Indexer\Category\Flat\Config::isFlatEnabled'),
-    array('categorySaveAfter', '\Magento\Catalog\Model\Observer'),
-    array('storeDelete', '\Magento\Catalog\Model\Observer'),
-    array('categoryMove', '\Magento\Catalog\Model\Observer'),
-    array('storeGroupSave', '\Magento\Catalog\Model\Observer'),
-    array('catalogProductImportAfter', '\Magento\Catalog\Model\Observer'),
-    array('storeEdit', '\Magento\Catalog\Model\Observer'),
-    array('storeAdd', '\Magento\Catalog\Model\Observer'),
-    array('removeStores', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('deleteStores', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('_deleteTable', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('getStoresRootCategories', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('moveold', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('_getAttributeTypeValues', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('_getAttributeValues', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('_prepareDataForAllFields', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('_synchronize', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('_getStaticColumns', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('_getEavColumns', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('_getAttributes', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('_createTable', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('createTable', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('_createTables', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('_prepareValuesToInsert', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('_populateFlatTables', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('rebuild', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('isRebuilt', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('isBuilt', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('move', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('synchronize', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('reindexAll', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('getDesignUpdateData', '\Magento\Catalog\Model\Resource\Category\Flat'),
-    array('getUseStoreTables', '\Magento\Catalog\Model\Resource\Category\Flat'),
     ['getTrackingAjaxUrl', 'Magento\Shipping\Helper\Data'],
     ['isFreeMethod', 'Magento\Shipping\Helper\Data'],
     ['_initOrder', 'Magento\Shipping\Controller\Tracking'],
@@ -1291,8 +1262,29 @@ return array(
         'Magento\Data\Argument\Interpreter\ArrayType'),
     array('_processValueNode', 'Magento\ObjectManager\Config\Mapper\Dom',
         'Magento\Data\Argument\Interpreter\Composite'),
+    array('canSkipFilePublication', 'Magento\View\Publisher'),
+    array('_getExtension', 'Magento\View\Publisher'),
+    array('_buildPublishedFilePath', 'Magento\View\Publisher', 'Magento\View\Publisher\FileInterface'),
+    array('_buildPublicViewRedundantFilename', 'Magento\View\Publisher', 'Magento\View\Publisher\File'),
+    array('_buildPublicViewSufficientFilename', 'Magento\View\Publisher', 'Magento\View\Publisher\File'),
+    array('_buildPublicViewFilename', 'Magento\View\Publisher', 'Magento\View\Publisher\FileInterface'),
     array('cleanAction', 'Magento\PageCache\Controller\Adminhtml\PageCache'),
     array('_isAllowed', 'Magento\PageCache\Controller\Adminhtml\PageCache'),
+    [
+        '_downloadFileAction',
+        'Magento\Sales\Controller\Download',
+        '\Magento\Sales\Model\Download::downloadFile'
+    ],
+    [
+        '_processDatabaseFile',
+        'Magento\Sales\Controller\Download',
+        '\Magento\Sales\Model\Download::_processDatabaseFile'
+    ],
+    [
+        'downloadProfileCustomOptionAction',
+        'Magento\Sales\Controller\Download',
+        '\Magento\RecurringProfile\Controller\Download::downloadProfileCustomOptionAction'
+    ],
     array('useDbCompatibleMode', 'Magento\Core\Helper\Data'),
     array('getFlag', 'Magento\Catalog\Helper\Product\Flat'),
     array('isBuilt', 'Magento\Catalog\Helper\Product\Flat'),
@@ -1324,4 +1316,8 @@ return array(
         'Magento\Catalog\Model\Resource\Attribute',
         'Magento\ConfigurableProduct\Model\Attribute\LockValidator::validate'
     ),
+    array('_getVatRequiredCustomerAddress', 'Magento\Sales\Model\Observer'),
+    array('sendTransactional', 'Magento\Email\Model\Template'),
+    array('_getMail', 'Magento\Email\Model\Template'),
+    array('send', 'Magento\Email\Model\Template'),
 );
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php
index b4cd578a89e..2884cf65bea 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php
@@ -272,7 +272,6 @@ return array(
     array('_messagesBlock', 'Magento\View\Element\AbstractBlock'),
     array('_messagesBlock', 'Magento\Connect\Helper\Data'),
     array('escapeMessageFlag', 'Magento\View\Block\Messages'),
-    array('fileIteratorFactory', 'Magento\Core\Model\Theme\Collection'),
     array('_handlerFactory', 'Magento\Backend\Block\Widget\Grid\Massaction\Additional'),
     array('_flatResourceFactory', 'Magento\Catalog\Model\Observer'),
     array('_catalogCategoryFlat', 'Magento\Catalog\Model\Observer'),
@@ -286,4 +285,7 @@ return array(
     array('_attributeCodes', 'Magento\Catalog\Model\Resource\Category\Flat'),
     array('_columnsSql', 'Magento\Catalog\Model\Resource\Category\Flat'),
     array('_columns', 'Magento\Catalog\Model\Resource\Category\Flat'),
+    array('fileIteratorFactory', 'Magento\Core\Model\Theme\Collection'),
+    array('_allowDuplication', 'Magento\View\Publisher'),
+    array('_modulesReader', 'Magento\View\Publisher'),
 );
diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
index a6b13a3d4d0..153d35ec1fc 100644
--- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
@@ -37,6 +37,7 @@ Magento/Sales/Block/Order
 Magento/Sales/Controller/Adminhtml/Order
 Magento/Sales/Model/Resource/Helper
 Magento/Sales/Model/Resource/Order
+Magento/Sales/Model/Service/Quote
 Magento/Catalog/Block/Product
 Magento/Catalog/Model/Resource/Product
 Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab
diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt
index 1e0bf936aa2..b547e1c49dc 100644
--- a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt
@@ -44,7 +44,6 @@ app/code/Magento/Core/Model/LocaleInterface.php
 app/code/Magento/Core/Model/Resource/Theme
 app/code/Magento/Core/Model/Resource/Theme.php
 app/code/Magento/Core/Model/Session/Validator.php
-app/code/Magento/Core/Model/AbstractShell.php
 app/code/Magento/Core/Model/Theme
 app/code/Magento/Core/Model/Theme.php
 app/code/Magento/Core/Model/Url/SecurityInfo.php
@@ -139,3 +138,4 @@ lib/Magento/ObjectManager
 lib/Magento/Service
 lib/Magento/Url/SecurityInfoInterface.php
 lib/Magento/View
+lib/Magento/App/AbstractShell.php
diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/AbstractShellTest.php b/dev/tests/unit/testsuite/Magento/App/AbstractShellTest.php
similarity index 91%
rename from dev/tests/unit/testsuite/Magento/Core/Model/AbstractShellTest.php
rename to dev/tests/unit/testsuite/Magento/App/AbstractShellTest.php
index 4abf2d403d6..53d172ef2a5 100644
--- a/dev/tests/unit/testsuite/Magento/Core/Model/AbstractShellTest.php
+++ b/dev/tests/unit/testsuite/Magento/App/AbstractShellTest.php
@@ -18,24 +18,21 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Core
- * @subpackage  unit_tests
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Core\Model;
+namespace Magento\App;
 
 class AbstractShellTest extends \PHPUnit_Framework_TestCase
 {
     /**
-     * @var \Magento\Core\Model\AbstractShell|PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\App\AbstractShell | \PHPUnit_Framework_MockObject_MockObject
      */
     protected $_model;
 
     protected function setUp()
     {
-        $this->_model = $this->getMockBuilder('Magento\Core\Model\AbstractShell')
+        $this->_model = $this->getMockBuilder('\Magento\App\AbstractShell')
             ->disableOriginalConstructor()
             ->setMethods(array('_applyPhpVariables'))
             ->getMockForAbstractClass();
diff --git a/dev/tests/unit/testsuite/Magento/Authorizenet/Model/Directpost/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Authorizenet/Model/Directpost/ObserverTest.php
index 75c3ec36c00..2f5ddfe17c3 100644
--- a/dev/tests/unit/testsuite/Magento/Authorizenet/Model/Directpost/ObserverTest.php
+++ b/dev/tests/unit/testsuite/Magento/Authorizenet/Model/Directpost/ObserverTest.php
@@ -32,7 +32,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase
     protected $model;
 
     /**
-     * @var \Magento\Core\Model\Registry|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Registry|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $coreRegistry;
 
@@ -45,7 +45,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase
     {
         $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
         $store = $this->getMock('Magento\Core\Model\Store', [], [], '', false);
-        $this->coreRegistry = $this->getMock('Magento\Core\Model\Registry', []);
+        $this->coreRegistry = $this->getMock('Magento\Registry', []);
         $storeManager = $this->getMockForAbstractClass('Magento\Core\Model\StoreManagerInterface');
         $storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store));
         $payment = $this->getMock('Magento\Authorizenet\Model\Directpost', null, [], '', false);
diff --git a/dev/tests/unit/testsuite/Magento/Authz/Service/AuthorizationV1Test.php b/dev/tests/unit/testsuite/Magento/Authz/Service/AuthorizationV1Test.php
index b44ab9e6bae..bd2f7262020 100644
--- a/dev/tests/unit/testsuite/Magento/Authz/Service/AuthorizationV1Test.php
+++ b/dev/tests/unit/testsuite/Magento/Authz/Service/AuthorizationV1Test.php
@@ -51,7 +51,7 @@ class AuthorizationV1Test extends \PHPUnit_Framework_TestCase
             $this->getMock('Magento\User\Model\RulesFactory', [], [], '', false),
             $this->getMock('Magento\User\Model\Resource\Rules\CollectionFactory', [], [], '', false),
             $this->getMock('Magento\Logger', [], [], '', false),
-            $this->getMock('Magento\Core\Model\Acl\RootResource', [], [], '', false)
+            $this->getMock('Magento\Acl\RootResource', [], [], '', false)
         );
     }
 
diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php
index 396682bdd39..9c29e8238b7 100644
--- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php
+++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php
@@ -32,7 +32,7 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase
         $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false);
         $cacheManager = $this->getMock('Magento\App\CacheInterface');
         $logger = $this->getMock('Magento\Logger', array(), array(), '', false);
-        $context = new \Magento\Core\Model\Context(
+        $context = new \Magento\Model\Context(
             $logger,
             $eventDispatcher,
             $cacheManager,
@@ -46,7 +46,7 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($resource));
         $resourceCollection = $this->getMock('Magento\Data\Collection\Db', array(), array(), '', false);
         $mergeService = $this->getMock('Magento\View\Asset\MergeService', array(), array(), '', false);
-        $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $coreRegistry = $this->getMock('Magento\Registry', array(), array(), '', false);
         $coreConfig = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false);
         $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false);
 
diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php
index bfef911e346..89f6162df46 100644
--- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php
+++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php
@@ -42,7 +42,7 @@ class EncryptedTest extends \PHPUnit_Framework_TestCase
         $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
 
         $eventDispatcherMock = $this->getMock('Magento\Event\Manager', array(), array(), '', false);
-        $contextMock = $this->getMock('Magento\Core\Model\Context', array(), array(), '', false);
+        $contextMock = $this->getMock('Magento\Model\Context', array(), array(), '', false);
         $contextMock->expects($this->any())
             ->method('getEventDispatcher')
             ->will($this->returnValue($eventDispatcherMock));
diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php
index da180a917c9..ccdced2793d 100644
--- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php
+++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php
@@ -32,7 +32,7 @@ class SecureTest extends \PHPUnit_Framework_TestCase
         $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false);
         $cacheManager = $this->getMock('Magento\App\CacheInterface');
         $logger = $this->getMock('Magento\Logger', array(), array(), '', false);
-        $context = new \Magento\Core\Model\Context(
+        $context = new \Magento\Model\Context(
             $logger,
             $eventDispatcher,
             $cacheManager,
@@ -46,7 +46,7 @@ class SecureTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($resource));
         $resourceCollection = $this->getMock('Magento\Data\Collection\Db', array(), array(), '', false);
         $mergeService = $this->getMock('Magento\View\Asset\MergeService', array(), array(), '', false);
-        $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $coreRegistry = $this->getMock('Magento\Registry', array(), array(), '', false);
         $coreConfig = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false);
         $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false);
 
diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Source/Email/TemplateTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Source/Email/TemplateTest.php
index fe7dcb02461..1b425bec6ae 100644
--- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Source/Email/TemplateTest.php
+++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Source/Email/TemplateTest.php
@@ -31,7 +31,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
     protected $_model;
 
     /**
-     * @var \Magento\Core\Model\Registry|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Registry|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $_coreRegistry;
 
@@ -47,7 +47,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
 
     protected function setUp()
     {
-        $this->_coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false, false);
+        $this->_coreRegistry = $this->getMock('Magento\Registry', array(), array(), '', false, false);
         $this->_emailConfig = $this->getMock('Magento\Email\Model\Template\Config', array(), array(), '', false);
         $this->_templatesFactory = $this->getMock('Magento\Email\Model\Resource\Template\CollectionFactory',
             array(), array(), '', false);
diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/FieldTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/FieldTest.php
index 4532c845fe5..9ec8875269e 100644
--- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/FieldTest.php
+++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/FieldTest.php
@@ -331,7 +331,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase
     public function testGetOptionsUsesOptionsInterfaceIfNoMethodIsProvided()
     {
         $this->_model->setData(array('source_model' => 'Source_Model_Name'), 'scope');
-        $sourceModelMock = $this->getMock('Magento\Core\Model\Option\ArrayInterface');
+        $sourceModelMock = $this->getMock('Magento\Option\ArrayInterface');
         $this->_sourceFactoryMock->expects($this->once())
             ->method('create')
             ->with('Source_Model_Name')
diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/CatalogPriceTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/CatalogPriceTest.php
index dc10cf9be9f..3f13056f3c6 100644
--- a/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/CatalogPriceTest.php
+++ b/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/CatalogPriceTest.php
@@ -61,7 +61,7 @@ class CatalogPriceTest extends \PHPUnit_Framework_TestCase
         $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface');
         $this->commonPriceMock
             = $this->getMock('Magento\Catalog\Model\Product\CatalogPrice', array(), array(), '', false);
-        $this->coreRegistryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $this->coreRegistryMock = $this->getMock('Magento\Registry', array(), array(), '', false);
         $methods = array('getStoreId', 'getWebsiteId', 'getCustomerGroupId', 'getPriceModel', '__wakeup');
         $this->productMock = $this->getMock('Magento\Catalog\Model\Product', $methods, array(), '', false);
         $this->priceModelMock
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/ViewTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/ViewTest.php
index 1a043e6a041..b37a9a9d3d4 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/ViewTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/ViewTest.php
@@ -47,7 +47,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase
     {
         $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
         $this->productTypeConfig = $this->getMock('Magento\Catalog\Model\ProductTypes\ConfigInterface');
-        $this->registryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $this->registryMock = $this->getMock('Magento\Registry', array(), array(), '', false);
         $this->view = $helper->getObject('Magento\Catalog\Block\Product\View', array(
                 'productTypeConfig' => $this->productTypeConfig,
                 'registry' => $this->registryMock
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/BuilderTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/BuilderTest.php
index b15fc84b663..81ec04df72a 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/BuilderTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/BuilderTest.php
@@ -68,7 +68,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
         $this->loggerMock = $this->getMock('Magento\Logger', array(), array(), '', false);
         $this->productFactoryMock
             = $this->getMock('Magento\Catalog\Model\ProductFactory', array('create'));
-        $this->registryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $this->registryMock = $this->getMock('Magento\Registry', array(), array(), '', false);
         $this->wysiwygConfigMock
             = $this->getMock('Magento\Cms\Model\Wysiwyg\Config', array('setStoreId'), array(), '', false);
         $this->requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false);
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Helper/Product/Flat/IndexerTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Helper/Product/Flat/IndexerTest.php
index b011ae2e48a..f97a7a7cfa9 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Helper/Product/Flat/IndexerTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Helper/Product/Flat/IndexerTest.php
@@ -46,6 +46,16 @@ class IndexerTest extends \PHPUnit_Framework_TestCase
      */
     protected $_resourceMock;
 
+    /**
+     * @var \Magento\DB\Adapter\Pdo\Mysql|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_connectionMock;
+
+    /**
+     * @var \Magento\Mview\View\Changelog|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_changelogMock;
+
     public function setUp()
     {
         $contextMock = $this->getMock('Magento\App\Helper\Context', array(), array(), '', false);
@@ -58,24 +68,35 @@ class IndexerTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnArgument(0));
 
         $flatHelperMock = $this->getMock(
-            '\Magento\Catalog\Helper\Product\Flat', array('isAddChildData'), array(), '', false
+            'Magento\Catalog\Helper\Product\Flat\Indexer', array('isAddChildData'), array(), '', false
         );
         $flatHelperMock->expects($this->any())
             ->method('isAddChildData')
             ->will($this->returnValue(true));
 
-        $eavConfigMock = $this->getMock('\Magento\Eav\Model\Config', array(), array(), '', false);
+        $eavConfigMock = $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false);
 
-        $attributeConfigMock = $this->getMock('\Magento\Catalog\Model\Attribute\Config', array(), array(), '', false);
+        $attributeConfigMock = $this->getMock('Magento\Catalog\Model\Attribute\Config', array(), array(), '', false);
 
         $resourceConfigFactoryMock = $this->getMock(
-            '\Magento\Catalog\Model\Resource\ConfigFactory', array(), array(), '', false
+            'Magento\Catalog\Model\Resource\ConfigFactory', array(), array(), '', false
         );
 
-        $eavFactoryMock = $this->getMock('\Magento\Eav\Model\Entity\AttributeFactory', array(), array(), '', false);
+        $eavFactoryMock = $this->getMock('Magento\Eav\Model\Entity\AttributeFactory', array(), array(), '', false);
 
         $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface');
 
+        $this->_connectionMock = $this->getMock(
+            'Magento\DB\Adapter\Pdo\Mysql', array('getTables', 'dropTable'), array(), '', false
+        );
+
+        $this->_changelogMock = $this->getMock(
+            'Magento\Mview\View\Changelog', array('getName'), array(), '', false
+        );
+
+
+
+
         $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
         $this->_model = $this->_objectManager->getObject('Magento\Catalog\Helper\Product\Flat\Indexer', array(
             'context'             => $contextMock,
@@ -86,8 +107,10 @@ class IndexerTest extends \PHPUnit_Framework_TestCase
             'configFactory'       => $resourceConfigFactoryMock,
             'attributeFactory'    => $eavFactoryMock,
             'storeManager'        => $this->_storeManagerMock,
+            'changelog'           => $this->_changelogMock,
             'flatAttributeGroups' => array('catalog_product')
         ));
+
     }
 
     public function testGetFlatColumnsDdlDefinition()
@@ -104,13 +127,16 @@ class IndexerTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('catalog_product_flat_1', $this->_model->getFlatTableName($storeId));
     }
 
+    /**
+     * Test deleting non-existent stores flat tables
+     */
     public function testDeleteAbandonedStoreFlatTables()
     {
-        $connectionMock = $this->getMock(
-            'Magento\DB\Adapter\Pdo\Mysql', array('getTables', 'dropTable'), [], '', false
-        );
+        $this->_changelogMock->expects($this->any())
+            ->method('getName')
+            ->will($this->returnValue('catalog_product_flat_cl'));
 
-        $connectionMock->expects($this->once())
+        $this->_connectionMock->expects($this->once())
             ->method('getTables')
             ->with('catalog_product_flat_%')
             ->will($this->returnValue(array(
@@ -119,18 +145,94 @@ class IndexerTest extends \PHPUnit_Framework_TestCase
                 'catalog_product_flat_3'
             )));
 
-        $connectionMock->expects($this->once())
+        $this->_connectionMock->expects($this->once())
             ->method('dropTable')
             ->with('catalog_product_flat_3');
 
         $this->_resourceMock->expects($this->once())
             ->method('getConnection')
             ->with('write')
-            ->will($this->returnValue($connectionMock));
+            ->will($this->returnValue($this->_connectionMock));
+
+        $this->_setStoreManagerExpectedStores(array(1, 2));
+
+        $this->_model->deleteAbandonedStoreFlatTables();
+    }
+
+    /**
+     * Test deleting multiple non-existent stores tables with changelog table
+     */
+    public function testDeleteNoStoresTables()
+    {
+        $this->_changelogMock->expects($this->any())
+            ->method('getName')
+            ->will($this->returnValue('catalog_product_flat_cl'));
+
+        $this->_connectionMock->expects($this->once())
+            ->method('getTables')
+            ->with('catalog_product_flat_%')
+            ->will($this->returnValue(array(
+                'catalog_product_flat_1',
+                'catalog_product_flat_2',
+                'catalog_product_flat_3',
+                'catalog_product_flat_4',
+                'catalog_product_flat_cl'
+            )));
+
+        $this->_connectionMock->expects($this->exactly(3))
+            ->method('dropTable');
+
+        $this->_resourceMock->expects($this->once())
+            ->method('getConnection')
+            ->with('write')
+            ->will($this->returnValue($this->_connectionMock));
+
+        $this->_setStoreManagerExpectedStores(array(1));
+
+        $this->_model->deleteAbandonedStoreFlatTables();
+    }
+
+    /**
+     * Test deleting changelog table
+     */
+    public function testDeleteCl()
+    {
+        $this->_changelogMock->expects($this->any())
+            ->method('getName')
+            ->will($this->returnValue('catalog_product_flat_cl'));
+
+        $this->_connectionMock->expects($this->once())
+            ->method('getTables')
+            ->with('catalog_product_flat_%')
+            ->will($this->returnValue(array(
+                'catalog_product_flat_cl'
+            )));
+
+        $this->_connectionMock->expects($this->never())
+            ->method('dropTable');
+
+        $this->_resourceMock->expects($this->once())
+            ->method('getConnection')
+            ->with('write')
+            ->will($this->returnValue($this->_connectionMock));
+
+        $this->_setStoreManagerExpectedStores(array(1));
 
-        $stores = [];
-        foreach (array(1 ,2) as $storeId) {
-            $store = $this->getMock('Magento\Core\Model\Store', array('getId', '__sleep', '__wakeup'), [], '', false);
+        $this->_model->deleteAbandonedStoreFlatTables();
+    }
+
+    /**
+     * Initialize store manager mock with expected store IDs
+     *
+     * @param array $storeIds
+     */
+    protected function _setStoreManagerExpectedStores(array $storeIds)
+    {
+        $stores = array();
+        foreach ($storeIds as $storeId) {
+            $store = $this->getMock(
+                'Magento\Core\Model\Store', array('getId', '__sleep', '__wakeup'), array(), '', false
+            );
             $store->expects($this->once())
                 ->method('getId')
                 ->will($this->returnValue($storeId));
@@ -140,7 +242,5 @@ class IndexerTest extends \PHPUnit_Framework_TestCase
         $this->_storeManagerMock->expects($this->once())
             ->method('getStores')
             ->will($this->returnValue($stores));
-
-        $this->_model->deleteAbandonedStoreFlatTables();
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php
index 011a70a4af9..918cd83ef72 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php
@@ -42,10 +42,12 @@ class RowTest extends \PHPUnit_Framework_TestCase
         $this->_model = $objectManager->getObject('Magento\Catalog\Model\Indexer\Product\Flat\Action\Row');
     }
 
-
+    /**
+     * @expectedException \Magento\Core\Exception
+     * @expectedExceptionMessage Could not rebuild index for undefined product
+     */
     public function testEmptyId()
     {
-        $this->setExpectedException('\Magento\Core\Exception', 'Could not rebuild index for undefined product');
         $this->_model->execute(null);
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows/TableDataTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows/TableDataTest.php
new file mode 100644
index 00000000000..d83d1cc134b
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows/TableDataTest.php
@@ -0,0 +1,170 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_Catalog
+ * @subpackage  unit_tests
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows;
+
+
+class TableDataTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_connectionMock;
+
+    /**
+     * @var \Magento\Catalog\Helper\Product\Flat\Indexer|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_productIndexerHelper;
+
+    /**
+     * @var \Magento\TestFramework\Helper\ObjectManager
+     */
+    protected $_objectManager;
+
+    /**
+     * @var \Magento\App\Resource|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_resourceMock;
+
+    protected function setUp()
+    {
+        $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->_connectionMock = $this->getMock('Magento\DB\Adapter\AdapterInterface');
+        $this->_resourceMock = $this->getMock('Magento\App\Resource', array(), array(), '', false);
+        $this->_productIndexerHelper = $this->getMock(
+            'Magento\Catalog\Helper\Product\Flat\Indexer', array(), array(), '', false
+        );
+    }
+
+    public function testMoveWithNonExistentFlatTable()
+    {
+        $flatTable = 'flat_table';
+        $flatDropName = 'flat_table_to_drop';
+        $temporaryFlatTableName = 'flat_tmp';
+
+        $this->_connectionMock->expects($this->exactly(2))
+            ->method('dropTable')
+            ->with($flatDropName);
+        $this->_connectionMock->expects($this->once())
+            ->method('isTableExists')
+            ->with($flatTable)
+            ->will($this->returnValue(false));
+
+        $this->_connectionMock->expects($this->once())
+            ->method('renameTablesBatch')
+            ->with(array(
+                'oldName' => 'flat_tmp',
+                'newName' => 'flat_table',
+            ));
+
+        $this->_resourceMock->expects($this->once())
+            ->method('getConnection')
+            ->with('write')
+            ->will($this->returnValue($this->_connectionMock));
+
+        $model = $this->_objectManager->getObject(
+            'Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows\TableData', array(
+                'resource' => $this->_resourceMock,
+                'productIndexerHelper' => $this->_productIndexerHelper
+            )
+        );
+
+        $model->move($flatTable, $flatDropName, $temporaryFlatTableName);
+    }
+
+    public function testMoveWithExistentFlatTable()
+    {
+        $flatTable = 'flat_table';
+        $flatDropName = 'flat_table_to_drop';
+        $temporaryFlatTableName = 'flat_tmp';
+
+        $describedColumns = array(
+            'column_11' => 'column_definition',
+            'column_2' => 'column_definition',
+            'column_3' => 'column_definition'
+        );
+
+        $flatColumns = array(
+            'column_1' => 'column_definition',
+            'column_2' => 'column_definition',
+            'column_3' => 'column_definition'
+        );
+
+        $selectMock = $this->getMock('Magento\DB\Select', array(), array(), '', false);
+        $selectMock->expects($this->once())
+            ->method('from')
+            ->with(
+                array('tf' => sprintf('%s_tmp_indexer', $flatTable)),
+                array('column_2', 'column_3')
+            );
+        $sql = md5(time());
+        $selectMock->expects($this->once())
+            ->method('insertFromSelect')
+            ->with($flatTable, array('column_2', 'column_3'))
+            ->will($this->returnValue($sql));
+
+        $this->_connectionMock->expects($this->once())
+            ->method('query')
+            ->with($sql);
+
+        $this->_connectionMock->expects($this->once())
+            ->method('select')
+            ->will($this->returnValue($selectMock));
+
+        $this->_connectionMock->expects($this->once())
+            ->method('isTableExists')
+            ->with($flatTable)
+            ->will($this->returnValue(true));
+
+        $this->_connectionMock->expects($this->once())
+            ->method('describeTable')
+            ->with($flatTable)
+            ->will($this->returnValue($describedColumns));
+
+        $this->_productIndexerHelper->expects($this->once())
+            ->method('getFlatColumns')
+            ->will($this->returnValue($flatColumns));
+
+        $this->_connectionMock->expects($this->once())
+            ->method('dropTable')
+            ->with(sprintf('%s_tmp_indexer', $flatTable));
+
+        $this->_resourceMock->expects($this->any())
+            ->method('getConnection')
+            ->with('write')
+            ->will($this->returnValue($this->_connectionMock));
+
+        $model = $this->_objectManager->getObject(
+            'Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows\TableData', array(
+                'resource' => $this->_resourceMock,
+                'productIndexerHelper' => $this->_productIndexerHelper
+            )
+        );
+
+        $model->move($flatTable, $flatDropName, $temporaryFlatTableName);
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php
index 7cb6691783f..42f1e46eb78 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php
@@ -42,10 +42,12 @@ class RowsTest extends \PHPUnit_Framework_TestCase
         $this->_model = $objectManager->getObject('Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows');
     }
 
-
+    /**
+     * @expectedException \Magento\Core\Exception
+     * @expectedExceptionMessage Bad value was supplied.
+     */
     public function testEmptyIds()
     {
-        $this->setExpectedException('\Magento\Core\Exception', 'Bad value was supplied.');
         $this->_model->execute(null);
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/IndexerConfigDataTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/IndexerConfigDataTest.php
index 139ccb6d12f..239240ef9cd 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/IndexerConfigDataTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/IndexerConfigDataTest.php
@@ -40,14 +40,14 @@ class IndexerConfigDataTest extends \PHPUnit_Framework_TestCase
     protected $_chainMock;
 
     /**
-     * @var \Magento\Catalog\Helper\Product\Flat|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Catalog\Model\Indexer\Product\Flat\State|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $_helperMock;
+    protected $_stateMock;
 
     protected function setUp()
     {
-        $this->_helperMock = $this->getMock(
-            'Magento\Catalog\Helper\Product\Flat', array('isEnabled'), array(), '', false
+        $this->_stateMock = $this->getMock(
+            'Magento\Catalog\Model\Indexer\Product\Flat\State', array('isFlatEnabled'), array(), '', false
         );
 
         $this->_chainMock = $this->getMock(
@@ -55,7 +55,7 @@ class IndexerConfigDataTest extends \PHPUnit_Framework_TestCase
         );
 
         $this->_model = new \Magento\Catalog\Model\Indexer\Product\Flat\Plugin\IndexerConfigData(
-            $this->_helperMock
+            $this->_stateMock
         );
     }
 
@@ -68,8 +68,8 @@ class IndexerConfigDataTest extends \PHPUnit_Framework_TestCase
      */
     public function testAroundGet($isFlat, array $arguments, $inputData, $outputData)
     {
-        $this->_helperMock->expects($this->once())
-            ->method('isEnabled')
+        $this->_stateMock->expects($this->once())
+            ->method('isFlatEnabled')
             ->will($this->returnValue($isFlat));
 
         $this->_chainMock->expects($this->once())
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
index 047bfa32dd1..6a5509c6901 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
@@ -39,22 +39,59 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase
      */
     protected $_model;
 
+    /**
+     * @var \Magento\Indexer\Model\Indexer|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_indexerMock;
+
+    /**
+     * @var \Magento\Catalog\Model\Indexer\Product\Flat\State|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_stateMock;
+
     public function setUp()
     {
         $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
 
-        $indexerMock = $this->getMock('\Magento\Indexer\Model\Indexer', array('getId'), array(), '', false);
-        $indexerMock->expects($this->any())->method('getId')->will($this->returnValue(1));
+        $this->_indexerMock = $this->getMock(
+            'Magento\Indexer\Model\Indexer', array('getId', 'invalidate'), array(), '', false
+        );
+        $this->_indexerMock->expects($this->any())->method('getId')->will($this->returnValue(1));
 
-        $flatHelperMock = $this->getMock('\Magento\Catalog\Helper\Product\Flat', array(), array(), '', false);
-        $this->_model = $this->_objectManager->getObject('\Magento\Catalog\Model\Indexer\Product\Flat\Processor', array(
-            'indexer' => $indexerMock,
-            'helper'  => $flatHelperMock
+        $this->_stateMock = $this->getMock(
+            'Magento\Catalog\Model\Indexer\Product\Flat\State', array('isFlatEnabled'), array(), '', false
+        );
+        $this->_model = $this->_objectManager->getObject('Magento\Catalog\Model\Indexer\Product\Flat\Processor', array(
+            'indexer' => $this->_indexerMock,
+            'state'  => $this->_stateMock
         ));
     }
 
+    /**
+     * Test get indexer instance
+     */
     public function testGetIndexer()
     {
         $this->assertInstanceOf('\Magento\Indexer\Model\Indexer', $this->_model->getIndexer());
     }
+
+    /**
+     * Test mark indexer as invalid if enabled
+     */
+    public function testMarkIndexerAsInvalid()
+    {
+        $this->_stateMock->expects($this->once())->method('isFlatEnabled')->will($this->returnValue(true));
+        $this->_indexerMock->expects($this->once())->method('invalidate');
+        $this->_model->markIndexerAsInvalid();
+    }
+
+    /**
+     * Test mark indexer as invalid if disabled
+     */
+    public function testMarkDisabledIndexerAsInvalid()
+    {
+        $this->_stateMock->expects($this->once())->method('isFlatEnabled')->will($this->returnValue(false));
+        $this->_indexerMock->expects($this->never())->method('invalidate');
+        $this->_model->markIndexerAsInvalid();
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/StateTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/StateTest.php
new file mode 100644
index 00000000000..932e322b8ec
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/StateTest.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_Catalog
+ * @subpackage  unit_tests
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Catalog\Model\Indexer\Product\Flat;
+
+class StateTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\TestFramework\Helper\ObjectManager
+     */
+    protected $_objectManager;
+
+    /**
+     * @var \Magento\Catalog\Model\Indexer\Product\Flat\State
+     */
+    protected $_model;
+
+    public function setUp()
+    {
+        $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+
+        $indexerMock = $this->getMock('Magento\Indexer\Model\Indexer', array(), array(), '', false);
+        $flatIndexerHelperMock = $this->getMock(
+            'Magento\Catalog\Helper\Product\Flat\Indexer', array(), array(), '', false
+        );
+        $configMock = $this->getMock('Magento\Core\Model\Store\ConfigInterface', array(), array(), '', false);
+        $this->_model = $this->_objectManager->getObject('Magento\Catalog\Model\Indexer\Product\Flat\State', array(
+            'storeConfig' => $configMock,
+            'flatIndexer'  => $indexerMock,
+            'flatIndexerHelper' => $flatIndexerHelperMock,
+            false
+        ));
+    }
+
+    public function testGetIndexer()
+    {
+        $this->assertInstanceOf('\Magento\Catalog\Helper\Product\Flat\Indexer', $this->_model->getFlatIndexerHelper());
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/TableDataTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/TableDataTest.php
new file mode 100644
index 00000000000..e2dfdde2f05
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/TableDataTest.php
@@ -0,0 +1,114 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_Catalog
+ * @subpackage  unit_tests
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Catalog\Model\Indexer\Product\Flat;
+
+
+class TableDataTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_connectionMock;
+
+    /**
+     * @var \Magento\TestFramework\Helper\ObjectManager
+     */
+    protected $_objectManager;
+
+    /**
+     * @var \Magento\App\Resource|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_resourceMock;
+
+    protected function setUp()
+    {
+        $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->_connectionMock = $this->getMock('Magento\DB\Adapter\AdapterInterface');
+        $this->_resourceMock = $this->getMock('Magento\App\Resource', array(), array(), '', false);
+    }
+
+    /**
+     * @param string $flatTable
+     * @param bool $isFlatTableExists
+     * @param string $flatDropName
+     * @param string $temporaryFlatTableName
+     * @param array $expectedRenameTablesArgument
+     * @dataProvider moveDataProvider
+     */
+    public function testMove(
+        $flatTable, $isFlatTableExists, $flatDropName, $temporaryFlatTableName, $expectedRenameTablesArgument
+    ) {
+        $this->_connectionMock->expects($this->exactly(2))
+            ->method('dropTable')
+            ->with($flatDropName);
+        $this->_connectionMock->expects($this->once())
+            ->method('isTableExists')
+            ->with($flatTable)
+            ->will($this->returnValue($isFlatTableExists));
+
+        $this->_connectionMock->expects($this->once())
+            ->method('renameTablesBatch')
+            ->with($expectedRenameTablesArgument);
+
+        $this->_resourceMock->expects($this->any())
+            ->method('getConnection')
+            ->with('write')
+            ->will($this->returnValue($this->_connectionMock));
+
+        $model = $this->_objectManager->getObject('Magento\Catalog\Model\Indexer\Product\Flat\TableData', array(
+            'resource' => $this->_resourceMock
+        ));
+
+        $model->move($flatTable, $flatDropName, $temporaryFlatTableName);
+    }
+
+    /**
+     * @return array
+     */
+    public function moveDataProvider()
+    {
+        return array(
+            array('flat_table', true, 'flat_table_to_drop', 'flat_tmp', array(
+                array(
+                    'oldName' => 'flat_table',
+                    'newName' => 'flat_table_to_drop',
+                ),
+                array(
+                    'oldName' => 'flat_tmp',
+                    'newName' => 'flat_table',
+                )
+            )),
+            array('flat_table', false, 'flat_table_to_drop', 'flat_tmp', array(
+                array(
+                    'oldName' => 'flat_tmp',
+                    'newName' => 'flat_table',
+                )
+            ))
+        );
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/SimpleTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/SimpleTest.php
index ea510e84e8c..a4d21dac8de 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/SimpleTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/SimpleTest.php
@@ -41,7 +41,7 @@ class SimpleTest extends \PHPUnit_Framework_TestCase
         $coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false);
         $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false);
         $filesystem = $this->getMockBuilder('Magento\App\Filesystem')->disableOriginalConstructor()->getMock();
-        $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $coreRegistry = $this->getMock('Magento\Registry', array(), array(), '', false);
         $logger = $this->getMock('Magento\Logger', array(), array(), '', false);
         $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false);
         $this->_model = $objectHelper->getObject('Magento\Catalog\Model\Product\Type\Simple', array(
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/VirtualTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/VirtualTest.php
index f56b1cbda15..c26b1802375 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/VirtualTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/VirtualTest.php
@@ -39,7 +39,7 @@ class VirtualTest extends \PHPUnit_Framework_TestCase
         $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this);
         $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false);
         $coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false);
-        $coreRegistryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $coreRegistryMock = $this->getMock('Magento\Registry', array(), array(), '', false);
         $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false);
         $filesystem = $this->getMockBuilder('Magento\App\Filesystem')->disableOriginalConstructor()->getMock();
         $logger = $this->getMock('Magento\Logger', array(), array(), '', false);
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php
index ea77aa7494d..6496273c32d 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php
@@ -75,7 +75,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase
 
 
         $contextMock = $this->getMock(
-            '\Magento\Core\Model\Context',
+            '\Magento\Model\Context',
             array('getEventDispatcher', 'getCacheManager', 'getAppState'), array(), '', false
         );
 
@@ -93,7 +93,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase
 
         $this->_model = new \Magento\Catalog\Model\Product(
             $contextMock,
-            $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false),
+            $this->getMock('Magento\Registry', array(), array(), '', false),
             $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false),
             $this->getMock('Magento\Catalog\Model\Product\Url', array(), array(), '', false),
             $this->getMock('Magento\Catalog\Model\Product\Link', array(), array(), '', false),
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php
index 5a5cb578613..f402670523b 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php
@@ -56,7 +56,7 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
         );
 
         $contextMock = $this->getMock(
-            '\Magento\Core\Model\Context',
+            '\Magento\Model\Context',
             array('getEventDispatcher', 'getCacheManager'), array(), '', false
         );
 
@@ -83,7 +83,7 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
 
         $this->_model = new \Magento\Catalog\Model\Resource\Eav\Attribute(
             $contextMock,
-            $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false),
+            $this->getMock('Magento\Registry', array(), array(), '', false),
             $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false),
             $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false),
             $this->getMock('Magento\Eav\Model\Entity\TypeFactory', array(), array(), '', false),
@@ -94,7 +94,7 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
             $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false),
             $this->getMock('Magento\Index\Model\Indexer', array(), array(), '', false),
             $this->_processor,
-            $this->getMock('\Magento\Catalog\Helper\Product\Flat', array(), array(), '', false),
+            $this->getMock('\Magento\Catalog\Helper\Product\Flat\Indexer', array(), array(), '', false),
             $this->getMock('\Magento\Catalog\Model\Attribute\LockValidatorInterface'),
             $resourceMock,
             $this->getMock('\Magento\Data\Collection\Db', array(), array(), '', false),
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueTest.php
index 8a80ba87374..7afadee32e7 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueTest.php
@@ -63,8 +63,8 @@ class ValueTest extends \PHPUnit_Framework_TestCase
     public function testSaveValueTitles()
     {
         $object = new Stub(
-            $this->getMock('Magento\Core\Model\Context', array(), array(), '', false),
-            $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false),
+            $this->getMock('Magento\Model\Context', array(), array(), '', false),
+            $this->getMock('Magento\Registry', array(), array(), '', false),
             null,
             null,
             self::$valueTitleData
diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Adminhtml/Stock/ItemTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Adminhtml/Stock/ItemTest.php
index 5932c8f643e..23013c95f1a 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Adminhtml/Stock/ItemTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Adminhtml/Stock/ItemTest.php
@@ -43,8 +43,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase
         );
 
         $this->_model = new \Magento\CatalogInventory\Model\Adminhtml\Stock\Item(
-            $this->getMock('Magento\Core\Model\Context', array(), array(), '', false),
-            $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false),
+            $this->getMock('Magento\Model\Context', array(), array(), '', false),
+            $this->getMock('Magento\Registry', array(), array(), '', false),
             $this->getMock('Magento\Customer\Model\Session', array(), array(), '', false),
             $this->getMock('Magento\Index\Model\Indexer', array(), array(), '', false),
             $this->getMock('Magento\CatalogInventory\Model\Stock\Status', array(), array(), '', false),
diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/PaymentTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/PaymentTest.php
deleted file mode 100644
index 07f3af89115..00000000000
--- a/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/PaymentTest.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Checkout\Block\Onepage;
-
-class PaymentTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @param mixed $hasRecurringItems
-     * @dataProvider hasRecurringItemsDataProvider
-     */
-    public function testHasRecurringItems($hasRecurringItems)
-    {
-        $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
-        $quote = $this->getMock('Magento\Sales\Model\Quote', array(
-            'hasRecurringItems',
-            '__wakeup'
-        ), array(), '', false);
-        $quote->expects($this->once())->method('hasRecurringItems')->will($this->returnValue($hasRecurringItems));
-        $checkoutSession = $this->getMock('Magento\Checkout\Model\Session', array(
-            'getQuote',
-            'setStepData'
-        ), array(), '', false);
-        $checkoutSession->expects($this->once())->method('getQuote')->will($this->returnValue($quote));
-        /** @var \Magento\Checkout\Block\Onepage\Payment $model */
-        $model = $helper->getObject('Magento\Checkout\Block\Onepage\Payment', array(
-            'resourceSession' => $checkoutSession
-        ));
-        $this->assertEquals($hasRecurringItems, $model->hasRecurringItems());
-    }
-
-    public function hasRecurringItemsDataProvider()
-    {
-        return array(
-            array(false),
-            array(true),
-        );
-    }
-}
diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php
index 69ce34740fa..1f8578d0c90 100644
--- a/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php
+++ b/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php
@@ -33,7 +33,7 @@ class DataTest extends \PHPUnit_Framework_TestCase
     /**
      * @var \PHPUnit_Framework_MockObject_MockObject
      */
-    private $_emailTemplate;
+    private $_transportBuilder;
 
     /**
      * @var \PHPUnit_Framework_MockObject_MockObject
@@ -67,15 +67,13 @@ class DataTest extends \PHPUnit_Framework_TestCase
             '\Magento\Checkout\Model\Resource\Agreement\CollectionFactory', array(), array(), '', false
         );
 
-        $this->_emailTemplate = $this->getMock('\Magento\Email\Model\Template', array(), array(), '', false);
-        $emailTplFactory = $this->getMock(
-            '\Magento\Email\Model\TemplateFactory', array('create'), array(), '', false
+        $this->_transportBuilder = $this->getMock(
+            '\Magento\Mail\Template\TransportBuilder', array(), array(), '', false
         );
-        $emailTplFactory->expects($this->once())->method('create')->will($this->returnValue($this->_emailTemplate));
 
         $this->_helper = new Data(
             $context, $storeConfig, $storeManager, $checkoutSession,
-            $locale, $collectionFactory, $emailTplFactory, $this->_translator
+            $locale, $collectionFactory, $this->_transportBuilder, $this->_translator
         );
     }
 
@@ -84,18 +82,35 @@ class DataTest extends \PHPUnit_Framework_TestCase
         $shippingAddress = new \Magento\Object(array('shipping_method' => 'ground_transportation'));
         $billingAddress = new \Magento\Object(array('street' => 'Fixture St'));
 
-        $this->_emailTemplate
+        $this->_transportBuilder
             ->expects($this->once())
-            ->method('setDesignConfig')
+            ->method('setTemplateOptions')
             ->with(array('area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, 'store' => 8))
             ->will($this->returnSelf())
         ;
-        $this->_emailTemplate->expects($this->once())->method('sendTransactional')->with(
-            'fixture_email_template_payment_failed',
-            'noreply@example.com',
-            'sysadmin@example.com',
-            'System Administrator',
-            $this->identicalTo(array(
+
+        $this->_transportBuilder
+            ->expects($this->once())
+            ->method('setTemplateIdentifier')
+            ->with('fixture_email_template_payment_failed')
+            ->will($this->returnSelf());
+
+        $this->_transportBuilder
+            ->expects($this->once())
+            ->method('setFrom')
+            ->with('noreply@example.com')
+            ->will($this->returnSelf());
+
+        $this->_transportBuilder
+            ->expects($this->once())
+            ->method('addTo')
+            ->with('sysadmin@example.com', 'System Administrator')
+            ->will($this->returnSelf());
+
+        $this->_transportBuilder
+            ->expects($this->once())
+            ->method('setTemplateVars')
+            ->with(array(
                 'reason'            => 'test message',
                 'checkoutType'      => 'onepage',
                 'dateAndTime'       => 'Oct 02, 2013',
@@ -108,6 +123,11 @@ class DataTest extends \PHPUnit_Framework_TestCase
                 'items'             => "Product One  x 2  USD 10<br />\nProduct Two  x 3  USD 60<br />\n",
                 'total'             => 'USD 70',
             ))
+            ->will($this->returnSelf());
+
+        $this->_transportBuilder->expects($this->once())->method('addBcc')->will($this->returnSelf());
+        $this->_transportBuilder->expects($this->once())->method('getTransport')->will(
+            $this->returnValue($this->getMock('Magento\Mail\TransportInterface'))
         );
 
         $this->_translator->expects($this->at(0))->method('setTranslateInline')->with(false);
diff --git a/dev/tests/unit/testsuite/Magento/Code/NameBuilderTest.php b/dev/tests/unit/testsuite/Magento/Code/NameBuilderTest.php
new file mode 100644
index 00000000000..8f48ee0e618
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Code/NameBuilderTest.php
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @subpackage  unit_tests
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Code;
+
+class NameBuilderTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Code\NameBuilder
+     */
+    protected $nameBuilder;
+
+    protected function setUp()
+    {
+        $nelper = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->nameBuilder = $nelper->getObject('Magento\Code\NameBuilder');
+    }
+
+    /**
+     * @param array $parts
+     * @param string $expected
+     *
+     * @dataProvider buildClassNameDataProvider
+     */
+    public function testBuildClassName($parts, $expected)
+    {
+        $this->assertEquals($expected, $this->nameBuilder->buildClassName($parts));
+    }
+
+    public function buildClassNameDataProvider()
+    {
+        return array(
+            array(
+                array(
+                    'Checkout',
+                    'Controller',
+                    'Index'
+                ),
+                'Checkout\Controller\Index'
+            ),
+            array(
+                array(
+                    'checkout',
+                    'controller',
+                    'index'
+                ),
+                'Checkout\Controller\Index'
+            ),
+            array(
+                array(
+                    'Magento_Backend',
+                    'Block',
+                    'urlrewrite',
+                    'edit',
+                    'form',
+                ),
+                'Magento\Backend\Block\Urlrewrite\Edit\Form'
+            ),
+        );
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php b/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php
index ecb3cc8c55f..831a1b863cd 100644
--- a/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php
+++ b/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php
@@ -48,7 +48,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase
         $coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false);
         $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false);
         $filesystem = $this->getMockBuilder('Magento\App\Filesystem')->disableOriginalConstructor()->getMock();
-        $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $coreRegistry = $this->getMock('Magento\Registry', array(), array(), '', false);
         $logger = $this->getMock('Magento\Logger', array(), array(), '', false);
         $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false);
         $confFactoryMock = $this->getMock('Magento\ConfigurableProduct\Model\Resource\Product\Type\ConfigurableFactory',
diff --git a/dev/tests/unit/testsuite/Magento/Core/Helper/StringTest.php b/dev/tests/unit/testsuite/Magento/Core/Helper/StringTest.php
deleted file mode 100644
index c1933471c2f..00000000000
--- a/dev/tests/unit/testsuite/Magento/Core/Helper/StringTest.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @subpackage  unit_tests
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Core\Helper;
-
-class StringTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var \Magento\Core\Helper\String
-     */
-    protected $_helper;
-
-    /**
-     * @var \Magento\TestFramework\Helper\ObjectManager
-     */
-    protected $_objectManager;
-
-    protected function setUp()
-    {
-        $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
-        $this->_helper = $this->_objectManager->getObject('Magento\Core\Helper\String');
-    }
-
-    /**
-     * @param string $testString
-     * @param string $expected
-     *
-     * @dataProvider upperCaseWordsDataProvider
-     */
-    public function testUpperCaseWords($testString, $expected)
-    {
-        $string = new \Magento\Stdlib\String;
-        $actual = $string->upperCaseWords($testString);
-        $this->assertEquals($expected, $actual);
-    }
-
-    /**
-     * @return array
-     */
-    public function upperCaseWordsDataProvider()
-    {
-        return array(
-            array(
-                'test test2',
-                'Test_Test2',
-            ),
-            array(
-                'test_test2',
-                'Test_Test2',
-            ),
-            array(
-                'test_test2 test3',
-                'Test_Test2_Test3',
-            ),
-        );
-    }
-
-    /**
-     * @param string $testString
-     * @param string $sourceSeparator
-     * @param string $destinationSeparator
-     * @param string $expected
-     *
-     * @dataProvider upperCaseWordsWithSeparatorsDataProvider
-     */
-    public function testUpperCaseWordsWithSeparators($testString, $sourceSeparator, $destinationSeparator, $expected)
-    {
-        $string = new \Magento\Stdlib\String;
-        $actual = $string->upperCaseWords($testString, $sourceSeparator, $destinationSeparator);
-        $this->assertEquals($expected, $actual);
-    }
-
-    /**
-     * @return array
-     */
-    public function upperCaseWordsWithSeparatorsDataProvider()
-    {
-        return array(
-            array(
-                'test test2_test3\test4|test5',
-                '|',
-                '\\',
-                'Test\Test2_test3\test4\Test5',
-            ),
-        );
-    }
-}
diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php
index 04013acc91b..532fc2f65d4 100644
--- a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php
+++ b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php
@@ -38,12 +38,12 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase
     protected $directoryDatabase;
 
     /**
-     * @var \Magento\Core\Model\Context |\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Model\Context |\PHPUnit_Framework_MockObject_MockObject
      */
     protected $contextMock;
 
     /**
-     * @var \Magento\Core\Model\Registry |\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Registry |\PHPUnit_Framework_MockObject_MockObject
      */
     protected $registryMock;
 
@@ -97,8 +97,8 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase
      */
     protected function setUp()
     {
-        $this->contextMock          = $this->getMock('Magento\Core\Model\Context', array(), array(), '', false);
-        $this->registryMock         = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $this->contextMock          = $this->getMock('Magento\Model\Context', array(), array(), '', false);
+        $this->registryMock         = $this->getMock('Magento\Registry', array(), array(), '', false);
         $this->helperStorageDatabase = $this->getMock('Magento\Core\Helper\File\Storage\Database',
             array(), array(), '', false);
         $this->dateModelMock        = $this->getMock('Magento\Core\Model\Date',
diff --git a/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/CacheManagerTest.php b/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/CacheManagerTest.php
deleted file mode 100644
index 32ead741cf1..00000000000
--- a/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/CacheManagerTest.php
+++ /dev/null
@@ -1,251 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-namespace Magento\Css\PreProcessor\Cache;
-
-use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
-
-class CacheManagerTest extends \PHPUnit_Framework_TestCase
-{
-    /** @var \Magento\Css\PreProcessor\Cache\CacheManager */
-    protected $cacheManager;
-
-    /** @var ObjectManagerHelper */
-    protected $objectManagerHelper;
-
-    /** @var \Magento\Css\PreProcessor\Cache\Import\Map\Storage|\PHPUnit_Framework_MockObject_MockObject */
-    protected $storageMock;
-
-    /** @var \Magento\Css\PreProcessor\Cache\Import\ImportEntityFactory|\PHPUnit_Framework_MockObject_MockObject */
-    protected $importEntityFactoryMock;
-
-    protected function setUp()
-    {
-        $this->storageMock = $this->getMock('Magento\Css\PreProcessor\Cache\Import\Map\Storage', [], [], '', false);
-        $this->importEntityFactoryMock = $this->getMock(
-            'Magento\Css\PreProcessor\Cache\Import\ImportEntityFactory',
-            [],
-            [],
-            '',
-            false
-        );
-
-        $this->objectManagerHelper = new ObjectManagerHelper($this);
-        $this->cacheManager = $this->objectManagerHelper->getObject(
-            'Magento\Css\PreProcessor\Cache\CacheManager',
-            [
-                'storage' => $this->storageMock,
-                'importEntityFactory' => $this->importEntityFactoryMock,
-                'filePath' => 'Magento_Core::style.css',
-                'params' => ['theme' => 'some_theme', 'area' => 'frontend', 'locale' => 'en_US']
-            ]
-        );
-    }
-
-    public function testClearCache()
-    {
-        $expectedKey = 'Magento_Core::style.css|frontend|en_US|some_theme';
-
-        $fileKeyProperty = new \ReflectionProperty($this->cacheManager, 'uniqueFileKey');
-        $fileKeyProperty->setAccessible(true);
-        $this->assertEquals($expectedKey, $fileKeyProperty->getValue($this->cacheManager));
-
-        $cachedFileProperty = new \ReflectionProperty($this->cacheManager, 'cachedFile');
-        $cachedFileProperty->setAccessible(true);
-        $cachedFileProperty->setValue($this->cacheManager, 'some_cachedFile');
-
-        $importEntitiesProperty = new \ReflectionProperty($this->cacheManager, 'importEntities');
-        $importEntitiesProperty->setAccessible(true);
-        $this->assertEquals([], $importEntitiesProperty->getValue($this->cacheManager));
-        $importEntitiesProperty->setValue($this->cacheManager, ['some_import_1', 'some_import_2']);
-
-        $this->storageMock->expects($this->once())
-            ->method('delete')
-            ->with($this->equalTo($expectedKey))
-            ->will($this->returnSelf());
-
-        $this->assertEquals($this->cacheManager, $this->cacheManager->clearCache());
-        $this->assertNull($cachedFileProperty->getValue($this->cacheManager));
-        $this->assertEquals([], $importEntitiesProperty->getValue($this->cacheManager));
-    }
-
-    public function testGetCachedFile()
-    {
-        $property = new \ReflectionProperty($this->cacheManager, 'cachedFile');
-        $property->setAccessible(true);
-        $this->assertNull($property->getValue($this->cacheManager));
-        $property->setValue($this->cacheManager, 'test');
-        $this->assertEquals('test', $this->cacheManager->getCachedFile());
-    }
-
-    /**
-     * @param array $params
-     * @param array $expectedResult
-     * @dataProvider addEntityToCacheDataProvider
-     */
-    public function testAddEntityToCache($params, $expectedResult)
-    {
-        $importEntitiesProperty = new \ReflectionProperty($this->cacheManager, 'importEntities');
-        $importEntitiesProperty->setAccessible(true);
-        $this->assertEquals([], $importEntitiesProperty->getValue($this->cacheManager));
-
-        $this->importEntityFactoryMock->expects($this->any())->method('create')
-            ->with($this->anything(), $this->anything())->will($this->returnValue('entity_object_here'));
-        foreach ($params as $value) {
-            $this->assertEquals(
-                $this->cacheManager,
-                $this->cacheManager->addEntityToCache($value['filePath'], $value['viewParams'])
-            );
-        }
-        $this->assertEquals($expectedResult, $importEntitiesProperty->getValue($this->cacheManager));
-    }
-
-    /**
-     * @return array
-     */
-    public function addEntityToCacheDataProvider()
-    {
-        $themeModelMockId = $this->getMock('Magento\Core\Model\Theme', [], [], '', false);
-        $themeModelMockId->expects($this->once())->method('getId')->will($this->returnValue('1'));
-
-        $themeModelMockPath = $this->getMock('Magento\Core\Model\Theme', [], [], '', false);
-        $themeModelMockPath->expects($this->once())->method('getThemePath')->will($this->returnValue('mocked_path'));
-        return [
-            'one import' => [
-                'params' => [
-                    [
-                        'filePath' => 'css\some_file.css',
-                        'viewParams' => ['theme' => 'other_theme', 'area' => 'backend', 'locale' => 'fr_FR']
-                    ]
-                ],
-                'expectedResult' => ['css\some_file.css|backend|fr_FR|other_theme' => 'entity_object_here']
-            ],
-            'one import with theme id' => [
-                'params' => [
-                    [
-                        'filePath' => 'css\theme_id\some_file.css',
-                        'viewParams' => ['themeModel' => $themeModelMockId, 'area' => 'backend', 'locale' => 'en_En']
-                    ]
-                ],
-                'expectedResult' => ['css\theme_id\some_file.css|backend|en_En|1' => 'entity_object_here']
-            ],
-            'one import with theme path' => [
-                'params' => [
-                    [
-                        'filePath' => 'css\some_file.css',
-                        'viewParams' => ['themeModel' => $themeModelMockPath, 'area' => 'frontend']
-                    ]
-                ],
-                'expectedResult' => ['css\some_file.css|frontend|088d309371332feb12bad4dbf93cfb5d'
-                    => 'entity_object_here']
-            ],
-            'list of imports' => [
-                'params' => [
-                    [
-                        'filePath' => 'Magento_Core::folder\file.css',
-                        'viewParams' => ['theme' => 'theme_path', 'area' => 'backend']
-                    ],
-                    [
-                        'filePath' => 'calendar\button.css',
-                        'viewParams' => ['theme' => 'theme_path', 'area' => 'backend', 'locale' => 'en_US']
-                    ],
-                ],
-                'expectedResult' => [
-                    'Magento_Core::folder\file.css|backend|theme_path' => 'entity_object_here',
-                    'calendar\button.css|backend|en_US|theme_path' => 'entity_object_here',
-                ]
-            ],
-        ];
-    }
-
-    /**
-     * @param string $uniqueFileKey
-     * @param array $expected
-     * @dataProvider saveCacheDataProvider
-     */
-    public function testSaveCache($uniqueFileKey, $expected)
-    {
-        $importEntitiesProperty = new \ReflectionProperty($this->cacheManager, 'importEntities');
-        $importEntitiesProperty->setAccessible(true);
-        $this->assertEquals([], $importEntitiesProperty->getValue($this->cacheManager));
-        $importEntitiesProperty->setValue($this->cacheManager, $expected['imports']);
-
-        $this->storageMock->expects($this->once())
-            ->method('save')
-            ->with($this->equalTo($uniqueFileKey), $this->equalTo(serialize($expected)))
-            ->will($this->returnSelf());
-        $this->assertEquals($this->cacheManager, $this->cacheManager->saveCache($expected['cached_file']));
-    }
-
-    /**
-     * @return array
-     */
-    public function saveCacheDataProvider()
-    {
-        return [
-            [
-                'Magento_Core::style.css|frontend|en_US|some_theme',
-                [
-                    'cached_file' => 'file-to-save.css',
-                    'imports' => ['import1', 'import2', 'import3']
-                ]
-            ]
-        ];
-    }
-
-    /**
-     * @param Import\ImportEntity[] $importData
-     * @param bool $expected
-     * @dataProvider isValidDataProvider
-     */
-    public function testIsValid($importData, $expected)
-    {
-        $importEntitiesProperty = new \ReflectionProperty($this->cacheManager, 'importEntities');
-        $importEntitiesProperty->setAccessible(true);
-        $this->assertEquals([], $importEntitiesProperty->getValue($this->cacheManager));
-        $importEntitiesProperty->setValue($this->cacheManager, $importData);
-
-        $method = new \ReflectionMethod('Magento\Css\PreProcessor\Cache\CacheManager', 'isValid');
-        $method->setAccessible(true);
-
-        $this->assertEquals($expected, $method->invoke($this->cacheManager));
-    }
-
-    /**
-     * @return array
-     */
-    public function isValidDataProvider()
-    {
-        $importEntityTrue = $this->getMock('Magento\Css\PreProcessor\Cache\Import\ImportEntity', [], [], '', false);
-        $importEntityTrue->expects($this->once())->method('isValid')->will($this->returnValue(true));
-
-        $importEntityFalse = $this->getMock('Magento\Css\PreProcessor\Cache\Import\ImportEntity', [], [], '', false);
-        $importEntityFalse->expects($this->once())->method('isValid')->will($this->returnValue(false));
-        return [
-            [[$importEntityTrue], true],
-            [[$importEntityFalse], false],
-            [[], false]
-        ];
-    }
-}
diff --git a/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Import/CacheTest.php b/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Import/CacheTest.php
new file mode 100644
index 00000000000..3d0f403f0c6
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Import/CacheTest.php
@@ -0,0 +1,329 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Css\PreProcessor\Cache\Import;
+
+use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
+
+class CacheTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\Css\PreProcessor\Cache\Import\Cache */
+    protected $cache;
+
+    /** @var ObjectManagerHelper */
+    protected $objectManagerHelper;
+
+    /** @var \Magento\Css\PreProcessor\Cache\Import\Map\Storage|\PHPUnit_Framework_MockObject_MockObject */
+    protected $storageMock;
+
+    /** @var \Magento\Css\PreProcessor\Cache\Import\ImportEntityFactory|\PHPUnit_Framework_MockObject_MockObject */
+    protected $importEntityFactoryMock;
+
+    /** @var \Magento\Filesystem\Directory\ReadInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $rootDirectory;
+
+    protected function setUp()
+    {
+        $this->storageMock = $this->getMock('Magento\Css\PreProcessor\Cache\Import\Map\Storage', [], [], '', false);
+        $this->rootDirectory = $this->getMock('Magento\Filesystem\Directory\ReadInterface', [], [], '', false);
+        $this->importEntityFactoryMock = $this->getMock('Magento\Css\PreProcessor\Cache\Import\ImportEntityFactory',
+            [], [], '', false);
+
+        $cssFile = $this->getMock('Magento\View\Publisher\CssFile', [], [], '', false);
+        $cssFile->expects($this->once())->method('getFilePath')->will($this->returnValue('Magento_Core::style.css'));
+        $cssFile->expects($this->once())
+            ->method('getViewParams')
+            ->will($this->returnValue(['theme' => 'some_theme', 'area' => 'frontend', 'locale' => 'en_US']));
+
+        $fileFactory = $this->getMock('Magento\View\Publisher\FileFactory', [], [], '', false);
+        $fileFactory->expects($this->any())
+            ->method('create')
+            ->will($this->returnValue($cssFile));
+
+        $filesystem = $this->getMock('Magento\App\Filesystem', [], [], '', false);
+        $filesystem->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($this->rootDirectory));
+
+        $this->objectManagerHelper = new ObjectManagerHelper($this);
+        $this->cache = $this->objectManagerHelper->getObject('Magento\Css\PreProcessor\Cache\Import\Cache', [
+            'storage'             => $this->storageMock,
+            'importEntityFactory' => $this->importEntityFactoryMock,
+            'filesystem'          => $filesystem,
+            'fileFactory'         => $fileFactory,
+            'publisherFile'       => $cssFile
+        ]);
+    }
+
+    public function testClearCache()
+    {
+        $expectedKey = 'Magento_Core::style.css|frontend|en_US|some_theme';
+
+        $fileKeyProperty = new \ReflectionProperty($this->cache, 'uniqueFileKey');
+        $fileKeyProperty->setAccessible(true);
+        $this->assertEquals($expectedKey, $fileKeyProperty->getValue($this->cache));
+
+        $cachedFileProperty = new \ReflectionProperty($this->cache, 'cachedFile');
+        $cachedFileProperty->setAccessible(true);
+        $cachedFileProperty->setValue($this->cache, 'some_cachedFile');
+
+        $importEntitiesProperty = new \ReflectionProperty($this->cache, 'importEntities');
+        $importEntitiesProperty->setAccessible(true);
+        $this->assertEquals([], $importEntitiesProperty->getValue($this->cache));
+        $importEntitiesProperty->setValue($this->cache, ['some_import_1', 'some_import_2']);
+
+        $this->storageMock->expects($this->once())
+            ->method('delete')
+            ->with($this->equalTo($expectedKey))
+            ->will($this->returnSelf());
+
+        $this->assertEquals($this->cache, $this->cache->clear());
+        $this->assertEmpty($cachedFileProperty->getValue($this->cache));
+        $this->assertEquals([], $importEntitiesProperty->getValue($this->cache));
+    }
+
+    public function testGetCachedFile()
+    {
+        $property = new \ReflectionProperty($this->cache, 'cachedFile');
+        $property->setAccessible(true);
+        $this->assertEmpty($property->getValue($this->cache));
+        $property->setValue(
+            $this->cache,
+            $this->getMock('Magento\View\Publisher\CssFile', [], [], '', false)
+        );
+        $this->assertInstanceOf('\Magento\View\Publisher\CssFile', $this->cache->get());
+    }
+
+    /**
+     * @param array $params
+     * @param array $expectedResult
+     * @dataProvider addEntityToCacheDataProvider
+     */
+    public function testAddEntityToCache($params, $expectedResult)
+    {
+        $importEntitiesProperty = new \ReflectionProperty($this->cache, 'importEntities');
+        $importEntitiesProperty->setAccessible(true);
+        $this->assertEquals([], $importEntitiesProperty->getValue($this->cache));
+
+        $this->importEntityFactoryMock
+            ->expects($this->any())
+            ->method('create')
+            ->with($this->isInstanceOf('Magento\Less\PreProcessor\File\Less'))
+            ->will($this->returnValue('entity_object_here'));
+
+        foreach ($params as $value) {
+            $this->assertEquals(
+                $this->cache,
+                $this->cache->add($value)
+            );
+        }
+        $this->assertEquals($expectedResult, $importEntitiesProperty->getValue($this->cache));
+    }
+
+    /**
+     * @return array
+     */
+    public function addEntityToCacheDataProvider()
+    {
+        $themeModelMockId = $this->getMock('Magento\Core\Model\Theme', [], [], '', false);
+        $themeModelMockId->expects($this->once())->method('getId')->will($this->returnValue('1'));
+
+        $themeModelMockPath = $this->getMock('Magento\Core\Model\Theme', [], [], '', false);
+        $themeModelMockPath->expects($this->once())->method('getThemePath')->will($this->returnValue('mocked_path'));
+        return [
+            'one import' => [
+                'params' => $this->getLessFile([[
+                    'filePath' => 'css\some_file.css',
+                    'viewParams' => ['theme' => 'other_theme', 'area' => 'backend', 'locale' => 'fr_FR']
+                ]]),
+                'expectedResult' => ['file_id_1' => 'entity_object_here']
+            ],
+            'one import with theme id' => [
+                'params' => $this->getLessFile([[
+                    'filePath' => 'css\theme_id\some_file.css',
+                    'viewParams' => ['themeModel' => $themeModelMockId, 'locale' => 'en_En']
+                ]]),
+                'expectedResult' => ['file_id_1' => 'entity_object_here']
+            ],
+            'one import with theme path' => [
+                'params' => $this->getLessFile([[
+                    'filePath' => 'css\some_file.css',
+                    'viewParams' => ['themeModel' => $themeModelMockPath, 'area' => 'frontend']
+                ]]),
+                'expectedResult' => ['file_id_1' => 'entity_object_here']
+            ],
+            'list of imports' => [
+                'params' => $this->getLessFile([
+                    [
+                        'filePath' => 'Magento_Core::folder\file.css',
+                        'viewParams' => ['theme' => 'theme_path', 'area' => 'backend'],
+                    ],
+                    [
+                        'filePath' => 'calendar\button.css',
+                        'viewParams' => ['theme' => 'theme_path', 'area' => 'backend', 'locale' => 'en_US']
+                    ]
+                ]),
+                'expectedResult' => [
+                    'file_id_1' => 'entity_object_here',
+                    'file_id_2' => 'entity_object_here',
+                ]
+            ],
+        ];
+    }
+
+    /**
+     * @param array $filesData
+     * @return \Magento\Less\PreProcessor\File\Less|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected function getLessFile($filesData)
+    {
+        $lessFiles = [];
+        $fileCounter = 0;
+        $fileCounterCallback = $this->returnCallback(function () use (&$fileCounter) {
+            return 'file_id_' . ++$fileCounter;
+        });
+        foreach ($filesData as $fileData) {
+            $readDirectory = $this->getMock('Magento\Filesystem\Directory\ReadInterface', [], [], '', false);
+            $readDirectory->expects($this->any())->method('stat')->with('file_path')
+                ->will($this->returnValue(isset($fileData['mtime']) ? $fileData['mtime'] : null));
+            $lessFile = $this->getMock('Magento\Less\PreProcessor\File\Less', [], [], '', false);
+            $lessFile->expects($this->any())->method('getFilePath')->will($this->returnValue($fileData['filePath']));
+            $lessFile->expects($this->any())->method('getViewParams')
+                ->will($this->returnValue($fileData['viewParams']));
+            $lessFile->expects($this->any())->method('getFileIdentifier')->will($fileCounterCallback);
+            $lessFile->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($readDirectory));
+            $lessFiles[] = $lessFile;
+        }
+        return $lessFiles;
+    }
+
+    /**
+     * @param \Magento\View\Publisher\CssFile $cssFile
+     * @param string $uniqueFileKey
+     * @param array $expected
+     * @dataProvider saveCacheDataProvider
+     */
+    public function testSaveCache($cssFile, $uniqueFileKey, $expected)
+    {
+        $importEntitiesProperty = new \ReflectionProperty($this->cache, 'importEntities');
+        $importEntitiesProperty->setAccessible(true);
+        $this->assertEquals([], $importEntitiesProperty->getValue($this->cache));
+        $importEntitiesProperty->setValue($this->cache, $expected['imports']);
+
+        $this->storageMock->expects($this->once())
+            ->method('save')
+            ->with($this->equalTo($uniqueFileKey), $this->equalTo(serialize($expected)))
+            ->will($this->returnSelf());
+        $this->assertEquals($this->cache, $this->cache->save($cssFile));
+    }
+
+    /**
+     * @return array
+     */
+    public function saveCacheDataProvider()
+    {
+        $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $arguments = $objectManager->getConstructArguments(
+            'Magento\View\Publisher\CssFile',
+            ['viewParams' => ['area' => 'frontend']]
+        );
+
+        $cssFile = $objectManager->getObject('Magento\View\Publisher\CssFile', $arguments);
+
+        return [
+            [
+                $cssFile,
+                'Magento_Core::style.css|frontend|en_US|some_theme',
+                [
+                    'cached_file' => $cssFile,
+                    'imports' => ['import1', 'import2', 'import3']
+                ]
+            ]
+        ];
+    }
+
+    /**
+     * @param array $filesData
+     * @param int $baseTime
+     * @param bool $expected
+     * @dataProvider isValidDataProvider
+     */
+    public function testIsValid($filesData, $baseTime, $expected)
+    {
+        $factoryCallback = $this->returnCallback(function ($lessFile) {
+            /** @var $lessFile \Magento\Less\PreProcessor\File\Less|\PHPUnit_Framework_MockObject_MockObject */
+            $importEntity = $this->getMock('Magento\Css\PreProcessor\Cache\Import\ImportEntity', [], [], '', false);
+            $changeTime = $lessFile->getDirectoryRead()->stat('file_path');
+            $importEntity->expects($this->atLeastOnce())->method('getOriginalMtime')
+                ->will($this->returnValue($changeTime));
+            return $importEntity;
+        });
+        $this->importEntityFactoryMock->expects($this->any())->method('create')->will($factoryCallback);
+        $files = $this->getLessFile($filesData);
+        foreach ($files as $file) {
+            $this->cache->add($file);
+        }
+        $this->rootDirectory->expects($this->any())->method('stat')->will($this->returnValue(['mtime' => $baseTime]));
+        $this->assertEquals($expected, $this->cache->isValid());
+    }
+
+    /**
+     * @return array
+     */
+    public function isValidDataProvider()
+    {
+        return [
+            [
+                'filesData' => [
+                    [
+                        'filePath' => 'Magento_Core::folder\file.css',
+                        'viewParams' => ['theme' => 'theme_path', 'area' => 'backend'],
+                        'mtime' => 12345
+                    ],
+                    [
+                        'filePath' => 'calendar\button.css',
+                        'viewParams' => ['theme' => 'theme_path', 'area' => 'backend', 'locale' => 'en_US'],
+                        'mtime' => 12345
+                    ]
+                ],
+                'baseTime' => 12345,
+                'expected' => true
+            ],
+            [
+                'filesData' => [
+                    [
+                        'filePath' => 'Magento_Core::folder\file.css',
+                        'viewParams' => ['theme' => 'theme_path', 'area' => 'backend'],
+                        'mtime' => 12345
+                    ],
+                ],
+                'baseTime' => 54321,
+                'expected' => false
+            ],
+            [
+                'filesData' => [],
+                'baseTime' => 12345,
+                'expected' => false
+            ]
+        ];
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Import/ImportEntityTest.php b/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Import/ImportEntityTest.php
index 3d007b11862..e8cbabc81a0 100644
--- a/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Import/ImportEntityTest.php
+++ b/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Import/ImportEntityTest.php
@@ -50,6 +50,11 @@ class ImportEntityTest extends \PHPUnit_Framework_TestCase
      */
     protected $absolutePath;
 
+    /**
+     * @var string
+     */
+    protected $absoluteFilePath;
+
     /**
      * @param string $relativePath
      * @param int $originalMtime
@@ -57,7 +62,6 @@ class ImportEntityTest extends \PHPUnit_Framework_TestCase
     protected function createMock($relativePath, $originalMtime)
     {
         $filePath = 'someFile';
-        $params = ['some', 'params'];
         $this->absoluteFilePath = 'some_absolute_path';
 
         $this->rootDirectory = $this->getMock('Magento\Filesystem\Directory\ReadInterface', [], [], '', false);
@@ -71,32 +75,17 @@ class ImportEntityTest extends \PHPUnit_Framework_TestCase
             ->with($this->equalTo($relativePath))
             ->will($this->returnValue(['mtime' => $originalMtime]));
 
-        $this->filesystemMock = $this->getMock('Magento\Filesystem', [], [], '', false);
-        $this->filesystemMock->expects($this->once())
-            ->method('getDirectoryRead')
-            ->with($this->equalTo(\Magento\App\Filesystem::ROOT_DIR))
-            ->will($this->returnValue($this->rootDirectory));
+        $this->objectManagerHelper = new ObjectManagerHelper($this);
 
-        $this->fileSystemMock = $this->getMock('Magento\View\FileSystem', [], [], '', false);
-        $this->fileSystemMock->expects($this->once())
-            ->method('getViewFile')
-            ->with($this->equalTo($filePath), $this->equalTo($params))
-            ->will($this->returnValue($this->absoluteFilePath));
+        $lessFile = $this->getMock('Magento\Less\PreProcessor\File\Less', [], [], '', false);
+        $lessFile->expects($this->any())->method('getFilePath')->will($this->returnValue($filePath));
+        $lessFile->expects($this->any())->method('getSourcePath')->will($this->returnValue($this->absoluteFilePath));
+        $lessFile->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($this->rootDirectory));
 
-        $this->objectManagerHelper = new ObjectManagerHelper($this);
         /** @var \Magento\Css\PreProcessor\Cache\Import\ImportEntity importEntity */
         $this->importEntity = $this->objectManagerHelper->getObject(
-            'Magento\Css\PreProcessor\Cache\Import\ImportEntity',
-            [
-                'filesystem' => $this->filesystemMock,
-                'viewFileSystem' => $this->fileSystemMock,
-                'filePath' => $filePath,
-                'params' => $params
-            ]
+            'Magento\Css\PreProcessor\Cache\Import\ImportEntity', ['lessFile' => $lessFile]
         );
-        $rootDirectoryProperty = new \ReflectionProperty($this->importEntity, 'rootDirectory');
-        $rootDirectoryProperty->setAccessible(true);
-        $this->assertEquals($this->rootDirectory, $rootDirectoryProperty->getValue($this->importEntity));
     }
 
     public function testGetOriginalFile()
@@ -114,39 +103,4 @@ class ImportEntityTest extends \PHPUnit_Framework_TestCase
         $this->createMock($relativePath, $mtime);
         $this->assertEquals($mtime, $this->importEntity->getOriginalMtime());
     }
-
-    /**
-     * @param bool $isFile
-     * @dataProvider isValidDataProvider
-     */
-    public function testIsValid($isFile)
-    {
-        $mtime = rand();
-        $relativePath = '/some/relative/path/to/file3.less';
-        $this->createMock($relativePath, $mtime);
-        $this->rootDirectory->expects($this->once())
-            ->method('isFile')
-            ->with($this->equalTo($relativePath))
-            ->will($this->returnValue($isFile));
-        $this->assertEquals($isFile, $this->importEntity->isValid());
-    }
-
-    /**
-     * @return array
-     */
-    public function isValidDataProvider()
-    {
-        return [
-            [true],
-            [false]
-        ];
-    }
-
-    public function test__sleep()
-    {
-        $mtime = rand();
-        $relativePath = '/some/relative/path/to/file3.less';
-        $this->createMock($relativePath, $mtime);
-        $this->assertEquals(['originalFile', 'originalMtime'], $this->importEntity->__sleep());
-    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Import/Map/StorageTest.php b/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Import/Map/StorageTest.php
index 32fb8f7d3fd..4c251856f2b 100644
--- a/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Import/Map/StorageTest.php
+++ b/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Import/Map/StorageTest.php
@@ -149,4 +149,14 @@ class StorageTest extends \PHPUnit_Framework_TestCase
             ['some-key-to-delete', 'maps/less/bf8aef83aab96deb7dbd66579b389794.ser']
         ];
     }
+
+    public function testClearMaps()
+    {
+        $this->mapsDirectoryMock->expects($this->once())
+            ->method('delete')
+            ->with($this->equalTo(\Magento\Css\PreProcessor\Cache\Import\Map\Storage::MAPS_DIR))
+            ->will($this->returnSelf());
+
+        $this->assertEquals($this->storage, $this->storage->clearMaps());
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/PluginTest.php b/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Plugin/LessTest.php
similarity index 56%
rename from dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/PluginTest.php
rename to dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Plugin/LessTest.php
index 1944fed557f..a0800a31cc6 100644
--- a/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/PluginTest.php
+++ b/dev/tests/unit/testsuite/Magento/Css/PreProcessor/Cache/Plugin/LessTest.php
@@ -22,52 +22,41 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-namespace Magento\Css\PreProcessor\Cache;
+namespace Magento\Css\PreProcessor\Cache\Plugin;
 
 use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
 
-class PluginTest extends \PHPUnit_Framework_TestCase
+class LessTest extends \PHPUnit_Framework_TestCase
 {
-    /** @var \Magento\Css\PreProcessor\Cache\Plugin */
+    /**
+     * @var \Magento\Css\PreProcessor\Cache\Plugin\Less
+     */
     protected $plugin;
 
-    /** @var ObjectManagerHelper */
+    /**
+     * @var ObjectManagerHelper
+     */
     protected $objectManagerHelper;
 
-    /** @var \Magento\Css\PreProcessor\Cache\CacheManagerFactory|\PHPUnit_Framework_MockObject_MockObject */
-    protected $cacheManagerFactoryMock;
-
-    /** @var \Magento\Css\PreProcessor\Cache\CacheManager|\PHPUnit_Framework_MockObject_MockObject */
-    protected $cacheManager;
+    /**
+     * @var \Magento\Css\PreProcessor\Cache\CacheManager
+     */
+    protected $cacheManagerMock;
 
-    /** @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject */
+    /**
+     * @var \Magento\Logger
+     */
     protected $loggerMock;
 
-    /** @var \Magento\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject */
-    protected $targetDirMock;
-
     protected function setUp()
     {
-        $this->targetDirMock = $this->getMock('Magento\Filesystem\Directory\WriteInterface', [], [], '', false);
-        $this->cacheManagerFactoryMock = $this->getMock(
-            'Magento\Css\PreProcessor\Cache\CacheManagerFactory',
-            [],
-            [],
-            '',
-            false
-        );
-        $this->cacheManager = $this->getMock('Magento\Css\PreProcessor\Cache\CacheManager', [], [], '', false);
-        $this->cacheManagerFactoryMock->expects($this->any())
-            ->method('create')
-            ->with($this->anything(), $this->anything())
-            ->will($this->returnValue($this->cacheManager));
-        $this->loggerMock = $this->getMock('Magento\Logger', [], [], '', false);
-
         $this->objectManagerHelper = new ObjectManagerHelper($this);
+        $this->cacheManagerMock = $this->getMock('Magento\Css\PreProcessor\Cache\CacheManager', [], [], '', false);
+        $this->loggerMock = $this->getMock('Magento\Logger', [], [], '', false);
         $this->plugin = $this->objectManagerHelper->getObject(
-            'Magento\Css\PreProcessor\Cache\Plugin',
+            'Magento\Css\PreProcessor\Cache\Plugin\Less',
             [
-                'cacheManagerFactory' => $this->cacheManagerFactoryMock,
+                'cacheManager' => $this->cacheManagerMock,
                 'logger' => $this->loggerMock
             ]
         );
@@ -77,27 +66,28 @@ class PluginTest extends \PHPUnit_Framework_TestCase
      * @param array $arguments
      * @param \Magento\Code\Plugin\InvocationChain $invocationChain
      * @param array $cacheManagerData
-     * @param string|null $expected
      * @dataProvider aroundProcessDataProvider
      */
-    public function testAroundProcess($arguments, $invocationChain, $cacheManagerData, $expected)
+    public function testAroundProcess($arguments, $invocationChain, $cacheManagerData)
     {
         if (!empty($cacheManagerData)) {
             foreach ($cacheManagerData as $method => $info) {
                 if ($method === 'getCachedFile') {
-                    $this->cacheManager->expects($this->once())
+                    $this->cacheManagerMock->expects($this->once())
                         ->method($method)
                         ->will($this->returnValue($info['result']));
                 } else {
-                    $this->cacheManager->expects($this->once())
+                    $this->cacheManagerMock->expects($this->once())
                         ->method($method)
-                        ->with($this->equalTo($info['with']))
                         ->will($this->returnValue($info['result']));
                 }
 
             }
         }
-        $this->assertEquals($expected, $this->plugin->aroundProcess($arguments, $invocationChain));
+        $this->assertInstanceOf(
+            'Magento\View\Publisher\CssFile',
+            $this->plugin->aroundProcess($arguments, $invocationChain)
+        );
     }
 
     /**
@@ -105,34 +95,49 @@ class PluginTest extends \PHPUnit_Framework_TestCase
      */
     public function aroundProcessDataProvider()
     {
-        $argFirst = [
-            'css\style.less', // lessFilePath
-            [], // params
-            $this->targetDirMock, // target directory
-            'css\style.css' // sourceFile
-        ];
-        $expectedFirst = 'expectedFirst';
+        /**
+         * Prepare first item
+         */
+        $cssFileFirst = $this->getMock('Magento\View\Publisher\CssFile', [], [], '', false);
+        $cssFileFirst->expects($this->once())
+            ->method('getSourcePath')
+            ->will($this->returnValue(false));
+
+        $argFirst[] = $cssFileFirst;
+
+        $expectedFirst = $this->getMock('Magento\View\Publisher\CssFile', [], [], '', false);
+        $cssFileFirst->expects($this->once())
+            ->method('buildUniquePath')
+            ->will($this->returnValue('expectedFirst'));
+
         $invChainFirst = $this->getMock('Magento\Code\Plugin\InvocationChain', [], [], '', false);
         $invChainFirst->expects($this->once())
             ->method('proceed')
             ->with($this->equalTo($argFirst))
             ->will($this->returnValue($expectedFirst));
 
+        /**
+         * Prepare second item
+         */
+        $cssFileSecond = $this->getMock('Magento\View\Publisher\CssFile', [], [], '', false);
+        $cssFileSecond->expects($this->once())
+            ->method('getSourcePath')
+            ->will($this->returnValue(false));
+
+        $argSecond[] = $cssFileSecond;
         $invChainSecond = $this->getMock('Magento\Code\Plugin\InvocationChain', [], [], '', false);
-        $argSecond = [
-            'css\style.less', // lessFilePath
-            [], // params
-            $this->targetDirMock, // target directory
-            null // sourceFile
-        ];
 
-        $expectedThird = 'expectedThird';
-        $argThird = [
-            'css\style.less', // lessFilePath
-            [], // params
-            $this->targetDirMock, // target directory
-            null // sourceFile
-        ];
+        /**
+         * Prepare third item
+         */
+        $cssFileThird = $this->getMock('Magento\View\Publisher\CssFile', [], [], '', false);
+        $cssFileThird->expects($this->once())
+            ->method('getSourcePath')
+            ->will($this->returnValue(false));
+
+        $argThird[] = $cssFileThird;
+
+        $expectedThird = $this->getMock('Magento\View\Publisher\CssFile', [], [], '', false);
 
         $invChainThird = $this->getMock('Magento\Code\Plugin\InvocationChain', [], [], '', false);
         $invChainThird->expects($this->once())
@@ -150,7 +155,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase
             'cached value exists' => [
                 'arguments' => $argSecond,
                 'invocationChain' => $invChainSecond,
-                'cacheManagerData' => ['getCachedFile' => ['result' => 'cached-value']],
+                'cacheManagerData' => ['getCachedFile' => ['result' => $cssFileSecond]],
                 'expected' => 'cached-value'
             ],
             'cached value does not exist' => [
@@ -158,7 +163,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase
                 'invocationChain' => $invChainThird,
                 'cacheManagerData' => [
                     'getCachedFile' => ['result' => null],
-                    'saveCache' => ['with' => $expectedThird, 'result' => 'self']
+                    'saveCache' => ['result' => 'self']
                 ],
                 'expected' => $expectedThird
             ],
@@ -167,14 +172,14 @@ class PluginTest extends \PHPUnit_Framework_TestCase
 
     public function testAroundProcessException()
     {
-        $arguments = [
-            'css\style.less', // lessFilePath
-            [], // params
-            $this->targetDirMock, // target directory
-            null // sourceFile
-        ];
+        $cssFile = $this->getMock('Magento\View\Publisher\CssFile', [], [], '', false);
+        $cssFile->expects($this->once())
+            ->method('getSourcePath')
+            ->will($this->returnValue(false));
+
+        $arguments[] = $cssFile;
 
-        $this->cacheManager->expects($this->once())
+        $this->cacheManagerMock->expects($this->once())
             ->method('getCachedFile')
             ->will($this->returnValue(null));
 
@@ -190,22 +195,4 @@ class PluginTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnSelf());
         $this->assertNull($this->plugin->aroundProcess($arguments, $invocationChain));
     }
-
-
-    public function testBeforeProcessLessInstructions()
-    {
-        $arguments = ['some\less\filePth.less', ['some', 'kind', 'of' ,'params']];
-        list($lessFilePath, $params) = $arguments;
-
-        $method = new \ReflectionMethod('Magento\Css\PreProcessor\Cache\Plugin', 'initializeCacheManager');
-        $method->setAccessible(true);
-        $this->assertEquals($this->plugin, $method->invoke($this->plugin, $lessFilePath, $params));
-
-        $this->cacheManager->expects($this->once())
-            ->method('addEntityToCache')
-            ->with($this->equalTo($lessFilePath), $this->equalTo($params))
-            ->will($this->returnSelf());
-
-        $this->assertEquals($arguments, $this->plugin->beforeProcessLessInstructions($arguments));
-    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Css/PreProcessor/CompositeTest.php b/dev/tests/unit/testsuite/Magento/Css/PreProcessor/CompositeTest.php
index e6dfc5fa9ee..177b444beb4 100644
--- a/dev/tests/unit/testsuite/Magento/Css/PreProcessor/CompositeTest.php
+++ b/dev/tests/unit/testsuite/Magento/Css/PreProcessor/CompositeTest.php
@@ -38,7 +38,7 @@ class CompositeTest extends \PHPUnit_Framework_TestCase
     protected $preProcessorFactoryMock;
 
     /**
-     * @var array
+     * @var \PHPUnit_Framework_MockObject_MockObject[]
      */
     protected $callMap = [];
 
@@ -49,27 +49,24 @@ class CompositeTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * @param array $params
      * @param array $preProcessors
      * @param array $createMap
-     * @param string $expectedResult
      * @dataProvider processDataProvider
      */
-    public function testProcess($params, $preProcessors, $createMap, $expectedResult)
+    public function testProcess($preProcessors, $createMap)
     {
-        $targetDir = $this->getMock($params['targetDirectory'], array(), array(), '', false);
+        $publisherFile = $this->getMock('Magento\View\Publisher\CssFile', [], [], '', false);
+        $targetDir = $this->getMock('Magento\Filesystem\Directory\WriteInterface', array(), array(), '', false);
 
         foreach ($createMap as $className) {
-            $this->callMap[$className] = $this->getMock($className, array('process'), array(), '', false);
+            $this->callMap[$className] = $this->getMock($className, array(), array(), '', false);
             $this->callMap[$className]->expects($this->once())
                 ->method('process')
                 ->with(
-                    $this->equalTo($params['filePath']),
-                    $this->equalTo($params['params']),
-                    $this->equalTo($targetDir),
-                    $this->equalTo($params['sourcePath'])
+                    $this->equalTo($publisherFile),
+                    $this->equalTo($targetDir)
                 )
-                ->will($this->returnValue($expectedResult));
+                ->will($this->returnValue($publisherFile));
         }
 
         $this->preProcessorFactoryMock->expects($this->any())
@@ -84,13 +81,7 @@ class CompositeTest extends \PHPUnit_Framework_TestCase
             ]
         );
 
-        $result = $this->composite->process(
-            $params['filePath'],
-            $params['params'],
-            $targetDir,
-            $params['sourcePath']
-        );
-        $this->assertEquals($expectedResult, $result);
+        $this->assertEquals($publisherFile, $this->composite->process($publisherFile, $targetDir));
     }
 
     /**
@@ -111,62 +102,26 @@ class CompositeTest extends \PHPUnit_Framework_TestCase
     {
         return [
             'one processor - LESS' => [
-                'params' => [
-                    'filePath' => '/some/file/path_one.css',
-                    'params' => ['theme' => 'some_theme', 'area' => 'frontend'],
-                    'targetDirectory' => 'Magento\Filesystem\Directory\WriteInterface',
-                    'sourcePath' => 'result_source_path_one'
-                ],
                 'preProcessors' => [
                     'css_source_processor' => 'Magento\Css\PreProcessor\Less',
                 ],
                 'createMap' => [
                     'Magento\Css\PreProcessor\Less',
                 ],
-                'expectedResult' => 'result_source_path_one'
             ],
             'list of pre-processors' => [
-                'params' => [
-                    'filePath' => '/some/file/path.css',
-                    'params' => ['theme' => 'some_theme', 'area' => 'frontend'],
-                    'targetDirectory' => 'Magento\Filesystem\Directory\WriteInterface',
-                    'sourcePath' => 'result_source_path_two'
-                ],
-                'preProcessors' => [
-                    'css_source_processor' => 'Magento\Css\PreProcessor\Less',
-                    'css_source_processor2' => 'Magento\Css\PreProcessor\Less2',
-                ],
-                'createMap' => [
-                    'Magento\Css\PreProcessor\Less',
-                    'Magento\Css\PreProcessor\Less2',
-                ],
-                'expectedResult' => 'result_source_path_two'
-            ],
-            'no result' => [
-                'params' => [
-                    'filePath' => '/some/file/path_other.css',
-                    'params' => ['theme' => 'some_theme', 'area' => 'frontend'],
-                    'targetDirectory' => 'Magento\Filesystem\Directory\WriteInterface',
-                    'sourcePath' => null
-                ],
                 'preProcessors' => [
                     'css_source_processor' => 'Magento\Css\PreProcessor\Less',
+                    'css_url_processor' => 'Magento\Css\PreProcessor\UrlResolver',
                 ],
                 'createMap' => [
                     'Magento\Css\PreProcessor\Less',
+                    'Magento\Css\PreProcessor\UrlResolver',
                 ],
-                'expectedResult' => null
             ],
             'no processors' => [
-                'params' => [
-                    'filePath' => '/some/file/some_path.css',
-                    'params' => ['theme' => 'some_theme', 'area' => 'frontend'],
-                    'targetDirectory' => 'Magento\Filesystem\Directory\WriteInterface',
-                    'sourcePath' => null
-                ],
                 'preProcessors' => [],
                 'createMap' => [],
-                'expectedResult' => null
             ],
         ];
     }
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/CustomerTest.php
index 2434dc671d5..a296d4cff2a 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Model/CustomerTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Model/CustomerTest.php
@@ -37,9 +37,6 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Core\Model\Website|\PHPUnit_Framework_MockObject_MockObject */
     protected $_website;
 
-    /** @var \Magento\Core\Model\Sender|\PHPUnit_Framework_MockObject_MockObject */
-    protected $_senderMock;
-
     /** @var \Magento\Core\Model\StoreManager|\PHPUnit_Framework_MockObject_MockObject */
     protected $_storeManager;
 
@@ -49,21 +46,40 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Eav\Model\Attribute|\PHPUnit_Framework_MockObject_MockObject */
     protected $_attribute;
 
+    /** @var \Magento\Core\Model\Store\Config|\PHPUnit_Framework_MockObject_MockObject */
+    protected $_coreStoreConfigMock;
+
+    /** @var \Magento\Mail\Template\TransportBuilder|PHPUnit_Framework_MockObject_MockObject */
+    protected $_transportBuilderMock;
+
+    /** @var \Magento\Mail\TransportInterface|PHPUnit_Framework_MockObject_MockObject */
+    protected $_transportMock;
+
     /**
      * Set required values
      */
     protected function setUp()
     {
         $this->_website = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false);
-        $this->_senderMock = $this->getMock('Magento\Email\Model\Sender', array(), array(), '', false);
         $this->_config = $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false);
         $this->_attribute = $this->getMock('Magento\Eav\Model\Attribute', array(), array(), '', false);
         $this->_storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false);
+        $this->_storetMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false);
+        $this->_coreStoreConfigMock = $this->getMock('\Magento\Core\Model\Store\Config', array(), array(), '', false);
+        $this->_transportBuilderMock = $this->getMock(
+            '\Magento\Mail\Template\TransportBuilder',
+            array(),
+            array(),
+            '',
+            false
+        );
+        $this->_transportMock = $this->getMock('Magento\Mail\TransportInterface', array(), array(), '', false);
         $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
         $this->_model = $helper->getObject('Magento\Customer\Model\Customer', array(
-            'sender' => $this->_senderMock,
             'storeManager' => $this->_storeManager,
-            'config' =>  $this->_config
+            'config' =>  $this->_config,
+            'transportBuilder' => $this->_transportBuilderMock,
+            'coreStoreConfig' => $this->_coreStoreConfigMock
             )
         );
     }
@@ -90,19 +106,56 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
             ->method('getWebsite')
             ->with($this->equalTo(1))
             ->will($this->returnValue($this->_website));
+        $this->_storeManager
+            ->expects($this->once())
+            ->method('getStore')
+            ->with(0)
+            ->will($this->returnValue($this->_storetMock));
 
         $this->_website->expects($this->once())->method('getStoreIds')->will($this->returnValue($storeIds));
 
-        $this->_senderMock->expects($this->once())
-            ->method('send')
-            ->with(
-                $this->equalTo($email),
-                $this->equalTo($firstName . ' ' . $lastName),
-                $this->equalTo(\Magento\Customer\Model\Customer::XML_PATH_RESET_PASSWORD_TEMPLATE),
-                $this->equalTo(\Magento\Customer\Model\Customer::XML_PATH_FORGOT_EMAIL_IDENTITY),
-                $this->equalTo(array('customer' => $this->_model)),
-                $storeId
-        );
+        $this->_coreStoreConfigMock
+            ->expects($this->at(0))
+            ->method('getConfig')
+            ->with(\Magento\Customer\Model\Customer::XML_PATH_RESET_PASSWORD_TEMPLATE, $storeId)
+            ->will($this->returnValue('templateId'));
+        $this->_coreStoreConfigMock
+            ->expects($this->at(1))
+            ->method('getConfig')
+            ->with(\Magento\Customer\Model\Customer::XML_PATH_FORGOT_EMAIL_IDENTITY, $storeId)
+            ->will($this->returnValue('sender'));
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('setTemplateOptions')
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('setTemplateVars')
+            ->with(array('customer' => $this->_model, 'store' => $this->_storetMock))
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('addTo')
+            ->with($this->equalTo($email), $this->equalTo($firstName . ' ' . $lastName))
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('setFrom')
+            ->with('sender')
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('setTemplateIdentifier')
+            ->with('templateId')
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('getTransport')
+            ->will($this->returnValue($this->_transportMock));
+        $this->_transportMock
+            ->expects($this->once())
+            ->method('sendMessage');
+
         $this->_model->sendPasswordResetNotificationEmail();
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/ValidatorTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/ValidatorTest.php
index 53de16c2b20..ad8b99ad017 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/ValidatorTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/ValidatorTest.php
@@ -36,7 +36,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase
 
     public function setUp()
     {
-        $this->attrDataFactoryMock = $this->getMockBuilder('\Magento\Customer\Model\Metadata\ElementFactory')
+        $this->attrDataFactoryMock = $this->getMockBuilder('Magento\Customer\Model\Metadata\ElementFactory')
             ->disableOriginalConstructor()
             ->getMock();
 
@@ -76,7 +76,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase
         $this->validator->setAttributes([$attribute]);
         $this->validator->setEntityType('ENTITY_TYPE');
         $this->validator->setData(['something']);
-        $this->assertTrue($this->validator->isValid('entity'));
+        $this->assertTrue($this->validator->isValid(['entity']));
         $this->validator->setData([]);
         $this->assertTrue($this->validator->isValid(new \Magento\Object([])));
     }
@@ -92,7 +92,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase
         $this->validator->setAttributes([$attribute]);
         $this->validator->setEntityType('ENTITY_TYPE');
         $this->validator->setData(['something']);
-        $this->assertEquals($isValid, $this->validator->isValid('ENTITY'));
+        $this->assertEquals($isValid, $this->validator->isValid(['ENTITY']));
         $this->validator->setData([]);
         $this->assertEquals($isValid, $this->validator->isValid(new \Magento\Object([])));
     }
@@ -138,10 +138,9 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase
             ->method('create')
             ->with(
                 $this->equalTo($attribute),
-                $this->equalTo('ENTITY_TYPE'),
-                $this->equalTo(null)
+                $this->equalTo(null),
+                $this->equalTo('ENTITY_TYPE')
             )
             ->will($this->returnValue($dataModel));
     }
 }
- 
\ No newline at end of file
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php
index 9c53c92ebcd..5c12dd178b3 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php
@@ -35,6 +35,7 @@ use Magento\Exception\StateException;
  * @SuppressWarnings(PHPMD.ExcessivePublicCount)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.TooManyFields)
  */
 class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase
 {
@@ -100,6 +101,14 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase
      */
     private $_customerAddressServiceMock;
 
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Customer\Helper\Data
+     */
+    private $_customerHelperMock;
+
+    /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\ObjectManager */
+    protected $_objectManagerMock;
+
     public function setUp()
     {
         $this->_customerFactoryMock = $this->getMockBuilder('Magento\Customer\Model\CustomerFactory')
@@ -192,8 +201,24 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase
 
         $this->_customerAddressServiceMock =
             $this->getMockBuilder('\Magento\Customer\Service\V1\CustomerAddressService')
-            ->disableOriginalConstructor()
-            ->getMock();
+                ->disableOriginalConstructor()
+                ->getMock();
+
+        $this->_customerHelperMock =
+            $this->getMockBuilder('Magento\Customer\Helper\Data')
+                ->disableOriginalConstructor()
+                ->setMethods(['isCustomerInStore'])
+                ->getMock();
+        $this->_customerHelperMock->expects($this->any())
+            ->method('isCustomerInStore')
+            ->will($this->returnValue(false));
+
+        $this->_objectManagerMock = $this->getMock('Magento\ObjectManager', [], [], '', false);
+        $this->_objectManagerMock
+            ->expects($this->any())
+            ->method('create')
+            ->with('Magento\Customer\Helper\Data')
+            ->will($this->returnValue($this->_customerHelperMock));
     }
 
 
@@ -987,7 +1012,8 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase
             $this->_validator,
             new Dto\Response\CreateCustomerAccountResponseBuilder(),
             $this->_customerServiceMock,
-            $this->_customerAddressServiceMock
+            $this->_customerAddressServiceMock,
+            $this->_objectManagerMock
         );
         return $customerService;
     }
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php
index 1eae647d0a2..9a8c92ae3e5 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php
@@ -272,10 +272,10 @@ class CustomerAddressServiceTest extends \PHPUnit_Framework_TestCase
             'default_billing' => false,
             'customer_id' => self::ID,
             'region' => [
-                    'region_id' => self::REGION_ID,
-                    'region_code' => '',
-                    'region' => self::REGION
-                ],
+                'region_id' => self::REGION_ID,
+                'region_code' => '',
+                'region' => self::REGION
+            ],
             'country_id' => self::COUNTRY_ID,
             'street' => [self::STREET],
             'telephone' => self::TELEPHONE,
@@ -738,8 +738,11 @@ class CustomerAddressServiceTest extends \PHPUnit_Framework_TestCase
         $customerService = new CustomerAddressService(
             $this->_addressFactoryMock,
             $this->_converter,
-            new Dto\RegionBuilder(),
-            $this->_addressBuilder,
+            new \Magento\Customer\Model\Address\Converter(
+                $this->_addressBuilder,
+                $this->_addressFactoryMock,
+                new Dto\RegionBuilder()
+            ),
             $this->_directoryData
         );
         return $customerService;
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php
index c210119b326..9c1dafb5955 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php
@@ -132,9 +132,10 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
             ->method('getAllOptions')
             ->will($this->returnValue($allOptions));
 
-        $attributeColMock = $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
-            ->disableOriginalConstructor()
-            ->getMock();
+        $attributeColFactoryMock =
+            $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
+                ->disableOriginalConstructor()
+                ->getMock();
         $storeManagerMock = $this->getMockBuilder('\Magento\Core\Model\StoreManager')
             ->disableOriginalConstructor()
             ->getMock();
@@ -143,7 +144,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
 
         $attributeMetadataBuilder = new \Magento\Customer\Service\V1\Dto\Eav\AttributeMetadataBuilder();
 
-        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColMock, $storeManagerMock,
+        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColFactoryMock, $storeManagerMock,
             $optionBuilder, $attributeMetadataBuilder);
 
         $attributeMetadata = $service->getAttributeMetadata('entityCode', 'attributeId');
@@ -163,9 +164,10 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
             ->method('getAttribute')
             ->will($this->returnValue(false));
 
-        $attributeColMock = $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
-            ->disableOriginalConstructor()
-            ->getMock();
+        $attributeColFactoryMock =
+            $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
+                ->disableOriginalConstructor()
+                ->getMock();
         $storeManagerMock = $this->getMockBuilder('\Magento\Core\Model\StoreManager')
             ->disableOriginalConstructor()
             ->getMock();
@@ -174,7 +176,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
 
         $attributeMetadataBuilder = new \Magento\Customer\Service\V1\Dto\Eav\AttributeMetadataBuilder();
 
-        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColMock, $storeManagerMock,
+        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColFactoryMock, $storeManagerMock,
             $optionBuilder, $attributeMetadataBuilder);
 
         try {
@@ -206,9 +208,10 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
             ->method('getAllOptions')
             ->will($this->returnValue(array()));
 
-        $attributeColMock = $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
-            ->disableOriginalConstructor()
-            ->getMock();
+        $attributeColFactoryMock =
+            $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
+                ->disableOriginalConstructor()
+                ->getMock();
         $storeManagerMock = $this->getMockBuilder('\Magento\Core\Model\StoreManager')
             ->disableOriginalConstructor()
             ->getMock();
@@ -217,7 +220,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
 
         $optionBuilder = new \Magento\Customer\Service\V1\Dto\Eav\OptionBuilder();
 
-        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColMock, $storeManagerMock,
+        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColFactoryMock, $storeManagerMock,
             $optionBuilder, $attributeMetadataBuilder);
 
         $attributeMetadata = $service->getAttributeMetadata('entityCode', 'attributeId');
@@ -237,9 +240,10 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
             ->method('usesSource')
             ->will($this->returnValue(false));
 
-        $attributeColMock = $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
-            ->disableOriginalConstructor()
-            ->getMock();
+        $attributeColFactoryMock =
+            $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
+                ->disableOriginalConstructor()
+                ->getMock();
         $storeManagerMock = $this->getMockBuilder('\Magento\Core\Model\StoreManager')
             ->disableOriginalConstructor()
             ->getMock();
@@ -248,7 +252,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
 
         $attributeMetadataBuilder = new \Magento\Customer\Service\V1\Dto\Eav\AttributeMetadataBuilder();
 
-        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColMock, $storeManagerMock,
+        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColFactoryMock, $storeManagerMock,
             $optionBuilder, $attributeMetadataBuilder);
 
         $attributeMetadata = $service->getAttributeMetadata('entityCode', 'attributeId');
@@ -264,9 +268,10 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
             ->method('getAttribute')
             ->will($this->returnValue(false));
 
-        $attributeColMock = $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
-            ->disableOriginalConstructor()
-            ->getMock();
+        $attributeColFactoryMock =
+            $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
+                ->disableOriginalConstructor()
+                ->getMock();
         $storeManagerMock = $this->getMockBuilder('\Magento\Core\Model\StoreManager')
             ->disableOriginalConstructor()
             ->getMock();
@@ -275,7 +280,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
 
         $attributeMetadataBuilder = new \Magento\Customer\Service\V1\Dto\Eav\AttributeMetadataBuilder();
 
-        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColMock, $storeManagerMock,
+        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColFactoryMock, $storeManagerMock,
             $optionBuilder, $attributeMetadataBuilder);
 
         try {
@@ -299,9 +304,10 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
             ->method('getAttribute')
             ->will($this->returnValue(false));
 
-        $attributeColMock = $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
-            ->disableOriginalConstructor()
-            ->getMock();
+        $attributeColFactoryMock =
+            $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
+                ->disableOriginalConstructor()
+                ->getMock();
         $storeManagerMock = $this->getMockBuilder('\Magento\Core\Model\StoreManager')
             ->disableOriginalConstructor()
             ->getMock();
@@ -310,7 +316,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
 
         $attributeMetadataBuilder = new \Magento\Customer\Service\V1\Dto\Eav\AttributeMetadataBuilder();
 
-        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColMock, $storeManagerMock,
+        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColFactoryMock, $storeManagerMock,
             $optionBuilder, $attributeMetadataBuilder);
 
         try {
@@ -338,9 +344,10 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
             ->method('getEntityAttributeCodes')
             ->will($this->returnValue(['bogus']));
 
-        $attributeColMock = $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
-            ->disableOriginalConstructor()
-            ->getMock();
+        $attributeColFactoryMock =
+            $this->getMockBuilder('\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory')
+                ->disableOriginalConstructor()
+                ->getMock();
 
         $storeManagerMock = $this->getMockBuilder('\Magento\Core\Model\StoreManager')
             ->disableOriginalConstructor()
@@ -350,7 +357,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase
 
         $attributeMetadataBuilder = new \Magento\Customer\Service\V1\Dto\Eav\AttributeMetadataBuilder();
 
-        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColMock, $storeManagerMock,
+        $service = new CustomerMetadataService($this->_eavConfigMock, $attributeColFactoryMock, $storeManagerMock,
             $optionBuilder, $attributeMetadataBuilder);
 
         $this->assertEquals([], $service->getAllAttributeSetMetadata('entityType', 0, 1));
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerServiceTest.php
index 6c659d4ca5f..411f629f3da 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerServiceTest.php
@@ -203,7 +203,7 @@ class CustomerServiceTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(self::EMAIL, $actualCustomer->getEmail());
         $this->assertEquals(4, count($actualCustomer->getAttributes()));
         $attribute = $actualCustomer->getAttribute(self::ATTRIBUTE_CODE);
-        $this->assertEquals(self::ATTRIBUTE_VALUE, $attribute);
+        $this->assertNull($attribute, 'Arbitrary attributes must not be available do DTO users.');
     }
 
     public function testGetCustomerCached()
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Dto/AddressTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Dto/AddressTest.php
index adf6fbd151f..ac901a21726 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Dto/AddressTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Dto/AddressTest.php
@@ -29,7 +29,26 @@ use Magento\Customer\Service\V1\Dto\AddressBuilder;
 
 class AddressTest extends \PHPUnit_Framework_TestCase
 {
-    private $_expectedValues = [
+    /** Sample values for testing */
+    const ID = 14;
+    const IS_SHIPPING = true;
+    const IS_BILLING = false;
+    const COMPANY = 'Company Name';
+    const FAX = '(555) 555-5555';
+    const MIDDLENAME = 'Mid';
+    const PREFIX = 'Mr.';
+    const SUFFIX = 'Esq.';
+    const VAT_ID = 'S45';
+    const FIRSTNAME = 'Jane';
+    const LASTNAME = 'Doe';
+    const STREET_LINE_0 = '7700 W Parmer Ln';
+    const CITY = 'Austin';
+    const COUNTRY_CODE = 'US';
+    const POSTCODE = '78620';
+    const TELEPHONE = '5125125125';
+    const REGION = 'Texas';
+
+    protected $_expectedValues = [
         'id' => 14,
         'default_shipping' => true,
         'default_billing' => false,
@@ -82,7 +101,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
             'getStreet' => $this->_expectedValues['street'],
             'getCity' => $this->_expectedValues['city'],
             'getCountryId' => $this->_expectedValues['country_id'],
-            'getRegion' => new \Magento\Customer\Service\V1\Dto\Region(['region' => 'Texas', 'region_code' => '']),
+            'getRegion' => new Region(['region' => 'Texas', 'region_id' => 0]),
             'getPostcode' => $this->_expectedValues['postcode'],
             'getTelephone' => $this->_expectedValues['telephone'],
         ));
@@ -125,9 +144,6 @@ class AddressTest extends \PHPUnit_Framework_TestCase
     {
         $this->_fillAllFields($this->_addressBuilder);
         $expected = $this->_expectedValues;
-        unset($expected['id']);
-        unset($expected['default_billing']);
-        unset($expected['default_shipping']);
         $this->assertEquals($expected, $this->_addressBuilder->create()->getAttributes());
     }
 
@@ -155,8 +171,10 @@ class AddressTest extends \PHPUnit_Framework_TestCase
         $addressBuilder->setCity($this->_expectedValues['city']);
         $addressBuilder->setCountryId($this->_expectedValues['country_id']);
         $addressBuilder->setRegion(
-            new \Magento\Customer\Service\V1\Dto\Region(['region' => $this->_expectedValues['region']['region'],
-                'region_code' => ''])
+            new Region([
+                'region' => $this->_expectedValues['region']['region'],
+                'region_id' => $this->_expectedValues['region']['region_id']
+            ])
         );
         $addressBuilder->setPostcode($this->_expectedValues['postcode']);
         $addressBuilder->setTelephone($this->_expectedValues['telephone']);
@@ -191,8 +209,10 @@ class AddressTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals($this->_expectedValues['city'], $address->getCity());
         $this->assertEquals($this->_expectedValues['country_id'], $address->getCountryId());
         $this->assertEquals(
-            new \Magento\Customer\Service\V1\Dto\Region(['region' => $this->_expectedValues['region']['region'],
-                'region_code' => '']),
+            new Region([
+                'region' => $this->_expectedValues['region']['region'],
+                'region_id' => $this->_expectedValues['region']['region_id']
+            ]),
             $address->getRegion()
         );
         $this->assertEquals($this->_expectedValues['postcode'], $address->getPostcode());
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Dto/CustomerBuilderTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Dto/CustomerBuilderTest.php
new file mode 100644
index 00000000000..7092193a2cf
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Dto/CustomerBuilderTest.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Customer\Service\V1\Dto;
+
+class CustomerBuilderTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\Customer\Service\V1\Dto\CustomerBuilder */
+    protected $_customerBuilder;
+
+    protected function setUp()
+    {
+        $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->_customerBuilder = $objectManager->getObject('Magento\Customer\Service\V1\Dto\CustomerBuilder');
+        parent::setUp();
+    }
+
+    public function testMergeDtos()
+    {
+        $firstname1 = 'Firstname1';
+        $lastnam1 = 'Lastname1';
+        $email1 = 'email1@example.com';
+        $firstDto = $this->_customerBuilder
+            ->setFirstname($firstname1)
+            ->setLastname($lastnam1)
+            ->setEmail($email1)
+            ->create();
+
+        $lastname2 = 'Lastname2';
+        $middlename2 = 'Middlename2';
+        $secondDto = $this->_customerBuilder
+            ->setLastname($lastname2)
+            ->setMiddlename($middlename2)
+            ->create();
+
+        $mergedDto = $this->_customerBuilder->mergeDtos($firstDto, $secondDto);
+        $this->assertNotSame($firstDto, $mergedDto, 'A new object must be created for merged DTO.');
+        $this->assertNotSame($secondDto, $mergedDto, 'A new object must be created for merged DTO.');
+        $expectedDtoData = [
+            'firstname' => $firstname1,
+            'lastname' => $lastname2,
+            'middlename' => $middlename2,
+            'email' => $email1
+        ];
+        $this->assertEquals($expectedDtoData, $mergedDto->__toArray(), 'DTOs were merged incorrectly.');
+    }
+
+    public function testMergeDtoWitArray()
+    {
+        $firstname1 = 'Firstname1';
+        $lastnam1 = 'Lastname1';
+        $email1 = 'email1@example.com';
+        $firstDto = $this->_customerBuilder
+            ->setFirstname($firstname1)
+            ->setLastname($lastnam1)
+            ->setEmail($email1)
+            ->create();
+
+        $lastname2 = 'Lastname2';
+        $middlename2 = 'Middlename2';
+        $dataForMerge = ['lastname' => $lastname2, 'middlename' => $middlename2];
+
+        $mergedDto = $this->_customerBuilder->mergeDtoWithArray($firstDto, $dataForMerge);
+        $this->assertNotSame($firstDto, $mergedDto, 'A new object must be created for merged DTO.');
+        $expectedDtoData = [
+            'firstname' => $firstname1,
+            'lastname' => $lastname2,
+            'middlename' => $middlename2,
+            'email' => $email1
+        ];
+        $this->assertEquals($expectedDtoData, $mergedDto->__toArray(), 'DTO with array were merged incorrectly.');
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Dto/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Dto/CustomerTest.php
index 26a497f2c99..52df33553ef 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Dto/CustomerTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Dto/CustomerTest.php
@@ -79,7 +79,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(self::TAXVAT, $customer->getTaxvat());
         $this->assertEquals(self::WEBSITE_ID, $customer->getWebsiteId());
         $attribute = $customer->getAttribute(self::ATTRIBUTE_CODE);
-        $this->assertEquals(self::ATTRIBUTE_VALUE, $attribute);
+        $this->assertNull($attribute, "Arbitrary attributes must not be available to DTO users.");
     }
 
     public function testGetAttributeNotExist()
@@ -104,6 +104,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
         $actualAttributes = $customer->getAttributes();
         $this->assertEquals(
             [
+                'id' => self::ID,
                 'confirmation' => self::CONFIRMATION,
                 'created_at' => self::CREATED_AT,
                 'created_in' => self::STORE_NAME,
@@ -118,8 +119,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
                 'store_id' => self::STORE_ID,
                 'suffix' => self::SUFFIX,
                 'taxvat' => self::TAXVAT,
-                'website_id' => self::WEBSITE_ID,
-                self::ATTRIBUTE_CODE => self::ATTRIBUTE_VALUE,
+                'website_id' => self::WEBSITE_ID
             ],
             $actualAttributes
         );
@@ -159,7 +159,6 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(self::LASTNAME, $customer->getLastname());
         $this->assertEquals(self::EMAIL, $customer->getEmail());
         $this->assertEquals(self::ID, $customer->getCustomerId());
-        $this->assertEquals(self::ID, $customer->getAttribute('entity_id'));
     }
 
     /**
diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Varien/Router/StandardTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Varien/Router/StandardTest.php
index fdaa041697e..11d2f4b2d72 100644
--- a/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Varien/Router/StandardTest.php
+++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Varien/Router/StandardTest.php
@@ -226,22 +226,14 @@ class StandardTest extends \PHPUnit_Framework_TestCase
                 ->method('getRouters')
                 ->will($this->returnValue($routers));
         }
-
-        $router = new \Magento\DesignEditor\Controller\Varien\Router\Standard(
-            $this->getMock('Magento\App\ActionFactory', array(), array(), '', false),
-            $this->getMock('Magento\App\DefaultPathInterface'),
-            $this->getMock('Magento\App\ResponseFactory', array(), array(), '', false),
-            $this->getMock('Magento\App\Route\Config', array(), array(), '', false),
-            $this->getMock('Magento\App\State', array(), array(), '', false),
-            $this->getMock('Magento\UrlInterface'),
-            $this->getMock('Magento\Core\Model\StoreManagerInterface'),
-            $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false),
-            $this->getMock('Magento\Url\SecurityInfoInterface'),
-            'frontend',
-            $routerListMock,
-            $objectManager,
-            $rewriteServiceMock
+        $arguments = array(
+            'routerId' => 'frontend',
+            'routerList' => $routerListMock,
+            'objectManager' => $objectManager,
+            'urlRewriteService' => $rewriteServiceMock
         );
+        $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $router = $helper->getObject('\Magento\DesignEditor\Controller\Varien\Router\Standard', $arguments);
         return $router;
     }
 
diff --git a/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php
index ab701df478f..3736d132af7 100644
--- a/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php
+++ b/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php
@@ -58,7 +58,6 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnArgument(0));
 
         $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false);
-        $stringHelper = $this->getMock('Magento\Core\Helper\String', array(), array(), '', false);
         $localeMock = $this->getMock('Magento\Core\Model\LocaleInterface');
         $localeMock->expects($this->any())->method('getCountryTranslation')->will($this->returnArgument(0));
 
@@ -72,7 +71,6 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
         $arguments = array(
             'logger' => $logger,
             'eventManager' => $eventManager,
-            'stringHelper' => $stringHelper,
             'locale' => $localeMock,
             'fetchStrategy' => $fetchStrategy,
             'entityFactory' => $entityFactory,
diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/TypeTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/TypeTest.php
index f461449d92f..432cb26ebcd 100644
--- a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/TypeTest.php
+++ b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/TypeTest.php
@@ -44,7 +44,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase
         $fileStorageDb = $this->getMockBuilder('Magento\Core\Helper\File\Storage\Database')
             ->disableOriginalConstructor()->getMock();
         $filesystem = $this->getMockBuilder('Magento\App\Filesystem')->disableOriginalConstructor()->getMock();
-        $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $coreRegistry = $this->getMock('Magento\Registry', array(), array(), '', false);
         $logger = $this->getMock('Magento\Logger', array(), array(), '', false);
         $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false);
         $sampleResFactory = $this->getMock(
diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Sales/Order/Pdf/Items/CreditmemoTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Sales/Order/Pdf/Items/CreditmemoTest.php
index 83cc325bb74..e09823b5f1f 100644
--- a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Sales/Order/Pdf/Items/CreditmemoTest.php
+++ b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Sales/Order/Pdf/Items/CreditmemoTest.php
@@ -51,12 +51,6 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase
             'productFactory' => $this->getMock(
                 'Magento\Catalog\Model\ProductFactory', array(), array(), '', false
             ),
-            'templateMailerFactory' => $this->getMock(
-                'Magento\Email\Model\Template\MailerFactory', array(), array(), '', false
-            ),
-            'emailInfoFactory' => $this->getMock(
-                'Magento\Email\Model\InfoFactory', array(), array(), '', false
-            ),
             'orderItemCollectionFactory' => $this->getMock(
                 'Magento\Sales\Model\Resource\Order\Item\CollectionFactory', array(), array(), '', false
             ),
diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Collection/AbstractCollectionStub.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Collection/AbstractCollectionStub.php
new file mode 100644
index 00000000000..2e8fb4f87a5
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Collection/AbstractCollectionStub.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Eav\Model\Entity\Collection;
+
+class AbstractCollectionStub extends \Magento\Eav\Model\Entity\Collection\AbstractCollection
+{
+    /**
+     * Retrieve item by id
+     *
+     * @param   mixed $id
+     * @return  \Magento\Object
+     */
+    public function getItemById($id)
+    {
+        if (isset($this->_itemsById[$id])) {
+            return $this->_itemsById[$id];
+        }
+        return null;
+    }
+
+    /**
+     * Initialize collection
+     *
+     * @return void
+     */
+    protected function _construct()
+    {
+        return $this->_init('Magento\Object', 'test_entity_model');
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Collection/AbstractCollectionTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Collection/AbstractCollectionTest.php
new file mode 100644
index 00000000000..c321576fefe
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Collection/AbstractCollectionTest.php
@@ -0,0 +1,218 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Eav\Model\Entity\Collection;
+
+class AbstractCollectionTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Eav\Model\Entity\Collection\AbstractCollectionStub|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $model;
+
+    /**
+     * @var \Magento\Core\Model\EntityFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $coreEntityFactoryMock;
+    /**
+     * @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $loggerMock;
+
+    /**
+     * @var \Magento\Data\Collection\Db\FetchStrategyInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $fetchStrategyMock;
+
+    /**
+     * @var \Magento\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $eventManagerMock;
+
+    /**
+     * @var \Magento\Eav\Model\Config|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $configMock;
+
+    /**
+     * @var \Magento\App\Resource|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $coreResourceMock;
+
+    /**
+     * @var \Magento\Eav\Model\EntityFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $entityFactoryMock;
+
+    /**
+     * @var \Magento\Eav\Model\Resource\Helper|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $resourceHelperMock;
+
+    /**
+     * @var \Magento\Validator\UniversalFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $validatorFactoryMock;
+
+    public function setUp()
+    {
+        $this->coreEntityFactoryMock = $this->getMock(
+            'Magento\Core\Model\EntityFactory', array(), array(), '', false
+        );
+        $this->loggerMock = $this->getMock(
+            'Magento\Logger', array(), array(), '', false
+        );
+        $this->fetchStrategyMock = $this->getMock(
+            'Magento\Data\Collection\Db\FetchStrategyInterface', array(), array(), '', false
+        );
+        $this->eventManagerMock = $this->getMock(
+            'Magento\Event\ManagerInterface', array(), array(), '', false
+        );
+        $this->configMock = $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false);
+        $this->coreResourceMock = $this->getMock(
+            'Magento\App\Resource', array('getConnection'), array(), '', false
+        );
+        $this->resourceHelperMock = $this->getMock(
+            'Magento\Eav\Model\Resource\Helper', array(), array(), '', false
+        );
+        $this->validatorFactoryMock = $this->getMock(
+            'Magento\Validator\UniversalFactory', array(), array(), '', false
+        );
+        $this->entityFactoryMock = $this->getMock(
+            'Magento\Eav\Model\EntityFactory', array(), array(), '', false
+        );
+        /** @var \Magento\DB\Adapter\Pdo\Mysql|\PHPUnit_Framework_MockObject_MockObject */
+        $connectionMock = $this->getMock(
+            'Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false
+        );
+        /** @var $selectMock \Zend_Db_Select|\PHPUnit_Framework_MockObject_MockObject */
+        $selectMock = $this->getMock(
+            'Zend_Db_Select', array(), array(), '', false
+        );
+        $this->coreEntityFactoryMock->expects($this->any())
+            ->method('create')
+            ->will($this->returnCallback(array($this, 'getMagentoObject')));
+        $connectionMock->expects($this->any())
+            ->method('select')
+            ->will($this->returnValue($selectMock));
+
+        $this->coreResourceMock->expects($this->any())
+            ->method('getConnection')
+            ->will($this->returnValue($connectionMock));
+        $entityMock = $this->getMock(
+            'Magento\Eav\Model\Entity\AbstractEntity', array(), array(), '', false
+        );
+        $entityMock->expects($this->once())
+            ->method('getReadConnection')
+            ->will($this->returnValue($connectionMock));
+        $entityMock->expects($this->once())
+            ->method('getDefaultAttributes')
+            ->will($this->returnValue(array()));
+
+        $this->validatorFactoryMock->expects($this->once())
+            ->method('create')
+            ->with('test_entity_model')// see \Magento\Eav\Model\Entity\Collection\AbstractCollectionStub
+            ->will($this->returnValue($entityMock));
+
+        $this->model = new \Magento\Eav\Model\Entity\Collection\AbstractCollectionStub(
+            $this->coreEntityFactoryMock,
+            $this->loggerMock,
+            $this->fetchStrategyMock,
+            $this->eventManagerMock,
+            $this->configMock,
+            $this->coreResourceMock,
+            $this->entityFactoryMock,
+            $this->resourceHelperMock,
+            $this->validatorFactoryMock,
+            null
+        );
+    }
+
+    public function tearDown()
+    {
+        $this->model = null;
+    }
+
+    /**
+     * @dataProvider getItemsDataProvider
+     */
+    public function testClear($values, $count)
+    {
+        $this->fetchStrategyMock->expects($this->once())
+            ->method('fetchAll')
+            ->will($this->returnValue($values));
+
+        $testId = array_pop($values)['id'];
+        $this->assertCount($count, $this->model->getItems());
+        $this->assertNotNull($this->model->getItemById($testId));
+        $this->model->clear();
+        $this->assertNull($this->model->getItemById($testId));
+    }
+
+    /**
+     * @dataProvider getItemsDataProvider
+     */
+    public function testRemoveAllItems($values, $count)
+    {
+        $this->fetchStrategyMock->expects($this->once())
+            ->method('fetchAll')
+            ->will($this->returnValue($values));
+
+        $testId = array_pop($values)['id'];
+        $this->assertCount($count, $this->model->getItems());
+        $this->assertNotNull($this->model->getItemById($testId));
+        $this->model->removeAllItems();
+        $this->assertNull($this->model->getItemById($testId));
+    }
+
+    /**
+     * @dataProvider getItemsDataProvider
+     */
+    public function testRemoveItemByKey($values, $count)
+    {
+        $this->fetchStrategyMock->expects($this->once())
+            ->method('fetchAll')
+            ->will($this->returnValue($values));
+
+        $testId = array_pop($values)['id'];
+        $this->assertCount($count, $this->model->getItems());
+        $this->assertNotNull($this->model->getItemById($testId));
+        $this->model->removeItemByKey($testId);
+        $this->assertCount($count - 1, $this->model->getItems());
+        $this->assertNull($this->model->getItemById($testId));
+    }
+
+    public function getItemsDataProvider()
+    {
+        return array(
+            array('values' => array(array('id' => 1)), 'count' => 1),
+            array('values' => array(array('id' => 1), array('id' => 2)), 'count' => 2),
+            array('values' => array(array('id' => 2), array('id' => 3)), 'count' => 2),
+        );
+    }
+
+    public function getMagentoObject()
+    {
+        return new \Magento\Object();
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php
new file mode 100644
index 00000000000..75ff5217cce
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php
@@ -0,0 +1,162 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Eav\Model\Resource\Entity\Attribute\Option;
+
+class CollectionTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Eav\Model\Resource\Entity\Attribute\Option\Collection|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $model;
+
+    /**
+     * @var \Magento\Core\Model\EntityFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $entityFactoryMock;
+
+    /**
+     * @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $loggerMock;
+
+    /**
+     * @var \Magento\Data\Collection\Db\FetchStrategyInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $fetchStrategyMock;
+
+    /**
+     * @var \Magento\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $eventManagerMock;
+
+    /**
+     * @var \Magento\App\Resource|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $coreResourceMock;
+
+    /**
+     * @var \Magento\Core\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $storeManagerMock;
+
+    /**
+     * @var \Magento\DB\Adapter\Pdo\Mysql|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $connectionMock;
+
+    /**
+     * @var \Magento\Core\Model\Resource\Db\AbstractDb|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $resourceMock;
+
+    /**
+     * @var \Zend_Db_Select|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $selectMock;
+
+    protected function setUp()
+    {
+        $this->entityFactoryMock = $this->getMock(
+            'Magento\Core\Model\EntityFactory', array(), array(), '', false
+        );
+        $this->loggerMock = $this->getMock(
+            'Magento\Logger', array(), array(), '', false
+        );
+        $this->fetchStrategyMock = $this->getMock(
+            'Magento\Data\Collection\Db\FetchStrategyInterface', array(), array(), '', false
+        );
+        $this->eventManagerMock = $this->getMock(
+            'Magento\Event\ManagerInterface', array(), array(), '', false
+        );
+        $this->coreResourceMock = $this->getMock(
+            'Magento\App\Resource', array('getConnection', 'getTableName'), array(), '', false
+        );
+        $this->storeManagerMock = $this->getMock(
+            'Magento\Core\Model\StoreManagerInterface', array(), array(), '', false
+        );
+        $this->connectionMock = $this->getMock(
+            'Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false
+        );
+        $this->resourceMock = $this->getMockForAbstractClass(
+            'Magento\Core\Model\Resource\Db\AbstractDb', array(), '', false, true, true,
+            array('__wakeup', 'getReadConnection', 'getMainTable', 'getTable')
+        );
+        $this->selectMock = $this->getMock(
+            'Zend_Db_Select', array(), array(), '', false
+        );
+
+        $this->coreResourceMock->expects($this->any())
+            ->method('getConnection')
+            ->will($this->returnValue($this->connectionMock));
+        $this->coreResourceMock->expects($this->any())
+            ->method('getTableName')
+            ->with('eav_attribute_option_value')
+            ->will($this->returnValue(null));
+
+        $this->connectionMock->expects($this->any())
+            ->method('select')
+            ->will($this->returnValue($this->selectMock));
+        $this->connectionMock->expects($this->any())
+            ->method('quoteIdentifier')
+            ->will($this->returnArgument(0));
+
+        $this->resourceMock->expects($this->any())
+            ->method('getReadConnection')
+            ->will($this->returnValue($this->connectionMock));
+        $this->resourceMock->expects($this->any())
+            ->method('getMainTable')
+            ->will($this->returnValue('eav_attribute_option'));
+        $this->resourceMock->expects($this->any())
+            ->method('getTable')
+            ->with('eav_attribute_option')
+            ->will($this->returnValue('eav_attribute_option'));
+
+        $this->model = new \Magento\Eav\Model\Resource\Entity\Attribute\Option\Collection(
+            $this->entityFactoryMock,
+            $this->loggerMock,
+            $this->fetchStrategyMock,
+            $this->eventManagerMock,
+            $this->coreResourceMock,
+            $this->storeManagerMock,
+            null,
+            $this->resourceMock
+        );
+    }
+
+    public function testSetIdFilter()
+    {
+        $this->connectionMock->expects($this->once())
+            ->method('prepareSqlCondition')
+            ->with('main_table.option_id', ['in' => 1])
+            ->will($this->returnValue('main_table.option_id IN (1)'));
+
+        $this->selectMock->expects($this->once())
+            ->method('where')
+            ->with('main_table.option_id IN (1)', null, 'TYPE_CONDITION')
+            ->will($this->returnSelf());
+
+        $this->assertEquals($this->model, $this->model->setIdFilter(1));
+
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Email/Block/Adminhtml/Template/EditTest.php b/dev/tests/unit/testsuite/Magento/Email/Block/Adminhtml/Template/EditTest.php
index ced72f5ce98..b1fee388a59 100644
--- a/dev/tests/unit/testsuite/Magento/Email/Block/Adminhtml/Template/EditTest.php
+++ b/dev/tests/unit/testsuite/Magento/Email/Block/Adminhtml/Template/EditTest.php
@@ -35,7 +35,7 @@ class EditTest extends \PHPUnit_Framework_TestCase
     protected $_block;
 
     /**
-     * @var \Magento\Core\Model\Registry|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Registry|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $_registryMock;
 
@@ -83,7 +83,7 @@ class EditTest extends \PHPUnit_Framework_TestCase
     protected function setUp()
     {
         $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
-        $this->_registryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false, false);
+        $this->_registryMock = $this->getMock('Magento\Registry', array(), array(), '', false, false);
         $layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false, false);
         $helperMock = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false, false);
         $menuConfigMock = $this->getMock('Magento\Backend\Model\Menu\Config', array(), array(), '', false, false);
diff --git a/dev/tests/unit/testsuite/Magento/Email/Model/SenderTest.php b/dev/tests/unit/testsuite/Magento/Email/Model/SenderTest.php
deleted file mode 100644
index c707f679027..00000000000
--- a/dev/tests/unit/testsuite/Magento/Email/Model/SenderTest.php
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-/**
- * Unit test for \Magento\Email\Model\Sender
- *
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Test class for \Magento\Email\Model\Sender
- */
-namespace Magento\Email\Model;
-
-class SenderTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var \Magento\Email\Model\Sender
-     */
-    protected $_model;
-
-    /** @var \Magento\Email\Model\Template\Mailer|PHPUnit_Framework_MockObject_MockObject */
-    protected $_mailerMock;
-
-    /** @var \Magento\Core\Model\Store|PHPUnit_Framework_MockObject_MockObject */
-    protected $_storeMock;
-
-    /** @var \Magento\Core\Model\StoreManagerInterface|PHPUnit_Framework_MockObject_MockObject */
-    protected $_storeManagerMock;
-
-    /** @var \Magento\Email\Model\Info|PHPUnit_Framework_MockObject_MockObject */
-    protected $_emailInfoMock;
-
-    /**
-     * Set required values
-     */
-    protected function setUp()
-    {
-        $this->_mailerMock = $this->getMockBuilder('Magento\Email\Model\Template\Mailer')
-            ->disableOriginalConstructor()
-            ->setMethods(array('addEmailInfo', 'setSender', 'setStoreId', 'setTemplateId', 'setTemplateParams', 'send'))
-            ->getMock();
-        $this->_storeMock = $this->getMockBuilder('Magento\Core\Model\Store')
-            ->disableOriginalConstructor()
-            ->setMethods(array('load', 'getConfig', '__sleep', '__wakeup'))
-            ->getMock();
-        $this->_storeManagerMock = $this->getMockBuilder('Magento\Core\Model\StoreManagerInterface')
-            ->disableOriginalConstructor()
-            ->setMethods(array('getStore'))
-            ->getMockForAbstractClass();
-        $this->_storeManagerMock->expects($this->any())
-            ->method('getStore')
-            ->will($this->returnValue($this->_storeMock));
-        $this->_emailInfoMock = $this->getMockBuilder('Magento\Email\Model\Info')
-            ->disableOriginalConstructor()
-            ->setMethods(array('addTo'))
-            ->getMock();
-
-        $this->_model = new \Magento\Email\Model\Sender($this->_mailerMock, $this->_emailInfoMock,
-            $this->_storeManagerMock);
-    }
-
-    public function testSend()
-    {
-        $email = 'test@example.com';
-        $name = 'test';
-        $template = 'letter_template_xml_path';
-        $sender = 'sender_template_xml_path';
-        $params = array('param1');
-        $storeId = 1;
-
-        $this->_storeMock->expects($this->once())->method('load')->with($this->equalTo($storeId));
-        $this->_storeMock->setStoreId($storeId);
-
-        $this->_storeMock->expects($this->at(1))
-            ->method('getConfig')
-            ->with($this->equalTo($sender), $this->equalTo($storeId))
-            ->will($this->returnValue($sender)
-        );
-        $this->_storeMock->expects($this->at(2))
-            ->method('getConfig')
-            ->with($this->equalTo($template), $this->equalTo($storeId))
-            ->will($this->returnValue($template)
-        );
-
-        $this->_mailerMock->expects($this->once())->method('addEmailInfo')->with($this->equalTo($this->_emailInfoMock));
-        $this->_mailerMock->expects($this->once())->method('setSender')->with($this->equalTo($sender));
-        $this->_mailerMock->expects($this->once())->method('setStoreId')->with($this->equalTo($storeId));
-        $this->_mailerMock->expects($this->once())->method('setTemplateId')->with($this->equalTo($template));
-        $this->_mailerMock->expects($this->once())->method('setTemplateParams')->with($this->equalTo($params));
-        $this->_mailerMock->expects($this->once())->method('send');
-
-        $this->_emailInfoMock->expects($this->once())
-            ->method('addTo')
-            ->with($this->equalTo($email), $this->equalTo($name));
-
-        $this->_model->send($email, $name, $template, $sender, $params, $storeId);
-    }
-}
diff --git a/dev/tests/unit/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/unit/testsuite/Magento/Email/Model/TemplateTest.php
new file mode 100644
index 00000000000..66fca02a9f2
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Email/Model/TemplateTest.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Email\Model;
+
+class TemplateTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @dataProvider getTypeDataProvider
+     * @param string $templateType
+     * @param int $expectedResult
+     */
+    public function testGetType($templateType, $expectedResult)
+    {
+        $emailConfig = $this->getMockBuilder('\Magento\Email\Model\Template\Config')
+            ->setMethods(array('getTemplateType'))
+            ->disableOriginalConstructor()
+            ->getMock();
+        $emailConfig->expects($this->once())
+            ->method('getTemplateType')
+            ->will($this->returnValue($templateType));
+        /** @var \Magento\Email\Model\Template $model */
+        $model = $this->getMockBuilder('Magento\Email\Model\Template')
+            ->setMethods(array('_init'))
+            ->setConstructorArgs(array(
+                $this->getMock('Magento\Model\Context', array(), array(), '', false),
+                $this->getMock('Magento\Core\Model\View\Design', array(), array(), '', false),
+                $this->getMock('Magento\Registry', array(), array(), '', false),
+                $this->getMock('Magento\Core\Model\App\Emulation', array(), array(), '', false),
+                $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false),
+                $this->getMock('Magento\App\Filesystem', array(), array(), '', false),
+                $this->getMock('Magento\View\Url', array(), array(), '', false),
+                $this->getMock('Magento\View\FileSystem', array(), array(), '', false),
+                $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false),
+                $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false),
+                $this->getMock('Magento\Email\Model\Template\FilterFactory', array(), array(), '', false),
+                $emailConfig,
+                array('template_id' => 10),
+            ))
+            ->getMock();
+        $this->assertEquals($expectedResult, $model->getType());
+    }
+
+    public function getTypeDataProvider()
+    {
+        return array(
+            array('text', 1),
+            array('html', 2),
+        );
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/GoogleAdwords/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/GoogleAdwords/Helper/DataTest.php
index 37b350c2df0..8cf3efc8c39 100644
--- a/dev/tests/unit/testsuite/Magento/GoogleAdwords/Helper/DataTest.php
+++ b/dev/tests/unit/testsuite/Magento/GoogleAdwords/Helper/DataTest.php
@@ -56,7 +56,7 @@ class DataTest extends \PHPUnit_Framework_TestCase
         $this->_storeConfigMock = $this->getMock(
             'Magento\Core\Model\Store\ConfigInterface', array(), array(), '', false
         );
-        $this->_registryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $this->_registryMock = $this->getMock('Magento\Registry', array(), array(), '', false);
 
         $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
         $context = $this->getMock('Magento\App\Helper\Context', array(), array(), '', false);
diff --git a/dev/tests/unit/testsuite/Magento/GoogleAdwords/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/GoogleAdwords/Model/ObserverTest.php
index 83ea30b61eb..95ccbd0a619 100644
--- a/dev/tests/unit/testsuite/Magento/GoogleAdwords/Model/ObserverTest.php
+++ b/dev/tests/unit/testsuite/Magento/GoogleAdwords/Model/ObserverTest.php
@@ -58,7 +58,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase
     protected function setUp()
     {
         $this->_helperMock = $this->getMock('Magento\GoogleAdwords\Helper\Data', array(), array(), '', false);
-        $this->_registryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', true);
+        $this->_registryMock = $this->getMock('Magento\Registry', array(), array(), '', true);
         $this->_collectionMock = $this->getMock('Magento\Sales\Model\Resource\Order\Collection', array(), array(), '',
             false);
         $this->_eventObserverMock = $this->getMock('Magento\Event\Observer', array(), array(), '', false);
diff --git a/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ServiceTest.php b/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ServiceTest.php
index 7ec929447d0..d40273ac103 100644
--- a/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ServiceTest.php
@@ -56,7 +56,7 @@ class ServiceTest extends \PHPUnit_Framework_TestCase
             ->method('create')
             ->will($this->returnValue($this->_contentMock));
 
-        $coreRegistryMock = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $coreRegistryMock = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->setMethods(array('registry'))
             ->getMock();
diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php
index 174dfe2b40c..b39444600cd 100644
--- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php
+++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php
@@ -53,7 +53,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase
 
     protected function setUp()
     {
-        $this->registryMock = $this->getMock('\Magento\Core\Model\Registry', array(), array(), '', false);
+        $this->registryMock = $this->getMock('\Magento\Registry', array(), array(), '', false);
         $this->productMock = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false);
         $this->coreHelperMock = $this->getMock('\Magento\Core\Helper\Data', array(), array(), '', false);
         $this->storeManagerMock = $this->getMock(
diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php
index b721ea04d0b..b56147c8de4 100644
--- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php
+++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php
@@ -64,7 +64,7 @@ class ListAssociatedProductsTest extends \PHPUnit_Framework_TestCase
     protected function setUp()
     {
         $this->contextMock = $this->getMock('Magento\Backend\Block\Template\Context', array(), array(), '', false);
-        $this->registryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $this->registryMock = $this->getMock('Magento\Registry', array(), array(), '', false);
         $this->productMock = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false);
         $this->storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false);
         $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false);
diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Controller/Adminhtml/EditTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Controller/Adminhtml/EditTest.php
index f769660df1e..f48543b025c 100644
--- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Controller/Adminhtml/EditTest.php
+++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Controller/Adminhtml/EditTest.php
@@ -60,7 +60,7 @@ class EditTest extends \PHPUnit_Framework_TestCase
     {
         $this->request = $this->getMock('Magento\App\RequestInterface', array(), array(), '', false);
         $this->factory = $this->getMock('Magento\Catalog\Model\ProductFactory', array('create'), array(), '', false);
-        $this->registry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $this->registry = $this->getMock('Magento\Registry', array(), array(), '', false);
         $this->view = $this->getMock('Magento\App\ViewInterface', array(), array(), '', false);
 
         $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
index 54a1a7e6e8b..e70ce220a43 100644
--- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
+++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
@@ -61,7 +61,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase
         $coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false);
         $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false);
         $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false);
-        $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $coreRegistry = $this->getMock('Magento\Registry', array(), array(), '', false);
         $this->product = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false);
         $logger = $this->getMock('Magento\Logger', array(), array(), '', false);
         $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false);
diff --git a/dev/tests/unit/testsuite/Magento/Image/AdapterFactoryTest.php b/dev/tests/unit/testsuite/Magento/Image/AdapterFactoryTest.php
index 15d9f6f20cd..f65a9e6b72a 100644
--- a/dev/tests/unit/testsuite/Magento/Image/AdapterFactoryTest.php
+++ b/dev/tests/unit/testsuite/Magento/Image/AdapterFactoryTest.php
@@ -30,7 +30,7 @@ namespace Magento\Image;
 class AdapterFactoryTest extends \PHPUnit_Framework_TestCase
 {
     /**
-     * @var \Magento\Core\Model\Image\Adapter\Config|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Image\Adapter\ConfigInterface | \PHPUnit_Framework_MockObject_MockObject
      */
     protected $configMock;
 
diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php
index 0489b8127dc..8323f4109ae 100644
--- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php
+++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php
@@ -239,8 +239,6 @@ class AddressTest extends \PHPUnit_Framework_TestCase
             $this->getMock('Magento\Customer\Model\Config\Share', array(), array(), '', false),
             $this->getMock('Magento\Customer\Model\AddressFactory', array(), array(), '', false),
             $this->getMock('Magento\Customer\Model\Resource\Address\CollectionFactory', array(), array(), '', false),
-            $this->getMock('Magento\Email\Model\Template\MailerFactory', array(), array(), '', false),
-            $this->getMock('Magento\Email\Model\InfoFactory', array(), array(), '', false),
             $this->getMock('Magento\Customer\Model\GroupFactory', array(), array(), '', false),
             $this->getMock('Magento\Customer\Model\AttributeFactory', array(), array(), '', false),
         );
diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php
index 95a201da4fb..762410e3bf4 100644
--- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php
+++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php
@@ -77,7 +77,7 @@ class ExportTest extends \PHPUnit_Framework_TestCase
 
         $logger = $this->getMock('Magento\Logger', array(), array(), '', false);
         $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false);
-        $adapterFactory = $this->getMock('Magento\Core\Model\Log\AdapterFactory', array(), array(), '', false);
+        $adapterFactory = $this->getMock('Magento\Logger\AdapterFactory', array(), array(), '', false);
         $entityFactory = $this->getMock(
             'Magento\ImportExport\Model\Export\Entity\Factory', array(), array(), '', false);;
         $exportAdapterFac = $this->getMock(
diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php
index d18d9e2e2a9..317e6b07f3b 100644
--- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php
+++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php
@@ -55,7 +55,7 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase
     protected $_coreHelper;
 
     /**
-     * @var \Magento\Core\Helper\String|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $_string;
 
diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php
index da49daa955a..f5fd800297e 100644
--- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php
+++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php
@@ -246,8 +246,8 @@ class AddressTest extends \PHPUnit_Framework_TestCase
             $arguments = $this->_objectManagerMock->getConstructArguments(
                 'Magento\Eav\Model\Entity\Attribute\AbstractAttribute',
                 array(
-                    $this->getMock('Magento\Core\Model\Context', array(), array(), '', false, false),
-                    $this->getMock('Magento\Core\Model\Registry'),
+                    $this->getMock('Magento\Model\Context', array(), array(), '', false, false),
+                    $this->getMock('Magento\Registry'),
                     $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false, false),
                     $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false, false),
                     $this->getMock('Magento\Eav\Model\Entity\TypeFactory'),
@@ -296,8 +296,6 @@ class AddressTest extends \PHPUnit_Framework_TestCase
                 $this->getMock('Magento\Customer\Model\Resource\Address\CollectionFactory', array(), array(), '',
                     false
                 ),
-                $this->getMock('Magento\Email\Model\Template\MailerFactory', array(), array(), '', false),
-                $this->getMock('Magento\Email\Model\InfoFactory', array(), array(), '', false),
                 $this->getMock('Magento\Customer\Model\GroupFactory', array(), array(), '', false),
                 $this->getMock('Magento\Customer\Model\AttributeFactory', array(), array(), '', false),
             );
diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php
index 8f6569bd3d1..9f09909dd03 100644
--- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php
+++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php
@@ -50,7 +50,7 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase
     protected $_coreDataMock;
 
     /**
-     * @var \Magento\Core\Helper\String|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $_string;
 
@@ -128,18 +128,10 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase
      */
     protected function _getModelDependencies()
     {
-        $localeMock = $this->getMock('Magento\Core\Model\Locale', array(), array(), '', false);
-        $string = new \Magento\Stdlib\String;
         $data = array(
             'data_source_model'            => 'not_used',
             'connection'                   => 'not_used',
             'json_helper'                  => 'not_used',
-            'string_helper'                => new \Magento\Core\Helper\String(
-                $this->getMock('Magento\App\Helper\Context', array(), array(), '', false, false),
-                $localeMock,
-                $string,
-                new \Magento\Stdlib\String($string)
-            ),
             'page_size'                    => 1,
             'max_data_size'                => 1,
             'bunch_size'                   => 1,
diff --git a/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php b/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php
index 5c876738900..87aa406139e 100644
--- a/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php
+++ b/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php
@@ -72,7 +72,7 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Integration\Service\OauthV1|\PHPUnit_Framework_MockObject_MockObject */
     protected $_oauthSvcMock;
 
-    /** @var \Magento\Core\Model\Registry|\PHPUnit_Framework_MockObject_MockObject */
+    /** @var \Magento\Registry|\PHPUnit_Framework_MockObject_MockObject */
     protected $_registryMock;
 
     /** @var \Magento\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject */
@@ -149,7 +149,7 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase
         $this->_responseMock = $this->getMockBuilder('Magento\App\Response\Http')
             ->disableOriginalConstructor()
             ->getMock();
-        $this->_registryMock = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $this->_registryMock = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->getMock();
         $this->_configScopeMock = $this->getMockBuilder('Magento\Config\ScopeInterface')
diff --git a/dev/tests/unit/testsuite/Magento/Mail/Template/TransportBuilderTest.php b/dev/tests/unit/testsuite/Magento/Mail/Template/TransportBuilderTest.php
index 96d1d3c7a6b..d32f8c54e0c 100644
--- a/dev/tests/unit/testsuite/Magento/Mail/Template/TransportBuilderTest.php
+++ b/dev/tests/unit/testsuite/Magento/Mail/Template/TransportBuilderTest.php
@@ -25,6 +25,11 @@ namespace Magento\Mail\Template;
 
 class TransportBuilderTest extends \PHPUnit_Framework_TestCase
 {
+    /**
+     * @var string
+     */
+    protected $builderClassName = '\Magento\Mail\Template\TransportBuilder';
+
     /**
      * @var \Magento\Mail\Template\TransportBuilder
      */
@@ -45,23 +50,31 @@ class TransportBuilderTest extends \PHPUnit_Framework_TestCase
      */
     protected $objectManagerMock;
 
+    /**
+     * @var \Magento\Mail\Template\SenderResolverInterface | \PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $senderResolverMock;
+
     public function setUp()
     {
         $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
-        $this->templateFactoryMock = $this->getMock('\Magento\Mail\Template\FactoryInterface');
-        $this->messageMock = $this->getMock('\Magento\Mail\Message');
-        $this->objectManagerMock = $this->getMock('\Magento\ObjectManager');
+        $this->templateFactoryMock = $this->getMock('Magento\Mail\Template\FactoryInterface');
+        $this->messageMock = $this->getMock('Magento\Mail\Message');
+        $this->objectManagerMock = $this->getMock('Magento\ObjectManager');
+        $this->senderResolverMock = $this->getMock('Magento\Mail\Template\SenderResolverInterface');
 
-        $this->builder = $helper->getObject('\Magento\Mail\Template\TransportBuilder', array(
+        $this->builder = $helper->getObject($this->builderClassName, array(
             'templateFactory' => $this->templateFactoryMock,
             'message' => $this->messageMock,
-            'objectManager' => $this->objectManagerMock
+            'objectManager' => $this->objectManagerMock,
+            'senderResolver' => $this->senderResolverMock
         ));
     }
 
     /**
      * @dataProvider getTransportDataProvider
      * @param int $templateType
+     * @param string $messageType
      * @param string $bodyText
      */
     public function testGetTransport($templateType, $messageType, $bodyText)
@@ -74,7 +87,7 @@ class TransportBuilderTest extends \PHPUnit_Framework_TestCase
             'area'  => 'frontend',
             'store' => 1
         );
-        $template = $this->getMock('\Magento\Mail\Template\TemplateInterface');
+        $template = $this->getMock('\Magento\Mail\TemplateInterface');
         $template->expects($this->once())
             ->method('setVars')
             ->with($this->equalTo($vars))
@@ -113,33 +126,38 @@ class TransportBuilderTest extends \PHPUnit_Framework_TestCase
 
         $transport = $this->getMock('\Magento\Mail\TransportInterface');
 
-        $this->objectManagerMock->expects($this->once())
+        $this->objectManagerMock->expects($this->at(0))
             ->method('create')
             ->with(
-                $this->equalTo('\Magento\Mail\TransportInterface'),
+                $this->equalTo('Magento\Mail\TransportInterface'),
                 $this->equalTo(array('message' => $this->messageMock))
             )
             ->will($this->returnValue($transport));
 
+        $this->objectManagerMock->expects($this->at(1))
+            ->method('create')
+            ->with($this->equalTo('Magento\Mail\Message'))
+            ->will($this->returnValue($transport));
+
         $this->builder->setTemplateIdentifier('identifier')
             ->setTemplateVars($vars)
             ->setTemplateOptions($options);
 
         $result = $this->builder->getTransport();
 
-        $this->assertInstanceOf('\Magento\Mail\TransportInterface', $result);
+        $this->assertInstanceOf('Magento\Mail\TransportInterface', $result);
     }
 
     public function getTransportDataProvider()
     {
         return array(
             array(
-                \Magento\Mail\Template\TemplateInterface::TYPE_TEXT,
+                \Magento\App\TemplateTypesInterface::TYPE_TEXT,
                 \Magento\Mail\Message::TYPE_TEXT,
                 'Plain text'
             ),
             array(
-                \Magento\Mail\Template\TemplateInterface::TYPE_HTML,
+                \Magento\App\TemplateTypesInterface::TYPE_HTML,
                 \Magento\Mail\Message::TYPE_HTML,
                 '<h1>Html message</h1>'
             )
@@ -148,12 +166,17 @@ class TransportBuilderTest extends \PHPUnit_Framework_TestCase
 
     public function testSetFrom()
     {
+        $sender = array('email' => 'from@example.com', 'name' => 'name');
+        $this->senderResolverMock->expects($this->once())
+            ->method('resolve')
+            ->with($sender)
+            ->will($this->returnValue($sender));
         $this->messageMock->expects($this->once())
             ->method('setFrom')
-            ->with('from@example.com')
+            ->with('from@example.com', 'name')
             ->will($this->returnSelf());
 
-        $this->builder->setFrom('from@example.com');
+        $this->builder->setFrom($sender);
     }
 
     public function testSetCc()
diff --git a/dev/tests/unit/testsuite/Magento/Newsletter/Model/Queue/TransportBuilderTest.php b/dev/tests/unit/testsuite/Magento/Newsletter/Model/Queue/TransportBuilderTest.php
new file mode 100644
index 00000000000..4c6c74da39e
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Newsletter/Model/Queue/TransportBuilderTest.php
@@ -0,0 +1,119 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Newsletter\Model\Queue;
+
+class TransportBuilderTest extends \Magento\Mail\Template\TransportBuilderTest
+{
+    /**
+     * @var string
+     */
+    protected $builderClassName = '\Magento\Newsletter\Model\Queue\TransportBuilder';
+
+    /**
+     * @var \Magento\Newsletter\Model\Queue\TransportBuilder
+     */
+    protected $builder;
+
+    public function testGetTransport(
+        $templateType = \Magento\App\TemplateTypesInterface::TYPE_HTML,
+        $messageType = \Magento\Mail\Message::TYPE_HTML,
+        $bodyText = '<h1>Html message</h1>'
+    ) {
+        $data = array(
+            'template_subject' => 'Email Subject',
+            'template_text' => $bodyText,
+            'template_styles' => 'Styles',
+            'template_type' => $templateType,
+        );
+        $vars = array(
+            'reason' => 'Reason',
+            'customer' => 'Customer'
+        );
+        $options = array(
+            'area'  => 'frontend',
+            'store' => 1
+        );
+        $template = $this->getMock('\Magento\Email\Model\Template', array(), array(), '', false);
+        $template->expects($this->once())
+            ->method('setVars')
+            ->with($this->equalTo($vars))
+            ->will($this->returnSelf());
+        $template->expects($this->once())
+            ->method('setOptions')
+            ->with($this->equalTo($options))
+            ->will($this->returnSelf());
+        $template->expects($this->once())
+            ->method('getSubject')
+            ->will($this->returnValue('Email Subject'));
+        $template->expects($this->once())
+            ->method('getProcessedTemplate')
+            ->will($this->returnValue($bodyText));
+        $template->expects($this->once())
+            ->method('setData')
+            ->with($this->equalTo($data))
+            ->will($this->returnSelf());
+
+        $this->templateFactoryMock->expects($this->once())
+            ->method('get')
+            ->with($this->equalTo('identifier'))
+            ->will($this->returnValue($template));
+
+        $this->messageMock->expects($this->once())
+            ->method('setSubject')
+            ->with($this->equalTo('Email Subject'))
+            ->will($this->returnSelf());
+        $this->messageMock->expects($this->once())
+            ->method('setMessageType')
+            ->with($this->equalTo($messageType))
+            ->will($this->returnSelf());
+        $this->messageMock->expects($this->once())
+            ->method('setBody')
+            ->with($this->equalTo($bodyText))
+            ->will($this->returnSelf());
+
+        $transport = $this->getMock('\Magento\Mail\TransportInterface');
+
+        $this->objectManagerMock->expects($this->at(0))
+            ->method('create')
+            ->with(
+                $this->equalTo('Magento\Mail\TransportInterface'),
+                $this->equalTo(array('message' => $this->messageMock))
+            )
+            ->will($this->returnValue($transport));
+
+        $this->objectManagerMock->expects($this->at(1))
+            ->method('create')
+            ->with($this->equalTo('Magento\Mail\Message'))
+            ->will($this->returnValue($transport));
+
+        $this->builder->setTemplateIdentifier('identifier')
+            ->setTemplateVars($vars)
+            ->setTemplateOptions($options)
+            ->setTemplateData($data);
+
+        $result = $this->builder->getTransport();
+
+        $this->assertInstanceOf('Magento\Mail\TransportInterface', $result);
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php b/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php
index 3d5b60f06a3..877c2b7c7e6 100644
--- a/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php
+++ b/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php
@@ -33,8 +33,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
     public function testGetProcessedTemplate($isSingleStore)
     {
         $design = $this->getMock('Magento\View\DesignInterface');
-        $context = $this->getMock('Magento\Core\Model\Context', array(), array(), '', false);
-        $registry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $context = $this->getMock('Magento\Model\Context', array(), array(), '', false);
+        $registry = $this->getMock('Magento\Registry', array(), array(), '', false);
 
         $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false);
         $storeManager->expects($this->once())
diff --git a/dev/tests/unit/testsuite/Magento/Ogone/Model/ApiTest.php b/dev/tests/unit/testsuite/Magento/Ogone/Model/ApiTest.php
index 1fd6e162aba..5bb39be4143 100644
--- a/dev/tests/unit/testsuite/Magento/Ogone/Model/ApiTest.php
+++ b/dev/tests/unit/testsuite/Magento/Ogone/Model/ApiTest.php
@@ -46,13 +46,14 @@ class ApiTest extends \PHPUnit_Framework_TestCase
         $locale = $this->getMock('Magento\Core\Model\LocaleInterface', array(), array(), '', false);
         $urlBuilder = $this->getMock('Magento\UrlInterface', array(), array(), '', false);
         $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false);
-        $coreString = $this->getMock('Magento\Core\Helper\String', array(), array(), '', false);
+        $string = $this->getMock('\Magento\Stdlib\String', array(), array(), '', false);
         $config = $this->getMock('Magento\Ogone\Model\Config', array(), array(), '', false);
         $paymentDataMock = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false);
         $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false);
+        $loggerFactory = $this->getMock('\Magento\Logger\AdapterFactory', array(), array(), '', false);
         $object = new \Magento\Ogone\Model\Api(
-            $storeManager, $locale, $urlBuilder, $eventManager,
-            $coreString, $coreStoreConfig, $config, $paymentDataMock
+            $storeManager, $paymentDataMock, $coreStoreConfig, $loggerFactory,
+            $eventManager, $locale, $urlBuilder, $string, $config
         );
 
         $method = new \ReflectionMethod('Magento\Ogone\Model\Api', '_translate');
diff --git a/dev/tests/unit/testsuite/Magento/Payment/Block/Info/ContainerAbstractTest.php b/dev/tests/unit/testsuite/Magento/Payment/Block/Info/ContainerAbstractTest.php
index e9e187bf60a..0e49cd75ceb 100644
--- a/dev/tests/unit/testsuite/Magento/Payment/Block/Info/ContainerAbstractTest.php
+++ b/dev/tests/unit/testsuite/Magento/Payment/Block/Info/ContainerAbstractTest.php
@@ -38,7 +38,7 @@ class ContainerAbstractTest extends \PHPUnit_Framework_TestCase
             array('getChildBlock', 'getPaymentInfo'), array(), '', false);
         $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this);
         $paymentInfo = $objectManagerHelper->getObject('Magento\Payment\Model\Info');
-        $adapterFactoryMock = $this->getMock('Magento\Core\Model\Log\AdapterFactory', array('create'),
+        $adapterFactoryMock = $this->getMock('Magento\Logger\AdapterFactory', array('create'),
             array(), '', false);
         $methodInstance = $objectManagerHelper->getObject('Magento\Payment\Model\Method\Checkmo', array(
             'logAdapterFactory' => $adapterFactoryMock,
diff --git a/dev/tests/unit/testsuite/Magento/Payment/Model/Method/BanktransferTest.php b/dev/tests/unit/testsuite/Magento/Payment/Model/Method/BanktransferTest.php
index 9c9ba093eca..c3c85f154d5 100644
--- a/dev/tests/unit/testsuite/Magento/Payment/Model/Method/BanktransferTest.php
+++ b/dev/tests/unit/testsuite/Magento/Payment/Model/Method/BanktransferTest.php
@@ -40,7 +40,7 @@ class BanktransferTest extends \PHPUnit_Framework_TestCase
         $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false);
         $paymentDataMock = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false);
         $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false);
-        $adapterFactoryMock = $this->getMock('Magento\Core\Model\Log\AdapterFactory', array('create'),
+        $adapterFactoryMock = $this->getMock('Magento\Logger\AdapterFactory', array('create'),
             array(), '', false);
         $this->_object = $objectManagerHelper->getObject('Magento\Payment\Model\Method\Banktransfer', array(
             'eventManager' => $eventManager,
diff --git a/dev/tests/unit/testsuite/Magento/Payment/Model/Method/CashondeliveryTest.php b/dev/tests/unit/testsuite/Magento/Payment/Model/Method/CashondeliveryTest.php
index 4ab2ded5218..748d2fab8a6 100644
--- a/dev/tests/unit/testsuite/Magento/Payment/Model/Method/CashondeliveryTest.php
+++ b/dev/tests/unit/testsuite/Magento/Payment/Model/Method/CashondeliveryTest.php
@@ -40,7 +40,7 @@ class CashondeliveryTest extends \PHPUnit_Framework_TestCase
 
         $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false);
         $paymentDataMock = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false);
-        $adapterFactoryMock = $this->getMock('Magento\Core\Model\Log\AdapterFactory', array('create'),
+        $adapterFactoryMock = $this->getMock('Magento\Logger\AdapterFactory', array('create'),
             array(), '', false);
 
         $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false);
diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php
index 2ab47a4a2c8..eb50410de55 100644
--- a/dev/tests/unit/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php
+++ b/dev/tests/unit/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php
@@ -42,7 +42,7 @@ class AgreementTest extends \PHPUnit_Framework_TestCase
     protected $_request;
 
     /**
-     * @var \Magento\Core\Model\Registry|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Registry|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $_registry;
 
@@ -101,7 +101,7 @@ class AgreementTest extends \PHPUnit_Framework_TestCase
         $context->expects($this->any())->method('getRedirect')->will($this->returnValue($redirect));
         $context->expects($this->any())->method('getMessageManager')->will($this->returnValue($this->_messageManager));
 
-        $this->_registry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $this->_registry = $this->getMock('Magento\Registry', array(), array(), '', false);
 
         $title = $this->getMock('Magento\App\Action\Title', array(), array(), '', false);
 
diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Model/Billing/Agreement/OrdersUpdaterTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Model/Billing/Agreement/OrdersUpdaterTest.php
index fe6ba0fde24..bac007f6f6a 100644
--- a/dev/tests/unit/testsuite/Magento/Paypal/Model/Billing/Agreement/OrdersUpdaterTest.php
+++ b/dev/tests/unit/testsuite/Magento/Paypal/Model/Billing/Agreement/OrdersUpdaterTest.php
@@ -35,7 +35,7 @@ class OrdersUpdaterTest extends \PHPUnit_Framework_TestCase
     protected $_model;
 
     /**
-     * @var \Magento\Core\Model\Registry|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Registry|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $_registry;
 
@@ -46,7 +46,7 @@ class OrdersUpdaterTest extends \PHPUnit_Framework_TestCase
 
     protected function setUp()
     {
-        $this->_registry = $this->getMock('Magento\Core\Model\Registry', [], [], '', false);
+        $this->_registry = $this->getMock('Magento\Registry', [], [], '', false);
         $this->_agreementResource = $this->getMock(
             '\Magento\Paypal\Model\Resource\Billing\Agreement',
             [],
diff --git a/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/PriceTest.php b/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/PriceTest.php
index 041a38cbe8c..375dc499b1d 100644
--- a/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/PriceTest.php
+++ b/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/PriceTest.php
@@ -42,7 +42,7 @@ class PriceTest extends \PHPUnit_Framework_TestCase
     protected $_product;
 
     /**
-     * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Registry
+     * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Registry
      */
     protected $_registry;
 
@@ -66,7 +66,7 @@ class PriceTest extends \PHPUnit_Framework_TestCase
             'Magento\Catalog\Model\Product', array('getCanShowPrice', 'getId', '__wakeup'), array(), '', false
         );
         $this->_product->expects($this->any())->method('getId')->will($this->returnValue(1));
-        $this->_registry = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $this->_registry = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->setMethods(array('registry'))
             ->getMock();
diff --git a/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/StockTest.php b/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/StockTest.php
index 28edb7f9408..589f427fc78 100644
--- a/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/StockTest.php
+++ b/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/StockTest.php
@@ -42,7 +42,7 @@ class StockTest extends \PHPUnit_Framework_TestCase
     protected $_product;
 
     /**
-     * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Registry
+     * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Registry
      */
     protected $_registry;
 
@@ -66,7 +66,7 @@ class StockTest extends \PHPUnit_Framework_TestCase
             'Magento\Catalog\Model\Product', array('isAvailable', 'getId', '__wakeup'), array(), '', false
         );
         $this->_product->expects($this->any())->method('getId')->will($this->returnValue(1));
-        $this->_registry = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $this->_registry = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->setMethods(array('registry'))
             ->getMock();
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Plugin/PaymentTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Plugin/PaymentTest.php
new file mode 100644
index 00000000000..c9a8cee9d94
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Plugin/PaymentTest.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\RecurringProfile\Block\Plugin;
+
+use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
+
+class PaymentTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\RecurringProfile\Block\Plugin\Payment */
+    protected $payment;
+
+    /** @var ObjectManagerHelper */
+    protected $objectManagerHelper;
+
+    /** @var \Magento\Checkout\Model\Session|\PHPUnit_Framework_MockObject_MockObject */
+    protected $sessionMock;
+
+    /** @var \Magento\RecurringProfile\Model\Quote\Filter|\PHPUnit_Framework_MockObject_MockObject */
+    protected $filterMock;
+
+    protected function setUp()
+    {
+        $this->sessionMock = $this->getMock('Magento\Checkout\Model\Session', [], [], '', false);
+        $this->filterMock = $this->getMock('Magento\RecurringProfile\Model\Quote\Filter');
+
+        $this->objectManagerHelper = new ObjectManagerHelper($this);
+        $this->payment = $this->objectManagerHelper->getObject(
+            'Magento\RecurringProfile\Block\Plugin\Payment',
+            [
+                'session' => $this->sessionMock,
+                'filter' => $this->filterMock
+            ]
+        );
+    }
+
+    public function testAfterGetOptions()
+    {
+        $quote = $this->getMockBuilder('Magento\Sales\Model\Quote')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->sessionMock->expects($this->once())->method('getQuote')->will($this->returnValue($quote));
+        $this->filterMock->expects($this->once())
+            ->method('hasRecurringItems')
+            ->with($quote)
+            ->will($this->returnValue(true));
+
+        $this->assertArrayHasKey('hasRecurringItems', $this->payment->afterGetOptions([]));
+    }
+}
\ No newline at end of file
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/GridTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/GridTest.php
index b9f13e125e5..908cc82ed62 100644
--- a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/GridTest.php
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/GridTest.php
@@ -45,7 +45,7 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->setMethods(array('getId', '__wakeup'))
             ->getMock();
         $customer->expects($this->once())->method('getId')->will($this->returnValue(1));
-        $registry = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $registry = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->setMethods(array('registry'))
             ->getMock();
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/Related/Orders/GridTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/Related/Orders/GridTest.php
index 3069041d1b6..488dbd44e35 100644
--- a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/Related/Orders/GridTest.php
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/Related/Orders/GridTest.php
@@ -55,19 +55,17 @@ class GridTest extends \PHPUnit_Framework_TestCase
         $collectionElement = $this->getMock('Magento\RecurringProfile\Model\Profile', $args, array(), '', false);
         $collectionElement->expects($this->once())->method('getIncrementId')
             ->will($this->returnValue(1));
-        $collection = $this->getMock('Magento\Sales\Model\Resource\Order\Collection', array(), array(), '', false);
+        $collection = $this->getMock('Magento\Sales\Model\Resource\Order\Collection', [], [], '', false);
         $collection->expects($this->any())->method('addFieldToFilter')
             ->will($this->returnValue($collection));
         $collection->expects($this->once())->method('addFieldToSelect')
             ->will($this->returnValue($collection));
-        $collection->expects($this->once())->method('addRecurringProfilesFilter')
-            ->will($this->returnValue($collection));
         $collection->expects($this->once())->method('setOrder')
             ->will($this->returnValue($collection));
         $collection->expects($this->once())->method('getIterator')
             ->will($this->returnValue(new \ArrayIterator(array($collectionElement))));
         $profile = $this->getMock('Magento\RecurringProfile\Model\Profile', array(), array(), '', false);
-        $registry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
+        $registry = $this->getMock('Magento\Registry', array(), array(), '', false);
         $registry->expects($this->at(0))
             ->method('registry')
             ->with('current_recurring_profile')
@@ -83,6 +81,14 @@ class GridTest extends \PHPUnit_Framework_TestCase
         $locale = $this->getMock('\Magento\Core\Model\LocaleInterface');
         $locale->expects($this->once())->method('formatDate')
             ->will($this->returnValue('11-11-1999'));
+        $recurringCollectionFilter = $this->getMock(
+            '\Magento\RecurringProfile\Model\Resource\Order\CollectionFilter',
+            ['byIds'],
+            [],
+            '',
+            false
+        );
+        $recurringCollectionFilter->expects($this->once())->method('byIds')->will($this->returnValue($collection));
         $helper = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false);
         $helper->expects($this->once())->method('formatCurrency')
             ->will($this->returnValue('10 USD'));
@@ -93,7 +99,8 @@ class GridTest extends \PHPUnit_Framework_TestCase
                 'storeManager' => $storeManager,
                 'collection' => $collection,
                 'locale' => $locale,
-                'coreHelper' => $helper
+                'coreHelper' => $helper,
+                'recurringCollectionFilter' => $recurringCollectionFilter
             )
         );
         $pagerBlock = $this->getMockBuilder('Magento\Theme\Block\Html\Pager')
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/AddressTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/AddressTest.php
index f9703297ac4..884cc6d1f2a 100644
--- a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/AddressTest.php
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/AddressTest.php
@@ -53,7 +53,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
             ->getMock();
         $this->_profile->expects($this->once())->method('setStore')->will($this->returnValue($this->_profile));
 
-        $registry = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $registry = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->setMethods(array('registry'))
             ->getMock();
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/DataTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/DataTest.php
index cc325cf3e35..21e9ee5794e 100644
--- a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/DataTest.php
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/DataTest.php
@@ -48,7 +48,7 @@ class DataTest extends \PHPUnit_Framework_TestCase
             ->getMock();
         $this->_profile->expects($this->once())->method('setStore')->will($this->returnValue($this->_profile));
 
-        $registry = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $registry = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->setMethods(array('registry'))
             ->getMock();
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/FeesTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/FeesTest.php
index d999c275efb..9f94f24cc62 100644
--- a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/FeesTest.php
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/FeesTest.php
@@ -48,7 +48,7 @@ class FeesTest extends \PHPUnit_Framework_TestCase
             ->getMock();
         $this->_profile->expects($this->once())->method('setStore')->will($this->returnValue($this->_profile));
 
-        $registry = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $registry = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->setMethods(array('registry'))
             ->getMock();
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/ItemTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/ItemTest.php
index f0ef714e47e..5b7310df42a 100644
--- a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/ItemTest.php
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/ItemTest.php
@@ -48,7 +48,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase
             ->getMock();
         $this->_profile->expects($this->once())->method('setStore')->will($this->returnValue($this->_profile));
 
-        $registry = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $registry = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->setMethods(array('registry'))
             ->getMock();
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/ReferenceTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/ReferenceTest.php
index f7d4daeff02..dbe6bff0d02 100644
--- a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/ReferenceTest.php
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/ReferenceTest.php
@@ -48,7 +48,7 @@ class ReferenceTest extends \PHPUnit_Framework_TestCase
             ->getMock();
         $this->_profile->expects($this->once())->method('setStore')->will($this->returnValue($this->_profile));
 
-        $registry = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $registry = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->setMethods(array('registry'))
             ->getMock();
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/ScheduleTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/ScheduleTest.php
index 8b836e1f6c8..790d53bf58a 100644
--- a/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/ScheduleTest.php
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Block/Profile/View/ScheduleTest.php
@@ -48,7 +48,7 @@ class ScheduleTest extends \PHPUnit_Framework_TestCase
             ->getMock();
         $this->_profile->expects($this->once())->method('setStore')->will($this->returnValue($this->_profile));
 
-        $registry = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $registry = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->setMethods(array('registry'))
             ->getMock();
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Controller/RecurringProfileTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Controller/RecurringProfileTest.php
new file mode 100644
index 00000000000..29af91a6b70
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Controller/RecurringProfileTest.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\RecurringProfile\Controller;
+
+class RecurringProfileTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\RecurringProfile\Controller\RecurringProfile
+     */
+    protected $_controller;
+
+    protected function setUp()
+    {
+        $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->_controller = $objectHelper->getObject('Magento\RecurringProfile\Controller\RecurringProfile');
+    }
+
+    public function testOrdersAction()
+    {
+        $this->assertTrue(method_exists($this->_controller, 'ordersAction'));
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Model/Method/RecurringPaymentSpecificationTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Model/Method/RecurringPaymentSpecificationTest.php
new file mode 100644
index 00000000000..6d49fc87018
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Model/Method/RecurringPaymentSpecificationTest.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\RecurringProfile\Model\Method;
+
+use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
+
+class RecurringPaymentSpecificationTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\RecurringProfile\Model\Method\RecurringPaymentSpecification */
+    protected $recurringPaymentSpecification;
+
+    /** @var ObjectManagerHelper */
+    protected $objectManagerHelper;
+
+    /** @var \Magento\Payment\Model\Config|\PHPUnit_Framework_MockObject_MockObject */
+    protected $configMock;
+
+    protected function setUp()
+    {
+        $this->configMock = $this->getMock('Magento\Payment\Model\Config', [], [], '', false);
+
+        $this->objectManagerHelper = new ObjectManagerHelper($this);
+    }
+
+    public function testIsSatisfiedBy()
+    {
+        $paymentMethodCode = 'test';
+        $this->configMock->expects($this->once())
+            ->method('getMethodsInfo')
+            ->will($this->returnValue([
+                $paymentMethodCode => [
+                    \Magento\RecurringProfile\Model\Method\RecurringPaymentSpecification::CONFIG_KEY => 1
+                ]
+            ]));
+
+        $this->recurringPaymentSpecification = $this->objectManagerHelper->getObject(
+            'Magento\RecurringProfile\Model\Method\RecurringPaymentSpecification',
+            [
+                'paymentConfig' => $this->configMock
+            ]
+        );
+
+        $this->assertTrue($this->recurringPaymentSpecification->isSatisfiedBy($paymentMethodCode));
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Model/Observer/PaymentAvailabilityObserverTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Model/Observer/PaymentAvailabilityObserverTest.php
new file mode 100644
index 00000000000..281bbbbfabd
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Model/Observer/PaymentAvailabilityObserverTest.php
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\RecurringProfile\Model\Observer;
+
+use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
+
+class PaymentAvailabilityObserverTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\RecurringProfile\Model\Observer\PaymentAvailabilityObserver */
+    protected $paymentAvailabilityObserver;
+
+    /** @var ObjectManagerHelper */
+    protected $objectManagerHelper;
+
+    /** @var \Magento\RecurringProfile\Model\Quote\Filter|\PHPUnit_Framework_MockObject_MockObject */
+    protected $filterMock;
+
+    protected function setUp()
+    {
+        $this->filterMock = $this->getMock('Magento\RecurringProfile\Model\Quote\Filter');
+
+        $this->objectManagerHelper = new ObjectManagerHelper($this);
+        $this->paymentAvailabilityObserver = $this->objectManagerHelper->getObject(
+            'Magento\RecurringProfile\Model\Observer\PaymentAvailabilityObserver',
+            [
+                'quoteFilter' => $this->filterMock
+            ]
+        );
+    }
+
+    public function testObserve()
+    {
+        $quote = $this->getMockBuilder('Magento\Sales\Model\Quote')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $event = new \Magento\Event([
+            'quote' => $quote,
+            'method_instance' => $this->getMockBuilder('Magento\Payment\Model\Method\AbstractMethod')
+                    ->disableOriginalConstructor()
+                    ->getMock(),
+            'result' => new \StdClass()
+        ]);
+        $this->filterMock->expects($this->once())
+            ->method('hasRecurringItems')
+            ->with($quote)
+            ->will($this->returnValue(true));
+
+        $observer = $this->getMockBuilder('Magento\Event\Observer')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $observer->expects($this->any())
+            ->method('getEvent')
+            ->will($this->returnValue($event));
+
+        $this->paymentAvailabilityObserver->observe($observer);
+        $this->assertFalse($event->getResult()->isAvailable);
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/RecurringProfile/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/RecurringProfile/Model/ObserverTest.php
index 4ca2571757a..799800c65e5 100644
--- a/dev/tests/unit/testsuite/Magento/RecurringProfile/Model/ObserverTest.php
+++ b/dev/tests/unit/testsuite/Magento/RecurringProfile/Model/ObserverTest.php
@@ -49,13 +49,30 @@ class ObserverTest extends \PHPUnit_Framework_TestCase
     /**
      * @var \Magento\RecurringProfile\Model\RecurringProfileFactory
      */
-    protected $_profileFactory;
+    protected $_recurringProfileFactory;
 
     /**
      * @var \Magento\Event
      */
     protected $_event;
 
+    /**
+     * @var \Magento\RecurringProfile\Model\ProfileFactory
+     */
+    protected $_profileFactory;
+
+    /**
+     * @var \Magento\RecurringProfile\Model\Profile
+     */
+    protected $_profile;
+
+    /**
+     * @var \Magento\Checkout\Model\Session
+     */
+    protected $_checkoutSession;
+
+    protected $_quote;
+
     protected function setUp()
     {
         $this->_blockFactory = $this->getMock(
@@ -65,23 +82,44 @@ class ObserverTest extends \PHPUnit_Framework_TestCase
         $this->_fieldsBlock = $this->getMock(
             '\Magento\RecurringProfile\Block\Fields', ['getFieldLabel'], [], '', false
         );
-        $this->_profileFactory = $this->getMock(
+        $this->_recurringProfileFactory = $this->getMock(
             '\Magento\RecurringProfile\Model\RecurringProfileFactory', ['create'], [], '', false
         );
+        $this->_profileFactory = $this->getMock(
+            '\Magento\RecurringProfile\Model\ProfileFactory', ['create', 'importProduct'], [], '', false
+        );
+        $this->_checkoutSession = $this->getMock(
+            '\Magento\Checkout\Model\Session', ['setLastRecurringProfileIds'], [], '', false
+        );
+        $this->_quote = $this->getMock(
+            '\Magento\RecurringProfile\Model\QuoteImporter',
+            ['prepareRecurringPaymentProfiles'],
+            [],
+            '',
+            false
+        );
 
         $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
 
         $this->_testModel = $helper->getObject('Magento\RecurringProfile\Model\Observer', [
             'blockFactory' => $this->_blockFactory,
+            'recurringProfileFactory' => $this->_recurringProfileFactory,
+            'fields' => $this->_fieldsBlock,
             'profileFactory' => $this->_profileFactory,
-            'fields' => $this->_fieldsBlock
+            'checkoutSession' => $this->_checkoutSession,
+            'quoteImporter' => $this->_quote
         ]);
 
         $this->_event = $this->getMock(
-            'Magento\Event', ['getProductElement', 'getProduct', 'getResult', 'getBuyRequest'], [], '', false
+            'Magento\Event', [
+                'getProductElement', 'getProduct', 'getResult', 'getBuyRequest', 'getQuote', 'getApi'
+            ], [], '', false
         );
 
         $this->_observer->expects($this->any())->method('getEvent')->will($this->returnValue($this->_event));
+        $this->_profile = $this->getMock('Magento\RecurringProfile\Model\Profile', [
+            '__sleep', '__wakeup', 'isValid', 'importQuote', 'importQuoteItem', 'submit', 'getId', 'setMethodCode'
+        ], [], '', false);
     }
 
     public function testPrepareProductRecurringProfileOptions()
@@ -108,7 +146,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase
 
         $this->_fieldsBlock->expects($this->once())->method('getFieldLabel')->will($this->returnValue('Field Label'));
 
-        $this->_profileFactory->expects($this->once())->method('create')->will($this->returnValue($profile));
+        $this->_recurringProfileFactory->expects($this->once())->method('create')->will($this->returnValue($profile));
 
         $product = $this->getMock('Magento\Object', ['isRecurring', 'addCustomOption'], [], '', false);
         $product->expects($this->once())->method('isRecurring')->will($this->returnValue(true));
@@ -156,4 +194,41 @@ class ObserverTest extends \PHPUnit_Framework_TestCase
         $this->_testModel->addFieldsToProductEditForm($this->_observer);
         $this->assertEquals('htmlhtml', $result->output);
     }
+
+    public function testSubmitRecurringPaymentProfiles()
+    {
+        $this->_prepareRecurringPaymentProfiles();
+        $this->_quote->expects($this->once())->method('prepareRecurringPaymentProfiles')
+            ->will($this->returnValue([$this->_profile]));
+
+        $this->_profile->expects($this->once())->method('isValid')->will($this->returnValue(true));
+        $this->_profile->expects($this->once())->method('submit');
+
+        $this->_testModel->submitRecurringPaymentProfiles($this->_observer);
+    }
+
+    public function testAddRecurringProfileIdsToSession()
+    {
+        $this->_prepareRecurringPaymentProfiles();
+
+        $this->_testModel->addRecurringProfileIdsToSession($this->_observer);
+    }
+
+    protected function _prepareRecurringPaymentProfiles()
+    {
+        $product = $this->getMock('Magento\RecurringProfile\Model\Profile', [
+            'isRecurring', '__sleep', '__wakeup'
+        ], [], '', false);
+        $product->expects($this->any())->method('isRecurring')->will($this->returnValue(true));
+
+        $this->_profile = $this->getMock('Magento\RecurringProfile\Model\Profile', [
+            '__sleep', '__wakeup', 'isValid', 'importQuote', 'importQuoteItem', 'submit', 'getId', 'setMethodCode'
+        ], [], '', false);
+
+        $quote = $this->getMock('Magento\Sales\Model\Quote', [
+            'getTotalsCollectedFlag', '__sleep', '__wakeup', 'getAllVisibleItems'
+        ], [], '', false);
+
+        $this->_event->expects($this->once())->method('getQuote')->will($this->returnValue($quote));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreditmemoTest.php b/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreditmemoTest.php
index 3900eaf89f6..7a388320ee1 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreditmemoTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreditmemoTest.php
@@ -71,10 +71,10 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase
             array('setFormData'), $constructArguments
         );
         $this->_objectManager = $this->getMock('Magento\ObjectManager', array(), array(), '', false);
-        $registryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false, false);
+        $registryMock = $this->getMock('Magento\Registry', array(), array(), '', false, false);
         $this->_objectManager->expects($this->any())
             ->method('get')
-            ->with($this->equalTo('Magento\Core\Model\Registry'))
+            ->with($this->equalTo('Magento\Registry'))
             ->will($this->returnValue($registryMock));
         $this->_messageManager = $this->getMock('\Magento\Message\ManagerInterface', array(), array(), '', false);
 
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
new file mode 100644
index 00000000000..ae7ba07ddb8
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
@@ -0,0 +1,188 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Sales\Model\AdminOrder;
+
+use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
+
+/**
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
+class CreateTest extends \PHPUnit_Framework_TestCase
+{
+    const CUSTOMER_ID = 1;
+
+    /** @var \Magento\Sales\Model\AdminOrder\Create */
+    protected $adminOrderCreate;
+
+    /** @var ObjectManagerHelper */
+    protected $objectManagerHelper;
+
+    /** @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject */
+    protected $objectManagerMock;
+
+    /** @var \Magento\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $eventManagerMock;
+
+    /** @var \Magento\Registry|\PHPUnit_Framework_MockObject_MockObject */
+    protected $registryMock;
+
+    /** @var \Magento\Sales\Model\Config|\PHPUnit_Framework_MockObject_MockObject */
+    protected $configMock;
+
+    /** @var \Magento\Backend\Model\Session\Quote|\PHPUnit_Framework_MockObject_MockObject */
+    protected $sessionQuoteMock;
+
+    /** @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject */
+    protected $loggerMock;
+
+    /** @var \Magento\Object\Copy|\PHPUnit_Framework_MockObject_MockObject */
+    protected $copyMock;
+
+    /** @var \Magento\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $messageManagerMock;
+
+    /** @var \Magento\Customer\Service\V1\CustomerServiceInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $customerServiceMock;
+
+    /** @var \Magento\Customer\Model\Metadata\FormFactory|\PHPUnit_Framework_MockObject_MockObject */
+    protected $formFactoryMock;
+
+    /** @var \Magento\Customer\Service\V1\Dto\CustomerBuilder|\PHPUnit_Framework_MockObject_MockObject */
+    protected $customerBuilderMock;
+
+    /** @var \Magento\Customer\Helper\Data|\PHPUnit_Framework_MockObject_MockObject */
+    protected $customerHelperMock;
+
+    /** @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $customerGroupServiceMock;
+
+    protected function setUp()
+    {
+        $this->objectManagerMock = $this->getMock('Magento\ObjectManager');
+        $this->eventManagerMock = $this->getMock('Magento\Event\ManagerInterface');
+        $this->registryMock = $this->getMock('Magento\Registry');
+        $this->configMock = $this->getMock('Magento\Sales\Model\Config', [], [], '', false);
+        $this->sessionQuoteMock = $this->getMock('Magento\Backend\Model\Session\Quote', [], [], '', false);
+        $this->loggerMock = $this->getMock('Magento\Logger', [], [], '', false);
+        $this->copyMock = $this->getMock('Magento\Object\Copy', [], [], '', false);
+        $this->messageManagerMock = $this->getMock('Magento\Message\ManagerInterface');
+        $this->customerServiceMock = $this->getMock('Magento\Customer\Service\V1\CustomerServiceInterface');
+        $this->formFactoryMock = $this->getMock('Magento\Customer\Model\Metadata\FormFactory', [], [], '', false);
+        $this->customerBuilderMock = $this->getMock(
+            'Magento\Customer\Service\V1\Dto\CustomerBuilder',
+            [],
+            [],
+            '',
+            false
+        );
+        $this->customerHelperMock = $this->getMock('Magento\Customer\Helper\Data', [], [], '', false);
+        $this->customerGroupServiceMock = $this->getMock(
+            'Magento\Customer\Service\V1\CustomerGroupServiceInterface'
+        );
+
+        $this->objectManagerHelper = new ObjectManagerHelper($this);
+        $this->adminOrderCreate = $this->objectManagerHelper->getObject(
+            'Magento\Sales\Model\AdminOrder\Create',
+            [
+                'objectManager' => $this->objectManagerMock,
+                'eventManager' => $this->eventManagerMock,
+                'coreRegistry' => $this->registryMock,
+                'salesConfig' => $this->configMock,
+                'quoteSession' => $this->sessionQuoteMock,
+                'logger' => $this->loggerMock,
+                'objectCopyService' => $this->copyMock,
+                'messageManager' => $this->messageManagerMock,
+                'customerService' => $this->customerServiceMock,
+                'metadataFormFactory' => $this->formFactoryMock,
+                'customerBuilder' => $this->customerBuilderMock,
+                'customerHelper' => $this->customerHelperMock,
+                'customerGroupService' => $this->customerGroupServiceMock
+            ]
+        );
+    }
+
+    public function testSetAccountData()
+    {
+        $taxClassId = 1;
+        $attributes = [['email', 'user@example.com'], ['group_id', 1]];
+        $attributeMocks = [];
+
+        foreach ($attributes as $attribute) {
+            $attributeMock = $this->getMock('Magento\Customer\Service\V1\Dto\Eav\AttributeMetadata', [], [], '', false);
+
+            $attributeMock
+                ->expects($this->any())
+                ->method('getAttributeCode')
+                ->will($this->returnValue($attribute[0]));
+
+            $attributeMocks[] = $attributeMock;
+        }
+
+        $customerGroupMock = $this->getMock('Magento\Customer\Service\V1\Dto\CustomerGroup', [], [], '', false);
+        $customerGroupMock->expects($this->once())->method('getTaxClassId')->will($this->returnValue($taxClassId));
+        $customerFormMock = $this->getMock('Magento\Customer\Model\Metadata\Form', [], [], '', false);
+        $customerFormMock->expects($this->any())->method('getAttributes')->will($this->returnValue($attributeMocks));
+        $customerFormMock->expects($this->any())->method('extractData')->will($this->returnValue([]));
+        $customerFormMock->expects($this->any())->method('restoreData')->will($this->returnValue([]));
+
+        $customerFormMock
+            ->expects($this->any())
+            ->method('prepareRequest')
+            ->will($this->returnValue($this->getMock('Magento\App\RequestInterface')));
+
+        $customerMock = $this->getMock('Magento\Customer\Service\V1\Dto\Customer', [], [], '', false);
+        $customerMock->expects($this->any())->method('__toArray')->will($this->returnValue([]));
+        $customerMock->expects($this->any())->method('getAttribute')->will($this->returnValueMap($attributes));
+        $customerMock->expects($this->any())->method('getAttributes')->will(
+            $this->returnValue(['email' => 'user@example.com', 'group_id' => 1])
+        );
+        $quoteMock = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false);
+        $quoteMock->expects($this->any())->method('getCustomerData')->will($this->returnValue($customerMock));
+
+        $quoteMock
+            ->expects($this->once())
+            ->method('addData')
+            ->with(
+                [
+                    'customer_email' => $attributes[0][1],
+                    'customer_group_id' => $attributes[1][1],
+                    'customer_tax_class_id' => $taxClassId
+                ]
+            );
+
+        $this->formFactoryMock->expects($this->any())->method('create')->will($this->returnValue($customerFormMock));
+        $this->sessionQuoteMock->expects($this->any())->method('getQuote')->will($this->returnValue($quoteMock));
+        $this->customerBuilderMock->expects($this->any())->method('populateWithArray')->will($this->returnSelf());
+        $this->customerBuilderMock->expects($this->any())->method('create')->will($this->returnValue($customerMock));
+        $this->customerBuilderMock->expects($this->any())->method('mergeDtoWithArray')->will($this->returnArgument(0));
+
+        $this->customerGroupServiceMock
+            ->expects($this->once())
+            ->method('getGroup')
+            ->will($this->returnValue($customerGroupMock));
+
+        $this->adminOrderCreate->setAccountData([]);
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Backend/CustomerQuoteTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Backend/CustomerQuoteTest.php
deleted file mode 100644
index 92659084d1d..00000000000
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Backend/CustomerQuoteTest.php
+++ /dev/null
@@ -1,152 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-namespace Magento\Sales\Model\Observer\Backend;
-
-class CustomerQuoteTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var \Magento\Sales\Model\Observer\Backend\CustomerQuote
-     */
-    protected $_model;
-
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $_quoteMock;
-
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $_configMock;
-
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $_eventMock;
-
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $_storeManagerMock;
-
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $_observerMock;
-
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $_customerMock;
-
-    protected function setUp()
-    {
-        $this->_quoteMock = $this->getMock(
-            'Magento\Sales\Model\Quote',
-            array('setWebsite', 'loadByCustomer', 'getId', 'setCustomerGroupId', 'collectTotals', '__wakeup'),
-            array(),
-            '',
-            false
-        );
-        $this->_observerMock = $this->getMock('Magento\Event\Observer', array(), array(), '', false);
-        $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false);
-        $this->_configMock = $this->getMock('Magento\Customer\Model\Config\Share', array(), array(), '', false);
-        $this->_eventMock = $this->getMock('Magento\Event', array('getCustomer'), array(), '', false);
-        $this->_customerMock = $this->getMock('Magento\Customer\Model\Customer', array(), array(), '', false);
-        $this->_observerMock->expects($this->any())->method('getEvent')->will($this->returnValue($this->_eventMock));
-        $this->_eventMock
-            ->expects($this->once())
-            ->method('getCustomer')
-            ->will($this->returnValue($this->_customerMock));
-        $this->_model = new \Magento\Sales\Model\Observer\Backend\CustomerQuote(
-            $this->_storeManagerMock,
-            $this->_configMock,
-            $this->_quoteMock
-        );
-    }
-
-    public function testDispatchIfCustomerDataEqual()
-    {
-        $this->_customerMock->expects($this->once())->method('getGroupId')->will($this->returnValue(1));
-        $this->_customerMock->expects($this->once())->method('getOrigData')->will($this->returnValue(1));
-        $this->_configMock->expects($this->never())->method('isWebsiteScope');
-        $this->_model->dispatch($this->_observerMock);
-    }
-
-    public function testDispatchIfWebsiteScopeEnable()
-    {
-        $this->_customerMock->expects($this->once())->method('getGroupId')->will($this->returnValue(1));
-        $this->_customerMock->expects($this->once())->method('getOrigData')->will($this->returnValue(2));
-        $this->_configMock->expects($this->any())->method('isWebsiteScope')->will($this->returnValue(true));
-        $this->_customerMock->expects($this->any())->method('getWebsiteId');
-        $this->_storeManagerMock->expects($this->never())->method('getWebsites');
-        $this->_model->dispatch($this->_observerMock);
-    }
-
-    public function testDispatchIfWebsiteScopeDisable()
-    {
-        $websiteMock = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false);
-        $this->_customerMock->expects($this->once())->method('getGroupId')->will($this->returnValue(1));
-        $this->_customerMock->expects($this->once())->method('getOrigData')->will($this->returnValue(2));
-        $this->_configMock->expects($this->any())->method('isWebsiteScope')->will($this->returnValue(false));
-        $this->_customerMock->expects($this->never())->method('getWebsiteId');
-        $this->_storeManagerMock
-            ->expects($this->once())
-            ->method('getWebsites')
-            ->will($this->returnValue(array($websiteMock)));
-        $this->_storeManagerMock->expects($this->never())->method('getWebsite');
-        $this->_model->dispatch($this->_observerMock);
-    }
-
-    /**
-     * @dataProvider dispatchIfArrayExistDataProvider
-     * @param bool $quoteId
-     */
-    public function testDispatchIfArrayExist($quoteId)
-    {
-        $websiteMock = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false);
-        $this->_customerMock->expects($this->any())->method('getGroupId')->will($this->returnValue(1));
-        $this->_customerMock->expects($this->once())->method('getOrigData')->will($this->returnValue(2));
-        $this->_configMock->expects($this->any())->method('isWebsiteScope')->will($this->returnValue(true));
-        $this->_customerMock->expects($this->never())->method('getWebsiteId');
-        $this->_storeManagerMock
-            ->expects($this->once())
-            ->method('getWebsite')
-            ->will($this->returnValue(array($websiteMock)));
-        $this->_quoteMock->expects($this->once())->method('setWebsite');
-        $this->_quoteMock->expects($this->once())->method('loadByCustomer')->with($this->_customerMock);
-        $this->_quoteMock->expects(($this->once()))->method('getId')->will($this->returnValue($quoteId));
-        $this->_quoteMock->expects($this->any())->method('save');
-        $this->_model->dispatch($this->_observerMock);
-    }
-
-    public function dispatchIfArrayExistDataProvider()
-    {
-        return array(
-            array(true),
-            array(false),
-        );
-    }
-}
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Invoice/Total/ShippingTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Invoice/Total/ShippingTest.php
index fd8e0a297aa..e5c67ac9004 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Invoice/Total/ShippingTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Invoice/Total/ShippingTest.php
@@ -50,7 +50,7 @@ class ShippingTest extends \PHPUnit_Framework_TestCase
                 'Magento\Sales\Model\Resource\OrderFactory', array(), array(), '', false
             ),
             'calculatorFactory' => $this->getMock(
-                'Magento\Core\Model\CalculatorFactory', array(), array(), '', false
+                'Magento\Math\CalculatorFactory', array(), array(), '', false
             ),
             'invoiceItemCollectionFactory' => $this->getMock(
                 'Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory', array(), array(), '', false
@@ -60,13 +60,7 @@ class ShippingTest extends \PHPUnit_Framework_TestCase
             ),
             'commentCollectionFactory' => $this->getMock(
                 'Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory', array(), array(), '', false
-            ),
-            'templateMailerFactory' => $this->getMock(
-                'Magento\Email\Model\Template\MailerFactory', array(), array(), '', false
-            ),
-            'emailInfoFactory' => $this->getMock(
-                'Magento\Email\Model\InfoFactory', array(), array(), '', false
-            ),
+            )
         );
         foreach ($invoicesData as $oneInvoiceData) {
             $arguments['data'] = $oneInvoiceData;
@@ -92,12 +86,6 @@ class ShippingTest extends \PHPUnit_Framework_TestCase
             'productFactory' => $this->getMock(
                 'Magento\Catalog\Model\ProductFactory', array(), array(), '', false
             ),
-            'templateMailerFactory' => $this->getMock(
-                'Magento\Email\Model\Template\MailerFactory', array(), array(), '', false
-            ),
-            'emailInfoFactory' => $this->getMock(
-                'Magento\Email\Model\InfoFactory', array(), array(), '', false
-            ),
             'orderItemCollectionFactory' => $this->getMock(
                 'Magento\Sales\Model\Resource\Order\Item\CollectionFactory', array(), array(), '', false
             ),
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/InvoiceTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/InvoiceTest.php
index 5444d1003dc..5cd961ff73d 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/InvoiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/InvoiceTest.php
@@ -64,7 +64,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
                 'Magento\Sales\Model\Resource\OrderFactory', array(), array(), '', false
             ),
             'calculatorFactory' => $this->getMock(
-                'Magento\Core\Model\CalculatorFactory', array(), array(), '', false
+                'Magento\Math\CalculatorFactory', array(), array(), '', false
             ),
             'invoiceItemCollectionFactory' => $this->getMock(
                 'Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory', array(), array(), '', false
@@ -75,12 +75,6 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
             'commentCollectionFactory' => $this->getMock(
                 'Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory', array(), array(), '', false
             ),
-            'templateMailerFactory' => $this->getMock(
-                'Magento\Email\Model\Template\MailerFactory', array(), array(), '', false
-            ),
-            'emailInfoFactory' => $this->getMock(
-                'Magento\Email\Model\InfoFactory', array(), array(), '', false
-            ),
         );
         $this->_model = $helperManager->getObject('Magento\Sales\Model\Order\Invoice', $arguments);
         $this->_model->setOrder($this->_orderMock);
diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/ByPercentTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/ByPercentTest.php
new file mode 100644
index 00000000000..f6b93a8a788
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/ByPercentTest.php
@@ -0,0 +1,199 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @subpackage  unit_tests
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+class ByPercentTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\SalesRule\Model\Rule\Action\Discount\ByPercent
+     */
+    protected $model;
+
+    /**
+     * @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $validator;
+
+    /**
+     * @var \Magento\SalesRule\Model\Rule\Action\Discount\DataFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $discountDataFactory;
+
+    protected function setUp()
+    {
+        $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
+
+        $this->validator = $this->getMockBuilder('Magento\SalesRule\Model\Validator')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                ['getItemPrice', 'getItemBasePrice', 'getItemOriginalPrice', 'getItemBaseOriginalPrice', '__wakeup']
+            )
+            ->getMock();
+
+        $this->discountDataFactory = $this->getMockBuilder('Magento\SalesRule\Model\Rule\Action\Discount\DataFactory')
+            ->disableOriginalConstructor()
+            ->setMethods(['create'])
+            ->getMock();
+
+        $this->model = $helper->getObject('Magento\SalesRule\Model\Rule\Action\Discount\ByPercent', array(
+            'discountDataFactory' => $this->discountDataFactory,
+            'validator' => $this->validator,
+        ));
+    }
+
+    /**
+     * @param $qty
+     * @param $ruleData
+     * @param $itemData
+     * @param $validItemData
+     * @param $expectedRuleDiscountQty
+     * @param $expectedDiscountData
+     * @dataProvider calculateDataProvider
+     */
+    public function testCalculate(
+        $qty,
+        $ruleData,
+        $itemData,
+        $validItemData,
+        $expectedRuleDiscountQty,
+        $expectedDiscountData
+    ) {
+        $discountData = $this->getMockBuilder('Magento\SalesRule\Model\Rule\Action\Discount\Data')
+            ->disableOriginalConstructor()
+            ->setMethods(['setAmount', 'setBaseAmount', 'setOriginalAmount', 'setBaseOriginalAmount'])
+            ->getMock();
+
+        $this->discountDataFactory->expects($this->once())
+            ->method('create')
+            ->will($this->returnValue($discountData));
+
+        $rule = $this->getMockBuilder('Magento\SalesRule\Model\Rule')
+            ->disableOriginalConstructor()
+            ->setMethods(['getDiscountAmount', 'getDiscountQty', '__wakeup'])
+            ->getMock();
+
+
+        $item = $this->getMockBuilder('Magento\Sales\Model\Quote\Item\AbstractItem')
+            ->disableOriginalConstructor()
+            ->setMethods([
+                'getDiscountAmount',
+                'getBaseDiscountAmount',
+                'getDiscountPercent',
+                'setDiscountPercent',
+                '__wakeup',
+                'getQuote',
+                'getAddress',
+                'getOptionByCode'
+            ])
+            ->getMock();
+
+        $this->validator->expects($this->atLeastOnce())->method('getItemPrice')
+            ->with($item)->will($this->returnValue($validItemData['price']));
+        $this->validator->expects($this->atLeastOnce())->method('getItemBasePrice')
+            ->with($item)->will($this->returnValue($validItemData['basePrice']));
+        $this->validator->expects($this->atLeastOnce())->method('getItemOriginalPrice')
+            ->with($item)->will($this->returnValue($validItemData['originalPrice']));
+        $this->validator->expects($this->atLeastOnce())->method('getItemBaseOriginalPrice')
+            ->with($item)->will($this->returnValue($validItemData['baseOriginalPrice']));
+
+
+        $rule->expects($this->atLeastOnce())->method('getDiscountAmount')
+            ->will($this->returnValue($ruleData['discountAmount']));
+        $rule->expects($this->atLeastOnce())->method('getDiscountQty')
+            ->will($this->returnValue($ruleData['discountQty']));
+
+
+        $item->expects($this->atLeastOnce())->method('getDiscountAmount')
+            ->will($this->returnValue($itemData['discountAmount']));
+        $item->expects($this->atLeastOnce())->method('getBaseDiscountAmount')
+            ->will($this->returnValue($itemData['baseDiscountAmount']));
+        if (!$ruleData['discountQty'] || $ruleData['discountQty'] > $qty) {
+            $item->expects($this->atLeastOnce())->method('getDiscountPercent')
+                ->will($this->returnValue($itemData['discountPercent']));
+            $item->expects($this->atLeastOnce())->method('setDiscountPercent')
+                ->with($expectedRuleDiscountQty);
+        }
+
+        $discountData->expects($this->once())->method('setAmount')->with($expectedDiscountData['amount']);
+        $discountData->expects($this->once())->method('setBaseAmount')->with($expectedDiscountData['baseAmount']);
+        $discountData->expects($this->once())->method('setOriginalAmount')
+            ->with($expectedDiscountData['originalAmount']);
+        $discountData->expects($this->once())->method('setBaseOriginalAmount')
+            ->with($expectedDiscountData['baseOriginalAmount']);
+
+        $this->assertEquals($discountData, $this->model->calculate($rule, $item, $qty));
+    }
+
+    /**
+     * @return array
+     */
+    public function calculateDataProvider()
+    {
+        return array(
+            array(
+                'qty' => 3,
+                'ruleData' => ['discountAmount' => 30, 'discountQty' => 5],
+                'itemData' => ['discountAmount' => 10, 'baseDiscountAmount' => 50, 'discountPercent' => 55],
+                'validItemData' => ['price' => 50, 'basePrice' => 45, 'originalPrice' => 60, 'baseOriginalPrice' => 55],
+                'expectedRuleDiscountQty' => 85,
+                'expectedDiscountData' => [
+                    'amount' => 42, 'baseAmount' => 25.5, 'originalAmount' => 51, 'baseOriginalAmount' => 46.5
+                ]
+            )
+        );
+    }
+
+    /**
+     * @param int $step
+     * @param int|float $qty
+     * @param int $expected
+     * @dataProvider fixQuantityDataProvider
+     */
+    public function testFixQuantity($step, $qty, $expected)
+    {
+        $rule = $this->getMock('Magento\SalesRule\Model\Rule', ['getDiscountStep', '__wakeup'], [], '', false);
+        $rule->expects($this->once())
+            ->method('getDiscountStep')
+            ->will($this->returnValue($step));
+
+        $this->assertEquals($expected, $this->model->fixQuantity($qty, $rule));
+    }
+
+    /**
+     * @return array
+     */
+    public function fixQuantityDataProvider()
+    {
+        return [
+            ['step' => 0, 'qty' => 23, 'expected' => 23],
+            ['step' => 10, 'qty' => 23.5, 'expected' => 20],
+            ['step' => 20, 'qty' => 33, 'expected' => 20],
+            ['step' => 25, 'qty' => 23, 'expected' => 0],
+        ];
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/CartFixedTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/CartFixedTest.php
new file mode 100644
index 00000000000..14d5af3b387
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/CartFixedTest.php
@@ -0,0 +1,121 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @subpackage  unit_tests
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+class CartFixedTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\SalesRule\Model\Rule|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $rule;
+
+    /**
+     * @var \Magento\Sales\Model\Quote\Item\AbstractItem|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $item;
+
+    /**
+     * @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $validator;
+
+    /**
+     * @var \Magento\SalesRule\Model\Rule\Action\Discount\Data|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $data;
+
+    /**
+     * @var \Magento\Sales\Model\Quote|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $quote;
+
+    /**
+     * @var \Magento\Sales\Model\Quote\Address|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $address;
+
+    /**
+     * @var CartFixed
+     */
+    protected $model;
+
+    protected function setUp()
+    {
+        $this->rule = $this->getMock('Magento\Object', null, [], 'Rule', true);
+        $this->item = $this->getMock('Magento\Sales\Model\Quote\Item\AbstractItem', [], [], '', false);
+        $this->data = $this->getMock('Magento\SalesRule\Model\Rule\Action\Discount\Data', null);
+
+        $this->quote = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false);
+        $this->address = $this->getMock('Magento\Sales\Model\Quote\Address',
+            ['getCartFixedRules', 'setCartFixedRules', '__wakeup'], [], '', false);
+        $this->item->expects($this->any())->method('getQuote')->will($this->returnValue($this->quote));
+        $this->item->expects($this->any())->method('getAddress')->will($this->returnValue($this->address));
+
+        $this->validator = $this->getMock('Magento\SalesRule\Model\Validator', [], [], '', false);
+        $dataFactory = $this->getMock('Magento\SalesRule\Model\Rule\Action\Discount\DataFactory',
+            ['create'], [], '', false);
+        $dataFactory->expects($this->any())->method('create')->will($this->returnValue($this->data));
+        $this->model = new CartFixed($this->validator, $dataFactory);
+    }
+
+    /**
+     * @covers \Magento\SalesRule\Model\Rule\Action\Discount\CartFixed::_construct
+     * @covers \Magento\SalesRule\Model\Rule\Action\Discount\CartFixed::calculate
+     */
+    public function testCalculate()
+    {
+        $this->rule->setData([
+            'id' => 1,
+            'discount_amount' => 10.0
+        ]);
+
+        $this->address->expects($this->any())->method('getCartFixedRules')->will($this->returnValue([]));
+        $store = $this->getMock('Magento\Core\Model\Store', [], [], '', false);
+        $store->expects($this->atLeastOnce())->method('convertPrice')->will($this->returnArgument(0));
+        $store->expects($this->atLeastOnce())->method('roundPrice')->will($this->returnArgument(0));
+        $this->quote->expects($this->any())->method('getStore')->will($this->returnValue($store));
+
+        /** validators data */
+        $this->validator->expects($this->once())->method('getItemPrice')->with($this->item)
+            ->will($this->returnValue(100));
+        $this->validator->expects($this->once())->method('getItemBasePrice')->with($this->item)
+            ->will($this->returnValue(100));
+        $this->validator->expects($this->once())->method('getItemOriginalPrice')->with($this->item)
+            ->will($this->returnValue(100));
+        $this->validator->expects($this->once())->method('getItemBaseOriginalPrice')->with($this->item)
+            ->will($this->returnValue(100));
+
+        $this->address->expects($this->once())->method('setCartFixedRules')->with([1 => 0.0]);
+        $this->model->calculate($this->rule, $this->item, 1);
+
+        $this->assertEquals($this->data->getAmount(), 10);
+        $this->assertEquals($this->data->getBaseAmount(), 10);
+        $this->assertEquals($this->data->getOriginalAmount(), 10);
+        $this->assertEquals($this->data->getBaseOriginalAmount(), 100);
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/ToPercentTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/ToPercentTest.php
new file mode 100644
index 00000000000..1de682eafd6
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/ToPercentTest.php
@@ -0,0 +1,170 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category    Magento
+ * @package     Magento_SalesRule
+ * @subpackage  unit_tests
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\SalesRule\Model\Rule\Action\Discount;
+
+class ToPercentTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\SalesRule\Model\Rule\Action\Discount\ToPercent
+     */
+    protected $model;
+
+    /**
+     * @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $validator;
+
+    /**
+     * @var \Magento\SalesRule\Model\Rule\Action\Discount\DataFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $discountDataFactory;
+
+    protected function setUp()
+    {
+        $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
+
+        $this->validator = $this->getMockBuilder('Magento\SalesRule\Model\Validator')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                ['getItemPrice', 'getItemBasePrice', 'getItemOriginalPrice', 'getItemBaseOriginalPrice', '__wakeup']
+            )
+            ->getMock();
+
+        $this->discountDataFactory = $this->getMockBuilder('Magento\SalesRule\Model\Rule\Action\Discount\DataFactory')
+            ->disableOriginalConstructor()
+            ->setMethods(['create'])
+            ->getMock();
+
+        $this->model = $helper->getObject('Magento\SalesRule\Model\Rule\Action\Discount\ToPercent', array(
+                'discountDataFactory' => $this->discountDataFactory,
+                'validator' => $this->validator,
+            ));
+    }
+
+    /**
+     * @param $qty
+     * @param $ruleData
+     * @param $itemData
+     * @param $validItemData
+     * @param $expectedRuleDiscountQty
+     * @param $expectedDiscountData
+     * @dataProvider calculateDataProvider
+     */
+    public function testCalculate(
+        $qty,
+        $ruleData,
+        $itemData,
+        $validItemData,
+        $expectedRuleDiscountQty,
+        $expectedDiscountData
+    ) {
+        $discountData = $this->getMockBuilder('Magento\SalesRule\Model\Rule\Action\Discount\Data')
+            ->disableOriginalConstructor()
+            ->setMethods(['setAmount', 'setBaseAmount', 'setOriginalAmount', 'setBaseOriginalAmount'])
+            ->getMock();
+
+        $this->discountDataFactory->expects($this->once())
+            ->method('create')
+            ->will($this->returnValue($discountData));
+
+        $rule = $this->getMockBuilder('Magento\SalesRule\Model\Rule')
+            ->disableOriginalConstructor()
+            ->setMethods(['getDiscountAmount', 'getDiscountQty', '__wakeup'])
+            ->getMock();
+
+
+        $item = $this->getMockBuilder('Magento\Sales\Model\Quote\Item\AbstractItem')
+            ->disableOriginalConstructor()
+            ->setMethods([
+                    'getDiscountAmount',
+                    'getBaseDiscountAmount',
+                    'getDiscountPercent',
+                    'setDiscountPercent',
+                    '__wakeup',
+                    'getQuote',
+                    'getAddress',
+                    'getOptionByCode'
+                ])
+            ->getMock();
+
+        $this->validator->expects($this->atLeastOnce())->method('getItemPrice')
+            ->with($item)->will($this->returnValue($validItemData['price']));
+        $this->validator->expects($this->atLeastOnce())->method('getItemBasePrice')
+            ->with($item)->will($this->returnValue($validItemData['basePrice']));
+        $this->validator->expects($this->atLeastOnce())->method('getItemOriginalPrice')
+            ->with($item)->will($this->returnValue($validItemData['originalPrice']));
+        $this->validator->expects($this->atLeastOnce())->method('getItemBaseOriginalPrice')
+            ->with($item)->will($this->returnValue($validItemData['baseOriginalPrice']));
+
+
+        $rule->expects($this->atLeastOnce())->method('getDiscountAmount')
+            ->will($this->returnValue($ruleData['discountAmount']));
+        $rule->expects($this->atLeastOnce())->method('getDiscountQty')
+            ->will($this->returnValue($ruleData['discountQty']));
+
+
+        $item->expects($this->atLeastOnce())->method('getDiscountAmount')
+            ->will($this->returnValue($itemData['discountAmount']));
+        $item->expects($this->atLeastOnce())->method('getBaseDiscountAmount')
+            ->will($this->returnValue($itemData['baseDiscountAmount']));
+        if (!$ruleData['discountQty'] || $ruleData['discountQty'] > $qty) {
+            $item->expects($this->atLeastOnce())->method('getDiscountPercent')
+                ->will($this->returnValue($itemData['discountPercent']));
+            $item->expects($this->atLeastOnce())->method('setDiscountPercent')
+                ->with($expectedRuleDiscountQty);
+        }
+
+        $discountData->expects($this->once())->method('setAmount')->with($expectedDiscountData['amount']);
+        $discountData->expects($this->once())->method('setBaseAmount')->with($expectedDiscountData['baseAmount']);
+        $discountData->expects($this->once())->method('setOriginalAmount')
+            ->with($expectedDiscountData['originalAmount']);
+        $discountData->expects($this->once())->method('setBaseOriginalAmount')
+            ->with($expectedDiscountData['baseOriginalAmount']);
+
+        $this->assertEquals($discountData, $this->model->calculate($rule, $item, $qty));
+    }
+
+    /**
+     * @return array
+     */
+    public function calculateDataProvider()
+    {
+        return array(
+            array(
+                'qty' => 3,
+                'ruleData' => ['discountAmount' => 30, 'discountQty' => 5],
+                'itemData' => ['discountAmount' => 10, 'baseDiscountAmount' => 50, 'discountPercent' => 55],
+                'validItemData' => ['price' => 50, 'basePrice' => 45, 'originalPrice' => 60, 'baseOriginalPrice' => 55],
+                'expectedRuleDiscountQty' => 100,
+                'expectedDiscountData' => [
+                    'amount' => 98, 'baseAmount' => 59.5, 'originalAmount' => 119, 'baseOriginalAmount' => 108.5
+                ]
+            )
+        );
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php
index 2819c11e43c..34d7d4437c2 100644
--- a/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php
+++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php
@@ -32,24 +32,24 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase
     /**
      * @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $_model;
+    protected $model;
 
     protected function setUp()
     {
-        $this->_model = $this->getMock(
+        $this->model = $this->getMock(
             'Magento\SalesRule\Model\Validator',
             array('_getRules', '_getItemOriginalPrice', '_getItemBaseOriginalPrice', '__wakeup'),
             array(),
             '',
             false
         );
-        $this->_model->expects($this->any())
+        $this->model->expects($this->any())
             ->method('_getRules')
             ->will($this->returnValue(array()));
-        $this->_model->expects($this->any())
+        $this->model->expects($this->any())
             ->method('_getItemOriginalPrice')
             ->will($this->returnValue(1));
-        $this->_model->expects($this->any())
+        $this->model->expects($this->any())
             ->method('_getItemBaseOriginalPrice')
             ->will($this->returnValue(1));
     }
@@ -57,39 +57,21 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase
     /**
      * @return \Magento\Sales\Model\Quote\Item|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected function _getQuoteItemMock()
+    protected function getQuoteItemMock()
     {
         $fixturePath = __DIR__ . '/_files/';
-        $itemDownloadable = $this->getMock(
-            'Magento\Sales\Model\Quote\Item',
-            array('getAddress', '__wakeup'),
-            array(),
-            '',
-            false
-        );
+        $itemDownloadable = $this->getMock('Magento\Sales\Model\Quote\Item', ['getAddress', '__wakeup'], [], '', false);
         $itemDownloadable->expects($this->any())
             ->method('getAddress')
             ->will($this->returnValue(new \stdClass()));
 
-        $itemSimple = $this->getMock(
-            'Magento\Sales\Model\Quote\Item',
-            array('getAddress', '__wakeup'),
-            array(),
-            '',
-            false
-        );
+        $itemSimple = $this->getMock('Magento\Sales\Model\Quote\Item', ['getAddress', '__wakeup'], [], '', false);
         $itemSimple->expects($this->any())
             ->method('getAddress')
             ->will($this->returnValue(new \stdClass()));
 
         /** @var $quote \Magento\Sales\Model\Quote */
-        $quote = $this->getMock(
-            'Magento\Sales\Model\Quote',
-            array('hasNominalItems', '__wakeup'),
-            array(),
-            '',
-            false
-        );
+        $quote = $this->getMock('Magento\Sales\Model\Quote', ['hasNominalItems', '__wakeup'], [], '', false);
         $quote->expects($this->any())
             ->method('hasNominalItems')
             ->will($this->returnValue(false));
@@ -107,18 +89,18 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase
 
     public function testCanApplyRules()
     {
-        $item = $this->_getQuoteItemMock();
+        $item = $this->getQuoteItemMock();
 
         $quote = $item->getQuote();
         $quote->setItemsQty(2);
         $quote->setVirtualItemsQty(1);
 
-        $this->assertTrue($this->_model->canApplyRules($item));
+        $this->assertTrue($this->model->canApplyRules($item));
 
         $quote->setItemsQty(2);
         $quote->setVirtualItemsQty(2);
 
-        $this->assertTrue($this->_model->canApplyRules($item));
+        $this->assertTrue($this->model->canApplyRules($item));
 
         return true;
     }
@@ -130,25 +112,299 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase
             ->method('getAddress')
             ->will($this->returnValue(true));
 
-        $this->assertInstanceOf('Magento\SalesRule\Model\Validator', $this->_model->processFreeShipping($item));
+        $this->assertInstanceOf('Magento\SalesRule\Model\Validator', $this->model->processFreeShipping($item));
 
         return true;
     }
 
-    public function testProcess()
+    public function testProcessWhenItemPriceIsNegativeRulesAreNotApplied()
     {
-        $item = $this->getMock('Magento\Sales\Model\Quote\Item', array('getAddress', '__wakeup'), array(), '', false);
-        $item->expects($this->once())
-            ->method('getAddress')
-            ->will($this->returnValue(true));
-        $item->setDiscountCalculationPrice(-1);
-        $item->setCalculationPrice(1);
+        $negativePrice = -1;
 
-        $quote = $this->getMock('Magento\Sales\Model\Quote', array('__wakeup'), array(), '', false);
-        $item->setQuote($quote);
+        // 1. Get mocks
+        /** @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject $validator */
+        $validator = $this->getMock('Magento\SalesRule\Model\Validator', ['applyRules', '__wakeup'], [], '', false);
 
-        $this->assertInstanceOf('Magento\SalesRule\Model\Validator', $this->_model->process($item));
+        /** @var \Magento\Sales\Model\Quote\Item\AbstractItem|\PHPUnit_Framework_MockObject_MockObject $item */
+        $item = $this->getMock('Magento\Sales\Model\Quote\Item', array('__wakeup'), array(), '', false);
 
-        return true;
+        // 2. Set fixtures
+        $item->setDiscountCalculationPrice($negativePrice);
+        $item->setData('calculation_price', $negativePrice);
+
+        // 3. Set expectations
+        $validator->expects($this->never())->method('applyRules');
+
+        // 4. Run tested method
+        $validator->process($item);
+    }
+
+    public function testProcessWhenItemPriceIsNegativeDiscountsAreZeroed()
+    {
+        $negativePrice = -1;
+        $nonZeroDiscount = 123;
+
+        // 1. Get mocks
+        /** @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject $validator */
+        $validator = $this->getMock('Magento\SalesRule\Model\Validator', ['applyRules', '__wakeup'], [], '', false);
+
+        /** @var \Magento\Sales\Model\Quote\Item\AbstractItem|\PHPUnit_Framework_MockObject_MockObject $item */
+        $item = $this->getMock('Magento\Sales\Model\Quote\Item', array('__wakeup'), array(), '', false);
+
+        // 2. Set fixtures
+        $item->setDiscountCalculationPrice($negativePrice);
+        $item->setData('calculation_price', $negativePrice);
+
+        // Discounts that could be set before running tested method
+        $item->setDiscountAmount($nonZeroDiscount);
+        $item->setBaseDiscountAmount($nonZeroDiscount);
+        $item->setDiscountPercent($nonZeroDiscount);
+
+        // 3. Run tested method
+        $validator->process($item);
+
+        // 4. Check expected result
+        $this->assertEquals(0, $item->getDiscountAmount());
+        $this->assertEquals(0, $item->getBaseDiscountAmount());
+        $this->assertEquals(0, $item->getDiscountPercent());
+    }
+
+    public function testApplyRulesWhenRuleWithStopRulesProcessingIsUsed()
+    {
+        $positivePrice = 1;
+
+        // 1. Get mocks
+        /** @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject $validator */
+        $validator = $this->getMock(
+            'Magento\SalesRule\Model\Validator',
+            array('applyRule', 'setAppliedRuleIds', '_canProcessRule', '_getRules', '__wakeup'),
+            array(),
+            '',
+            false
+        );
+        /** @var \Magento\Sales\Model\Quote\Address|\PHPUnit_Framework_MockObject_MockObject $address */
+        $address = $this->getMock('Magento\Sales\Model\Quote\Address', ['__wakeup'], [], '', false);
+        /** @var \Magento\Sales\Model\Quote\Item\AbstractItem|\PHPUnit_Framework_MockObject_MockObject $item */
+        $item = $this->getMock('Magento\Sales\Model\Quote\Item', ['getAddress', '__wakeup'], [], '', false);
+        /**
+         * @var \Magento\SalesRule\Model\Rule|\PHPUnit_Framework_MockObject_MockObject $ruleWithStopFurtherProcessing
+         */
+        $ruleWithStopFurtherProcessing = $this->getMock('Magento\SalesRule\Model\Rule', ['__wakeup'], [], '', false);
+        /** @var \Magento\SalesRule\Model\Rule|\PHPUnit_Framework_MockObject_MockObject $ruleThatShouldNotBeRun */
+        $ruleThatShouldNotBeRun = $this->getMock('Magento\SalesRule\Model\Rule', array('__wakeup'), array(), '', false);
+
+        $item->expects($this->any())->method('getAddress')->will($this->returnValue($address));
+        $ruleWithStopFurtherProcessing->setName('ruleWithStopFurtherProcessing');
+        $ruleThatShouldNotBeRun->setName('ruleThatShouldNotBeRun');
+        $rules = array(
+            $ruleWithStopFurtherProcessing,
+            $ruleThatShouldNotBeRun,
+        );
+        $validator->expects($this->any())->method('_getRules')->will($this->returnValue($rules));
+
+        // 2. Set fixtures, provide tested code isolation
+        $item->setDiscountCalculationPrice($positivePrice);
+        $item->setData('calculation_price', $positivePrice);
+        $validator->setSkipActionsValidation(true);
+        $validator->expects($this->any())->method('_canProcessRule')->will($this->returnValue(true));
+        $ruleWithStopFurtherProcessing->setStopRulesProcessing(true);
+
+        // 3. Set expectations
+        $callback = function ($rule) use ($ruleThatShouldNotBeRun) {
+            /** @var $rule \Magento\SalesRule\Model\Rule|\PHPUnit_Framework_MockObject_MockObject */
+            if ($rule->getName() == $ruleThatShouldNotBeRun->getName()) {
+                $this->fail('Rule should not be run after applying rule that stops further rules processing');
+            }
+
+            return true;
+        };
+        $validator->expects($this->any())
+            ->method('applyRule')
+            ->with($this->anything(), $this->callback($callback), $this->anything());
+
+        // 4. Run tested method
+        $validator->process($item);
+
+        // 5. Set new expectations
+        $validator->expects($this->never())->method('applyRule');   //No rules should be applied further
+
+        // 6. Run tested method again
+        $validator->process($item);
+    }
+
+    public function testApplyRulesThatAppliedRuleIdsAreCollected()
+    {
+        $positivePrice = 1;
+        $ruleId1 = 123;
+        $ruleId2 = 234;
+        $expectedRuleIds = array(
+            $ruleId1 => $ruleId1,
+            $ruleId2 => $ruleId2
+        );
+
+        // 1. Get mocks
+        /** @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject $validator */
+        $validator = $this->getMock(
+            'Magento\SalesRule\Model\Validator',
+            array('applyRule', '_getRules', '_canProcessRule', 'setAppliedRuleIds', '__wakeup'),
+            array(),
+            '',
+            false
+        );
+        /** @var \Magento\Sales\Model\Quote\Item\AbstractItem|\PHPUnit_Framework_MockObject_MockObject $item */
+        $item = $this->getMock('Magento\Sales\Model\Quote\Item', ['getAddress', '__wakeup'], [], '', false);
+        /** @var \Magento\SalesRule\Model\Rule|\PHPUnit_Framework_MockObject_MockObject $rule */
+        $rule = $this->getMock('Magento\SalesRule\Model\Rule', array('__wakeup'), array(), '', false);
+        $rule->setRuleId($ruleId1);
+        /** @var \Magento\SalesRule\Model\Rule|\PHPUnit_Framework_MockObject_MockObject $rule2 */
+        $rule2 = $this->getMock('Magento\SalesRule\Model\Rule', array('__wakeup'), array(), '', false);
+        $rule2->setRuleId($ruleId2);
+        $rules = array($rule, $rule2,);
+        $validator->expects($this->any())->method('_getRules')->will($this->returnValue($rules));
+
+        // 2. Set fixtures, provide tested code isolation
+        $item->setDiscountCalculationPrice($positivePrice);
+        $item->setData('calculation_price', $positivePrice);
+        $validator->setSkipActionsValidation(true);
+        $validator->expects($this->any())->method('_canProcessRule')->will($this->returnValue(true));
+
+        // 3. Set expectations
+        $validator->expects($this->once())->method('setAppliedRuleIds')->with($this->anything(), $expectedRuleIds);
+
+        // 4. Run tested method again
+        $validator->process($item);
+    }
+
+    public function testApplyRule()
+    {
+        $positivePrice = 1;
+
+        // 1. Get mocks
+        /** @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject $validator */
+        $validator = $this->getMockBuilder('Magento\SalesRule\Model\Validator')
+            ->setMethods(array(
+                'getDiscountData', 'setDiscountData', '_addDiscountDescription', '_maintainAddressCouponCode',
+                '_canProcessRule', 'setAppliedRuleIds', '_getRules', '__wakeup'
+            ))
+            ->disableOriginalConstructor()
+            ->getMock();
+        $rule = $this->getMockBuilder('Magento\SalesRule\Model\Rule')
+            ->disableOriginalConstructor()
+            ->setMethods(array())
+            ->getMock();
+        /** @var \Magento\Sales\Model\Quote\Item\AbstractItem|\PHPUnit_Framework_MockObject_MockObject $item */
+        $item = $this->getMock('Magento\Sales\Model\Quote\Item', ['getAddress', '__wakeup'], [], '', false);
+        $discountData = $this->getMockBuilder('Magento\SalesRule\Model\Rule\Action\Discount\Data')->getMock();
+
+        // 2.Provide tested code isolation
+        $item->setDiscountCalculationPrice($positivePrice);
+        $item->setData('calculation_price', $positivePrice);
+        $validator->setSkipActionsValidation(true);
+        $validator->expects($this->any())->method('_canProcessRule')->will($this->returnValue(true));
+        $validator->expects($this->any())->method('_getRules')->will($this->returnValue(array($rule)));
+        $validator->expects($this->any())->method('getDiscountData')->will($this->returnValue($discountData));
+
+        // 3. Set expectations
+        $validator->expects($this->any())->method('setDiscountData')->with($discountData);
+
+        // 4. Run tested method again
+        $validator->process($item);
+    }
+
+    public function testSetAppliedRuleIds()
+    {
+        $positivePrice = 1;
+        $previouslySetRuleIds = array(1, 2, 4);
+        $exampleRuleIds = array(1, 2, 3, 5);
+        $expectedRuleIds = '1,2,3,5';
+        $expectedMergedRuleIds = '1,2,3,4,5';
+
+        // 1. Get mocks
+        /** @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject $validator */
+        $validator = $this->getMock('Magento\SalesRule\Model\Validator', ['applyRules', '__wakeup'], [], '', false);
+        /** @var \Magento\Sales\Model\Quote\Item\AbstractItem|\PHPUnit_Framework_MockObject_MockObject $item */
+        $item = $this->getMock('Magento\Sales\Model\Quote\Item', ['getAddress', 'getQuote', '__wakeup'], [], '', false);
+        /** @var \Magento\Sales\Model\Quote\Address|\PHPUnit_Framework_MockObject_MockObject $address */
+        $address = $this->getMock('Magento\Sales\Model\Quote\Address', ['__wakeup'], [], '', false);
+        /** @var \Magento\Sales\Model\Quote|\PHPUnit_Framework_MockObject_MockObject $quote */
+        $quote = $this->getMock('Magento\Sales\Model\Quote', ['__wakeup'], [], '', false);
+        $item->expects($this->any())->method('getAddress')->will($this->returnValue($address));
+        $item->expects($this->any())->method('getQuote')->will($this->returnValue($quote));
+
+        // 2. Set fixtures
+        $item->setDiscountCalculationPrice($positivePrice);
+        $item->setData('calculation_price', $positivePrice);
+        $validator->expects($this->any())->method('applyRules')->will($this->returnValue($exampleRuleIds));
+        $address->setAppliedRuleIds($previouslySetRuleIds);
+        $quote->setAppliedRuleIds($previouslySetRuleIds);
+
+        // 3. Run tested method
+        $validator->process($item);
+
+        // 4. Check expected result
+        $this->assertEquals($expectedRuleIds, $item->getAppliedRuleIds());
+
+        $this->assertObjectHasRuleIdsSet($expectedMergedRuleIds, $item->getAddress());
+        $this->assertObjectHasRuleIdsSet($expectedMergedRuleIds, $item->getQuote());
+    }
+
+    /**
+     * @param $expectedMergedRuleIds
+     * @param \Magento\Sales\Model\Quote\Address|\Magento\Sales\Model\Quote $object
+     * @return $this
+     */
+    protected function assertObjectHasRuleIdsSet($expectedMergedRuleIds, $object)
+    {
+        $array = explode(',', $object->getAppliedRuleIds());
+        sort($array);
+        $this->assertEquals($expectedMergedRuleIds, join(',', $array));
+
+        return $this;
+    }
+    
+    protected function getValidator()
+    {
+        // 1. Get mocks
+        /** @var \Magento\SalesRule\Model\Rule\Action\Discount\DiscountInterface $calculator */
+        $calculator = $this->getMockBuilder('Magento\SalesRule\Model\Rule\Action\Discount\DiscountInterface')
+            ->setMethods(array('fixQuantity', 'calculate'))
+            ->getMock();
+
+        $discountData = $this->getMockBuilder('Magento\SalesRule\Model\Rule\Action\Discount\Data')
+            ->getMock();
+
+        /** @var \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory */
+        $calculatorFactory = $this->getMockBuilder('Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory')
+            ->disableOriginalConstructor()
+            ->setMethods(array('create'))
+            ->getMock();
+
+        $calculator->expects($this->any())->method('fixQuantity');
+        $calculator->expects($this->any())->method('calculate')->will($this->returnValue($discountData));
+        $calculatorFactory->expects($this->any())->method('create')->will($this->returnValue($calculator));
+
+        $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $args = $objectManagerHelper->getConstructArguments(
+            'Magento\SalesRule\Model\Validator',
+            array('calculatorFactory' => $calculatorFactory)
+        );
+
+        /** @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject $validator */
+        $validator = $this->getMockBuilder('Magento\SalesRule\Model\Validator')
+            ->setMethods(array(
+                'getDiscountData', 'setDiscountData', '_addDiscountDescription', '_maintainAddressCouponCode',
+                '_getItemQty', '_canProcessRule', 'setAppliedRuleIds', '_getRules', '__wakeup'
+            ))
+            ->setConstructorArgs($args)
+            ->getMock();
+
+        $rule = $this->getMockBuilder('Magento\SalesRule\Model\Rule')
+            ->disableOriginalConstructor()
+            ->setMethods(array())
+            ->getMock();
+        $validator->expects($this->any())->method('_getRules')->will($this->returnValue(array($rule)));
+
+
+        return $validator;
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Shipping/Block/Adminhtml/Order/TrackingTest.php b/dev/tests/unit/testsuite/Magento/Shipping/Block/Adminhtml/Order/TrackingTest.php
index 4f7f7f6221b..8ef575dd36c 100644
--- a/dev/tests/unit/testsuite/Magento/Shipping/Block/Adminhtml/Order/TrackingTest.php
+++ b/dev/tests/unit/testsuite/Magento/Shipping/Block/Adminhtml/Order/TrackingTest.php
@@ -32,7 +32,7 @@ class TrackingTest extends \PHPUnit_Framework_TestCase
 
         $shipment = new \Magento\Object(['store_id' => 1]);
 
-        $registry = $this->getMock('Magento\Core\Model\Registry', ['registry'], [], '', false);
+        $registry = $this->getMock('Magento\Registry', ['registry'], [], '', false);
         $registry->expects($this->once())->method('registry')
             ->with('current_shipment')->will($this->returnValue($shipment));
 
diff --git a/dev/tests/unit/testsuite/Magento/Stdlib/StringTest.php b/dev/tests/unit/testsuite/Magento/Stdlib/StringTest.php
index 27510a0869d..50471c5e46f 100644
--- a/dev/tests/unit/testsuite/Magento/Stdlib/StringTest.php
+++ b/dev/tests/unit/testsuite/Magento/Stdlib/StringTest.php
@@ -77,4 +77,66 @@ class StringTest extends \PHPUnit_Framework_TestCase
     {
         $this->assertEquals(1, $this->_string->strpos('123', 2));
     }
+
+    /**
+     * @param string $testString
+     * @param string $expected
+     *
+     * @dataProvider upperCaseWordsDataProvider
+     */
+    public function testUpperCaseWords($testString, $expected)
+    {
+        $actual = $this->_string->upperCaseWords($testString);
+        $this->assertEquals($expected, $actual);
+    }
+
+    /**
+     * @return array
+     */
+    public function upperCaseWordsDataProvider()
+    {
+        return array(
+            array(
+                'test test2',
+                'Test_Test2',
+            ),
+            array(
+                'test_test2',
+                'Test_Test2',
+            ),
+            array(
+                'test_test2 test3',
+                'Test_Test2_Test3',
+            ),
+        );
+    }
+
+    /**
+     * @param string $testString
+     * @param string $sourceSeparator
+     * @param string $destinationSeparator
+     * @param string $expected
+     *
+     * @dataProvider upperCaseWordsWithSeparatorsDataProvider
+     */
+    public function testUpperCaseWordsWithSeparators($testString, $sourceSeparator, $destinationSeparator, $expected)
+    {
+        $actual = $this->_string->upperCaseWords($testString, $sourceSeparator, $destinationSeparator);
+        $this->assertEquals($expected, $actual);
+    }
+
+    /**
+     * @return array
+     */
+    public function upperCaseWordsWithSeparatorsDataProvider()
+    {
+        return array(
+            array(
+                'test test2_test3\test4|test5',
+                '|',
+                '\\',
+                'Test\Test2_test3\test4\Test5',
+            ),
+        );
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Dictionary/Writer/CsvTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Dictionary/Writer/CsvTest.php
index df30498b54b..d48ff7992e1 100644
--- a/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Dictionary/Writer/CsvTest.php
+++ b/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Dictionary/Writer/CsvTest.php
@@ -73,22 +73,22 @@ class CsvTest extends \PHPUnit_Framework_TestCase
     public function testWrite()
     {
         $this->_phraseFirstMock->expects($this->once())->method('getPhrase')
-            ->will($this->returnValue('phrase1'));
+            ->will($this->returnValue("phrase1_quote\\'"));
         $this->_phraseFirstMock->expects($this->once())->method('getTranslation')
-            ->will($this->returnValue('translation1'));
+            ->will($this->returnValue("translation1_quote\\'"));
         $this->_phraseFirstMock->expects($this->once())->method('getContextType')
-            ->will($this->returnValue('context_type1'));
+            ->will($this->returnValue("context_type1_quote\\'"));
         $this->_phraseFirstMock->expects($this->once())->method('getContextValueAsString')
-            ->will($this->returnValue('content_value1'));
+            ->will($this->returnValue("content_value1_quote\\'"));
 
         $this->_phraseSecondMock->expects($this->once())->method('getPhrase')
-            ->will($this->returnValue('phrase2'));
+            ->will($this->returnValue("phrase2_quote\\'"));
         $this->_phraseSecondMock->expects($this->once())->method('getTranslation')
-            ->will($this->returnValue('translation2'));
+            ->will($this->returnValue("translation2_quote\\'"));
         $this->_phraseSecondMock->expects($this->once())->method('getContextType')
-            ->will($this->returnValue('context_type2'));
+            ->will($this->returnValue("context_type2_quote\\'"));
         $this->_phraseSecondMock->expects($this->once())->method('getContextValueAsString')
-            ->will($this->returnValue('content_value2'));
+            ->will($this->returnValue("content_value2_quote\\'"));
 
         $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this);
         /** @var \Magento\Tools\I18n\Code\Dictionary\Writer\Csv $writer */
@@ -98,8 +98,12 @@ class CsvTest extends \PHPUnit_Framework_TestCase
         $writer->write($this->_phraseFirstMock);
         $writer->write($this->_phraseSecondMock);
 
-        $expected = "phrase1,translation1,context_type1,content_value1\nphrase2,translation2,context_type2,"
-            . "content_value2\n";
+        $expected = <<<EXPECTED
+phrase1_quote',translation1_quote',"context_type1_quote\'","content_value1_quote\'"
+phrase2_quote',translation2_quote',"context_type2_quote\'","content_value2_quote\'"
+
+EXPECTED;
+
         $this->assertEquals($expected, file_get_contents($this->_testFile));
     }
 
diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/JsTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/JsTest.php
index 79a7e7b2805..0aa26b76f71 100644
--- a/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/JsTest.php
+++ b/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/JsTest.php
@@ -25,6 +25,7 @@
 namespace Magento\Test\Tools\I18n\Code\Parser\Adapter;
 
 use Magento\TestFramework\Helper\ObjectManager;
+use Magento\Tools\I18n\Code\Dictionary\Phrase;
 
 class JsTest extends \PHPUnit_Framework_TestCase
 {
@@ -59,11 +60,13 @@ class JsTest extends \PHPUnit_Framework_TestCase
                 'phrase' => 'Phrase 1',
                 'file' => $this->_testFile,
                 'line' => $this->_stringsCount - 2,
+                'quote' => Phrase::QUOTE_SINGLE,
             ),
             array(
                 'phrase' => 'Phrase 2 %1',
                 'file' => $this->_testFile,
                 'line' => $this->_stringsCount - 1,
+                'quote' => Phrase::QUOTE_DOUBLE,
             ),
         );
 
diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/PhpTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/PhpTest.php
index f0735c2fa58..7e67c53cb1e 100644
--- a/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/PhpTest.php
+++ b/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/PhpTest.php
@@ -56,6 +56,7 @@ class PhpTest extends \PHPUnit_Framework_TestCase
                 'phrase' => 'phrase1',
                 'file' => 'file1',
                 'line' => 15,
+                'quote' => '',
             ),
         );
 
diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/XmlTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/XmlTest.php
index 1d079f27e0f..a1d1a145abf 100644
--- a/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/XmlTest.php
+++ b/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/XmlTest.php
@@ -52,16 +52,19 @@ class XmlTest extends \PHPUnit_Framework_TestCase
                 'phrase' => 'Phrase 2',
                 'file' => $this->_testFile,
                 'line' => '',
+                'quote' => '',
             ),
             array(
                 'phrase' => 'Phrase 3',
                 'file' => $this->_testFile,
                 'line' => '',
+                'quote' => '',
             ),
             array(
                 'phrase' => 'Phrase 1',
                 'file' => $this->_testFile,
                 'line' => '',
+                'quote' => '',
             ),
         );
 
diff --git a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/TabAbstractTest.php b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/TabAbstractTest.php
index a92c2e0c91b..023f9a4b8eb 100644
--- a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/TabAbstractTest.php
+++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/TabAbstractTest.php
@@ -40,7 +40,7 @@ class TabAbstractTest extends \PHPUnit_Framework_TestCase
             'Magento\Theme\Block\Adminhtml\System\Design\Theme\Edit\AbstractTab',
             array(
                 $this->getMock('Magento\Backend\Block\Template\Context', array(), array(), '', false),
-                $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false),
+                $this->getMock('Magento\Registry', array(), array(), '', false),
                 $this->getMock('Magento\Data\FormFactory', array(), array(), '', false),
                 $this->getMock('Magento\ObjectManager', array(), array(), '', false)
             ),
diff --git a/dev/tests/unit/testsuite/Magento/User/Model/Acl/Loader/RuleTest.php b/dev/tests/unit/testsuite/Magento/User/Model/Acl/Loader/RuleTest.php
index 2ea0064af73..f49d8b1b409 100644
--- a/dev/tests/unit/testsuite/Magento/User/Model/Acl/Loader/RuleTest.php
+++ b/dev/tests/unit/testsuite/Magento/User/Model/Acl/Loader/RuleTest.php
@@ -40,14 +40,14 @@ class RuleTest extends \PHPUnit_Framework_TestCase
     protected $_resourceMock;
 
     /**
-     * @var \Magento\Core\Model\Acl\RootResource
+     * @var \Magento\Acl\RootResource
      */
     protected $_rootResourceMock;
 
     protected function setUp()
     {
         $this->_resourceMock = $this->getMock('Magento\App\Resource', array(), array(), '', false, false);
-        $this->_rootResourceMock = new \Magento\Core\Model\Acl\RootResource('Magento_Adminhtml::all');
+        $this->_rootResourceMock = new \Magento\Acl\RootResource('Magento_Adminhtml::all');
         $this->_model = new \Magento\User\Model\Acl\Loader\Rule(
             $this->_rootResourceMock,
             $this->_resourceMock
diff --git a/dev/tests/unit/testsuite/Magento/User/Model/UserTest.php b/dev/tests/unit/testsuite/Magento/User/Model/UserTest.php
index 02c628ff446..cc9deec482c 100644
--- a/dev/tests/unit/testsuite/Magento/User/Model/UserTest.php
+++ b/dev/tests/unit/testsuite/Magento/User/Model/UserTest.php
@@ -40,10 +40,10 @@ class UserTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Core\Helper\Data */
     protected $_coreData;
 
-    /** @var \Magento\Email\Model\Sender|PHPUnit_Framework_MockObject_MockObject */
-    protected $_senderMock;
+    /** @var \Magento\Mail\Template\TransportBuilder|PHPUnit_Framework_MockObject_MockObject */
+    protected $_transportBuilderMock;
 
-    /** @var \Magento\Core\Model\Context|PHPUnit_Framework_MockObject_MockObject */
+    /** @var \Magento\Model\Context|PHPUnit_Framework_MockObject_MockObject */
     protected $_contextMock;
 
     /** @var \Magento\User\Model\Resource\User|PHPUnit_Framework_MockObject_MockObject */
@@ -52,6 +52,18 @@ class UserTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Data\Collection\Db|PHPUnit_Framework_MockObject_MockObject */
     protected $_collectionMock;
 
+    /** @var \Magento\Mail\TransportInterface|PHPUnit_Framework_MockObject_MockObject */
+    protected $_transportMock;
+
+    /** @var \Magento\Core\Model\StoreManagerInterface|PHPUnit_Framework_MockObject_MockObject */
+    protected $_storeManagerMock;
+
+    /** @var \Magento\Core\Model\Store|PHPUnit_Framework_MockObject_MockObject */
+    protected $_storetMock;
+
+    /** @var \Magento\Backend\App\ConfigInterface */
+    protected $_configMock;
+
     /**
      * Set required values
      */
@@ -65,11 +77,7 @@ class UserTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->setMethods(array())
             ->getMock();
-        $this->_senderMock = $this->getMockBuilder('Magento\Email\Model\Sender')
-            ->disableOriginalConstructor()
-            ->setMethods(array('send'))
-            ->getMock();
-        $this->_contextMock = $this->getMockBuilder('Magento\Core\Model\Context')
+        $this->_contextMock = $this->getMockBuilder('Magento\Model\Context')
             ->disableOriginalConstructor()
             ->setMethods(array())
             ->getMock();
@@ -81,32 +89,58 @@ class UserTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->setMethods(array())
             ->getMock();
-        $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false);
-
-        $eventManagerMock = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false);
-        $objectFactoryMock = $this->getMock('Magento\Validator\ObjectFactory', array('create'),
-            array(), '', false);
-        $roleFactoryMock = $this->getMock('Magento\User\Model\RoleFactory', array('create'),
-            array(), '', false);
-        $emailFactoryMock = $this->getMock('Magento\Email\Model\InfoFactory', array('create'),
-            array(), '', false);
-        $mailerFactoryMock = $this->getMock('Magento\Email\Model\Template\MailerFactory', array('create'),
-            array(), '', false);
+        $coreRegistry = $this->getMockBuilder('Magento\Registry')
+            ->disableOriginalConstructor()
+            ->setMethods(array())
+            ->getMock();
+        $eventManagerMock = $this->getMockBuilder('Magento\Event\ManagerInterface')
+            ->disableOriginalConstructor()
+            ->setMethods(array())
+            ->getMock();
+        $objectFactoryMock = $this->getMockBuilder('Magento\Validator\ObjectFactory')
+            ->disableOriginalConstructor()
+            ->setMethods(array('create'))
+            ->getMock();
+        $roleFactoryMock = $this->getMockBuilder('Magento\User\Model\RoleFactory')
+            ->disableOriginalConstructor()
+            ->setMethods(array('create'))
+            ->getMock();
+        $this->_transportMock = $this->getMockBuilder('Magento\Mail\TransportInterface')
+            ->disableOriginalConstructor()
+            ->setMethods(array())
+            ->getMock();
+        $this->_transportBuilderMock = $this->getMockBuilder('\Magento\Mail\Template\TransportBuilder')
+            ->disableOriginalConstructor()
+            ->setMethods(array())
+            ->getMock();
+        $this->_storetMock = $this->getMockBuilder('\Magento\Core\Model\Store')
+            ->disableOriginalConstructor()
+            ->setMethods(array())
+            ->getMock();
+        $this->_storeManagerMock = $this->getMockBuilder('\Magento\Core\Model\StoreManagerInterface')
+            ->disableOriginalConstructor()
+            ->setMethods(array())
+            ->getMock();
+
+        $this->_configMock = $this->getMockBuilder('\Magento\Backend\App\ConfigInterface')
+            ->disableOriginalConstructor()
+            ->setMethods(array())
+            ->getMock();
 
         $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
         $this->_model = $helper->getObject('Magento\User\Model\User', array(
             'eventManager' => $eventManagerMock,
             'userData' => $this->_userData,
             'coreData' => $this->_coreData,
-            'sender' => $this->_senderMock,
             'context' => $this->_contextMock,
             'registry' => $coreRegistry,
             'resource' => $this->_resourceMock,
             'resourceCollection' => $this->_collectionMock,
             'validatorObjectFactory' => $objectFactoryMock,
             'roleFactory' => $roleFactoryMock,
-            'emailInfoFactory' => $emailFactoryMock,
-            'mailerFactory' => $mailerFactoryMock,
+            'transportBuilder' => $this->_transportBuilderMock,
+            'storeManager' => $this->_storeManagerMock,
+            'config' => $this->_configMock
         ));
     }
 
@@ -121,16 +155,118 @@ class UserTest extends \PHPUnit_Framework_TestCase
         $this->_model->setFirstname($firstName);
         $this->_model->setLastname($lastName);
 
-        $this->_senderMock->expects($this->once())
-            ->method('send')
-            ->with(
-                $this->equalTo($email),
-                $this->equalTo($firstName . ' ' . $lastName),
-                $this->equalTo(\Magento\User\Model\User::XML_PATH_RESET_PASSWORD_TEMPLATE),
-                $this->equalTo(\Magento\User\Model\User::XML_PATH_FORGOT_EMAIL_IDENTITY),
-                $this->equalTo(array('user' => $this->_model)),
-                $storeId
-            );
+        $this->_configMock
+            ->expects($this->at(0))
+            ->method('getValue')
+            ->with(\Magento\User\Model\User::XML_PATH_RESET_PASSWORD_TEMPLATE)
+            ->will($this->returnValue('templateId'));
+        $this->_configMock
+            ->expects($this->at(1))
+            ->method('getValue')
+            ->with(\Magento\User\Model\User::XML_PATH_FORGOT_EMAIL_IDENTITY)
+            ->will($this->returnValue('sender'));
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('setTemplateOptions')
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('setTemplateVars')
+            ->with(array('user' => $this->_model, 'store' => $this->_storetMock))
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('addTo')
+            ->with($this->equalTo($email), $this->equalTo($firstName . ' ' . $lastName))
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('setFrom')
+            ->with('sender')
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('setTemplateIdentifier')
+            ->with('templateId')
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('getTransport')
+            ->will($this->returnValue($this->_transportMock));
+        $this->_transportMock
+            ->expects($this->once())
+            ->method('sendMessage');
+
+        $this->_storeManagerMock
+            ->expects($this->once())
+            ->method('getStore')
+            ->with($storeId)
+            ->will($this->returnValue($this->_storetMock));
+
+
         $this->_model->sendPasswordResetNotificationEmail();
     }
+
+    public function testSendPasswordResetConfirmationEmail()
+    {
+        $storeId = 0;
+        $email = 'test@example.com';
+        $firstName = 'Foo';
+        $lastName = 'Bar';
+
+        $this->_model->setEmail($email);
+        $this->_model->setFirstname($firstName);
+        $this->_model->setLastname($lastName);
+
+        $this->_configMock
+            ->expects($this->at(0))
+            ->method('getValue')
+            ->with(\Magento\User\Model\User::XML_PATH_FORGOT_EMAIL_TEMPLATE)
+            ->will($this->returnValue('templateId'));
+        $this->_configMock
+            ->expects($this->at(1))
+            ->method('getValue')
+            ->with(\Magento\User\Model\User::XML_PATH_FORGOT_EMAIL_IDENTITY)
+            ->will($this->returnValue('sender'));
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('setTemplateOptions')
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('setTemplateVars')
+            ->with(array('user' => $this->_model, 'store' => $this->_storetMock))
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('addTo')
+            ->with($this->equalTo($email), $this->equalTo($firstName . ' ' . $lastName))
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('setFrom')
+            ->with('sender')
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('setTemplateIdentifier')
+            ->with('templateId')
+            ->will($this->returnSelf());
+        $this->_transportBuilderMock
+            ->expects($this->once())
+            ->method('getTransport')
+            ->will($this->returnValue($this->_transportMock));
+        $this->_transportMock
+            ->expects($this->once())
+            ->method('sendMessage');
+
+        $this->_storeManagerMock
+            ->expects($this->once())
+            ->method('getStore')
+            ->with($storeId)
+            ->will($this->returnValue($this->_storetMock));
+
+
+        $this->_model->sendPasswordResetConfirmationEmail();
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/View/Asset/PreProcessor/CompositeTest.php b/dev/tests/unit/testsuite/Magento/View/Asset/PreProcessor/CompositeTest.php
index cf9f2360cbe..02374e7f53a 100644
--- a/dev/tests/unit/testsuite/Magento/View/Asset/PreProcessor/CompositeTest.php
+++ b/dev/tests/unit/testsuite/Magento/View/Asset/PreProcessor/CompositeTest.php
@@ -40,7 +40,7 @@ class CompositeTest extends \PHPUnit_Framework_TestCase
     protected $preProcessorFactoryMock;
 
     /**
-     * @var array
+     * @var \PHPUnit_Framework_MockObject_MockObject[]
      */
     protected $callMap = [];
 
@@ -51,13 +51,12 @@ class CompositeTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * @param array $params
+     * @param array $extension
      * @param array $preProcessorsConfig
      * @param array $createMap
-     * @param string $expectedResult
      * @dataProvider processDataProvider
      */
-    public function testProcess($params, $preProcessorsConfig, $createMap, $expectedResult)
+    public function testProcess($extension, $preProcessorsConfig, $createMap)
     {
         $this->composite = $this->objectManagerHelper->getObject(
             'Magento\View\Asset\PreProcessor\Composite',
@@ -67,32 +66,34 @@ class CompositeTest extends \PHPUnit_Framework_TestCase
             ]
         );
 
-        $targetDir = $this->getMock($params['targetDirectory'], array(), array(), '', false);
+        $publisherFile = $this->getMock('Magento\View\Publisher\CssFile', [], [], '', false);
+        $publisherFile->expects($this->once())
+            ->method('getExtension')
+            ->will($this->returnValue($extension));
 
-        foreach ($createMap as $className) {
+        $targetDir = $this->getMock('Magento\Filesystem\Directory\WriteInterface', array(), array(), '', false);
+
+        foreach ($createMap as $className => $isExpected) {
             $this->callMap[$className] = $this->getMock($className, array('process'), array(), '', false);
-            $this->callMap[$className]->expects($this->once())
-                ->method('process')
-                ->with(
-                    $this->equalTo($params['filePath']),
-                    $this->equalTo($params['params']),
-                    $this->equalTo($targetDir),
-                    $this->equalTo($params['sourcePath'])
-                )
-                ->will($this->returnValue($expectedResult));
+
+            if ($isExpected === 'expected') {
+                $this->callMap[$className]->expects($this->once())
+                    ->method('process')
+                    ->with(
+                        $this->equalTo($publisherFile),
+                        $this->equalTo($targetDir)
+                    )
+                    ->will($this->returnValue($publisherFile));
+            } else {
+                $this->callMap[$className]->expects($this->never())->method('process');
+            }
         }
 
         $this->preProcessorFactoryMock->expects($this->any())
             ->method('create')
             ->will($this->returnCallback(array($this, 'createProcessor')));
 
-        $result = $this->composite->process(
-            $params['filePath'],
-            $params['params'],
-            $targetDir,
-            $params['sourcePath']
-        );
-        $this->assertEquals($expectedResult, $result);
+        $this->assertEquals($publisherFile, $this->composite->process($publisherFile, $targetDir));
     }
 
     /**
@@ -113,12 +114,7 @@ class CompositeTest extends \PHPUnit_Framework_TestCase
     {
         return [
             'list of processors for css' => [
-                'params' => [
-                    'filePath' => '/some/file/path.css',
-                    'params' => ['theme' => 'some_theme', 'area' => 'frontend'],
-                    'targetDirectory' => 'Magento\Filesystem\Directory\WriteInterface',
-                    'sourcePath' => 'result_source_path'
-                ],
+                'extension' => 'css',
                 'preProcessorsConfig' => [
                     'css_preprocessor' => [
                         'class' => 'Magento\Css\PreProcessor\Composite',
@@ -130,18 +126,12 @@ class CompositeTest extends \PHPUnit_Framework_TestCase
                     ],
                 ],
                 'createMap' => [
-                    'Magento\Css\PreProcessor\Composite',
-                    'Magento\Css\PreProcessor\Composite2'
+                    'Magento\Css\PreProcessor\Composite' => 'expected',
+                    'Magento\Css\PreProcessor\Composite2' => 'expected'
                 ],
-                'expectedResult' => 'result_source_path'
             ],
             'one processor for css' => [
-                'params' => [
-                    'filePath' => '/some/file/path_one.css',
-                    'params' => ['theme' => 'some_theme', 'area' => 'frontend'],
-                    'targetDirectory' => 'Magento\Filesystem\Directory\WriteInterface',
-                    'sourcePath' => 'result_source_path_one'
-                ],
+                'extension' => 'css',
                 'preProcessorsConfig' => [
                     'css_preprocessor' => [
                         'class' => 'Magento\Css\PreProcessor\Composite',
@@ -149,39 +139,27 @@ class CompositeTest extends \PHPUnit_Framework_TestCase
                     ],
                 ],
                 'createMap' => [
-                    'Magento\Css\PreProcessor\Composite',
+                    'Magento\Css\PreProcessor\Composite' => 'expected',
                 ],
-                'expectedResult' => 'result_source_path_one'
             ],
-            'one processor for css with no result' => [
-                'params' => [
-                    'filePath' => '/some/file/path_one.css',
-                    'params' => ['theme' => 'some_theme', 'area' => 'frontend'],
-                    'targetDirectory' => 'Magento\Filesystem\Directory\WriteInterface',
-                    'sourcePath' => null
-                ],
+            'no processors' => [
+                'extension' => 'css',
+                'preProcessorsConfig' => [],
+                'createMap' => [],
+            ],
+            'one processor for xyz' => [
+                'extension' => 'css',
                 'preProcessorsConfig' => [
                     'css_preprocessor' => [
                         'class' => 'Magento\Css\PreProcessor\Composite',
-                        'asset_type' => 'css'
+                        'asset_type' => 'xyz'
                     ],
                 ],
                 'createMap' => [
-                    'Magento\Css\PreProcessor\Composite',
-                ],
-                'expectedResult' => null
-            ],
-            'no processors' => [
-                'params' => [
-                    'filePath' => '/some/file/path.css',
-                    'params' => ['theme' => 'some_theme', 'area' => 'frontend'],
-                    'targetDirectory' => 'Magento\Filesystem\Directory\WriteInterface',
-                    'sourcePath' => null
+                    'Magento\Css\PreProcessor\Composite' => 'not expected',
                 ],
-                'preProcessorsConfig' => [],
-                'createMap' => [],
-                'expectedResult' => null
             ],
+
         ];
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/View/Layout/File/FileList/FactoryTest.php b/dev/tests/unit/testsuite/Magento/View/Layout/File/FileList/FactoryTest.php
index c6042c0391e..e61ae7bb19f 100644
--- a/dev/tests/unit/testsuite/Magento/View/Layout/File/FileList/FactoryTest.php
+++ b/dev/tests/unit/testsuite/Magento/View/Layout/File/FileList/FactoryTest.php
@@ -29,30 +29,53 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
     /**
      * @var \Magento\View\Layout\File\FileList\Factory
      */
-    private $_model;
+    protected $model;
 
     /**
      * @var \PHPUnit_Framework_MockObject_MockObject
      */
-    private $_objectManager;
+    protected $objectManager;
 
     protected function setUp()
     {
-        $this->_objectManager = $this->getMockForAbstractClass('Magento\ObjectManager');
-        $this->_model = new \Magento\View\Layout\File\FileList\Factory($this->_objectManager);
+        $this->objectManager = $this->getMockForAbstractClass('Magento\ObjectManager');
+        $this->model = new \Magento\View\Layout\File\FileList\Factory($this->objectManager);
     }
 
     public function testCreate()
     {
         $helperObjectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $collator = $helperObjectManager->getObject(\Magento\View\Layout\File\FileList\Factory::FILE_LIST_COLLATOR);
         $list = $helperObjectManager->getObject('Magento\View\Layout\File\FileList');
 
-        $this->_objectManager
+        $this->objectManager
+            ->expects($this->once())
+            ->method('get')
+            ->with($this->equalTo(\Magento\View\Layout\File\FileList\Factory::FILE_LIST_COLLATOR))
+            ->will($this->returnValue($collator));
+
+        $this->objectManager
             ->expects($this->once())
             ->method('create')
-            ->with('Magento\View\Layout\File\FileList')
-            ->will($this->returnValue($list))
-        ;
-        $this->assertSame($list, $this->_model->create());
+            ->with($this->equalTo('Magento\View\Layout\File\FileList'), $this->equalTo(array('collator' => $collator)))
+            ->will($this->returnValue($list));
+        $this->assertSame($list, $this->model->create());
+    }
+
+    /**
+     * @expectedException UnexpectedValueException
+     * @expectedExceptionMessage Magento\View\Layout\File\FileList\Collator has to implement the collate interface.
+     */
+    public function testCreateException()
+    {
+        $collator = new \stdClass();
+
+        $this->objectManager
+            ->expects($this->once())
+            ->method('get')
+            ->with($this->equalTo(\Magento\View\Layout\File\FileList\Factory::FILE_LIST_COLLATOR))
+            ->will($this->returnValue($collator));
+
+        $this->model->create();
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/View/Publisher/CssFileTest.php b/dev/tests/unit/testsuite/Magento/View/Publisher/CssFileTest.php
new file mode 100644
index 00000000000..17db492e125
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/View/Publisher/CssFileTest.php
@@ -0,0 +1,276 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\View\Publisher;
+
+use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
+
+class CssFileTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\View\Publisher\CssFile */
+    protected $cssFile;
+
+    /** @var ObjectManagerHelper */
+    protected $objectManagerHelper;
+
+    /** @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */
+    protected $filesystemMock;
+
+    /** @var \Magento\View\Service|\PHPUnit_Framework_MockObject_MockObject */
+    protected $serviceMock;
+
+    /** @var \Magento\Module\Dir\Reader|\PHPUnit_Framework_MockObject_MockObject */
+    protected $readerMock;
+
+    /** @var \Magento\View\FileSystem|\PHPUnit_Framework_MockObject_MockObject */
+    protected $viewFileSystem;
+
+    /**
+     * @var \Magento\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $rootDirectory;
+
+    /**
+     * @var string
+     */
+    protected $libDir = '/some/pub/lib/dir';
+
+    /**
+     * @var string
+     */
+    protected $viewStaticDir = '/some/view/static/dir';
+
+    /**
+     * @var string
+     */
+    protected $themeDir = '/some/theme/dir';
+
+    /**
+     * @param string $filePath
+     * @param bool $allowDuplication
+     * @param array $viewParams
+     * @param null|string $sourcePath
+     * @param bool $developerModel
+     */
+    protected function getModelMock(
+        $filePath,
+        $allowDuplication,
+        $viewParams,
+        $sourcePath = null,
+        $developerModel = false
+    ) {
+        $this->rootDirectory = $this->getMock('Magento\Filesystem\Directory\WriteInterface');
+
+        $this->filesystemMock = $this->getMock('Magento\App\Filesystem', [], [], '', false);
+        $this->filesystemMock->expects($this->once())
+            ->method('getDirectoryWrite')
+            ->with($this->equalTo(\Magento\App\Filesystem::ROOT_DIR))
+            ->will($this->returnValue($this->rootDirectory));
+        $this->filesystemMock->expects($this->any())
+            ->method('getPath')
+            ->with($this->anything())
+            ->will($this->returnCallback(array($this, 'getPathCallback')));
+        $this->serviceMock = $this->getMock('Magento\View\Service', [], [], '', false);
+        if ($developerModel) {
+            $this->serviceMock->expects($this->once())
+                ->method('getAppMode')
+                ->will($this->returnValue('developer'));
+        }
+
+        $this->readerMock = $this->getMock('Magento\Module\Dir\Reader', [], [], '', false);
+        $this->viewFileSystem = $this->getMock('Magento\View\FileSystem', [], [], '', false);
+        $this->viewFileSystem->expects($this->any())
+            ->method('getAppMode')
+            ->will($this->returnValue(\Magento\App\State::MODE_DEVELOPER));
+
+        if ($sourcePath) {
+            $this->rootDirectory->expects($this->any())
+                ->method('getRelativePath')
+                ->with($sourcePath)
+                ->will($this->returnValue('related\\' . $sourcePath));
+            $this->rootDirectory->expects($this->any())
+                ->method('isExist')
+                ->with('related\\' . $sourcePath)
+                ->will($this->returnValue(true));
+        }
+
+        $this->objectManagerHelper = new ObjectManagerHelper($this);
+        $this->cssFile = $this->objectManagerHelper->getObject(
+            'Magento\View\Publisher\CssFile',
+            [
+                'filesystem' => $this->filesystemMock,
+                'viewService' => $this->serviceMock,
+                'modulesReader' => $this->readerMock,
+                'viewFileSystem' => $this->viewFileSystem,
+                'filePath' => $filePath,
+                'allowDuplication' => $allowDuplication,
+                'viewParams' => $viewParams,
+                'sourcePath' => $sourcePath
+            ]
+        );
+    }
+
+    /**
+     * @param string $param
+     * @return string
+     * @throws \UnexpectedValueException
+     */
+    public function getPathCallback($param)
+    {
+        switch ($param) {
+            case \Magento\App\Filesystem::PUB_LIB_DIR:
+                return $this->libDir;
+            case \Magento\App\Filesystem::STATIC_VIEW_DIR:
+                return $this->viewStaticDir;
+            case \Magento\App\Filesystem::THEMES_DIR:
+                return $this->themeDir;
+            default:
+                throw new \UnexpectedValueException('Path callback received wrong value: ' . $param);
+        }
+    }
+
+    /**
+     * @param null|string $sourcePath
+     * @param bool $expected
+     * @param bool $developerModel
+     * @internal param null|string $sourceFile
+     * @dataProvider isPublicationAllowedDataProvider
+     */
+    public function testIsPublicationAllowed($sourcePath, $expected, $developerModel)
+    {
+        $filePath = 'some/css/path';
+        $this->getModelMock($filePath, true, ['some', 'array'], $sourcePath, $developerModel);
+        $this->assertSame($expected, $this->cssFile->isPublicationAllowed());
+    }
+
+    /**
+     * @return array
+     */
+    public function isPublicationAllowedDataProvider()
+    {
+        return [
+            [null, true, false],
+            ['some/interesting/path/to/file', true, false],
+            ['some\interesting\path\to\file', true, false],
+            [$this->libDir . '/path/to/file', false, false],
+            [$this->libDir . '\path\to\file', false, false],
+            [$this->viewStaticDir . '\path\to\file', false, false],
+            [$this->viewStaticDir . '/path/to/file', false, false],
+            [$this->themeDir . '/path/to/file', true, false],
+            [$this->themeDir . '\path\to\file', true, false],
+            [$this->libDir . '/path/to/file', false, false],
+            [$this->libDir . '\path\to\file', false, false],
+            [$this->viewStaticDir . '\path\to\file', true, true],
+            [$this->viewStaticDir . '/path/to/file', true, true],
+        ];
+    }
+
+    /**
+     * @param string $filePath
+     * @param bool $allowDuplication
+     * @param array $viewParams
+     * @param string|null $sourcePath
+     * @param string $expected
+     * @dataProvider buildUniquePathDataProvider
+     */
+    public function testBuildUniquePath($filePath, $allowDuplication, $viewParams, $sourcePath, $expected)
+    {
+        $this->getModelMock($filePath, $allowDuplication, $viewParams, $sourcePath);
+        $this->assertSame($expected, $this->cssFile->buildUniquePath());
+    }
+
+    /**
+     * @return array
+     */
+    public function buildUniquePathDataProvider()
+    {
+        $themModelWithPath = $this->getMock('Magento\View\Design\ThemeInterface', [], [], '', false);
+        $themModelWithPath->expects($this->any())->method('getThemePath')->will($this->returnValue('theme/path'));
+        $themModelWithId = $this->getMock('Magento\View\Design\ThemeInterface', [], [], '', false);
+        $themModelWithId->expects($this->any())->method('getId')->will($this->returnValue(11));
+        return [
+            'theme with path' => [
+                'filePath' => 'some/css/path',
+                'allowDuplication' => true,
+                'viewParams' => [
+                    'themeModel' => $themModelWithPath,
+                    'area' => 'frontend',
+                    'locale' => 'en_US',
+                    'module' => 'some_module',
+                ],
+                'sourcePath' => null,
+                'expected' => 'frontend/theme/path/en_US/some_module/some/css/path'
+            ],
+            'theme with id' => [
+                'filePath' => 'some/css/path2',
+                'allowDuplication' => true,
+                'viewParams' => [
+                    'themeModel' => $themModelWithId,
+                    'area' => 'backend',
+                    'locale' => 'en_EN',
+                    'module' => 'some_other_module',
+                ],
+                'sourcePath' => null,
+                'expected' => 'backend/_theme11/en_EN/some_other_module/some/css/path2'
+            ],
+            'theme without any data' => [
+                'filePath' => 'some/css/path3',
+                'allowDuplication' => true,
+                'viewParams' => [
+                    'themeModel' => $this->getMock('Magento\View\Design\ThemeInterface', [], [], '', false),
+                    'locale' => 'fr_FR',
+                    'area' => 'some_area',
+                    'module' => null,
+                ],
+                'sourcePath' => null,
+                'expected' => 'some_area/_view/fr_FR/some/css/path3'
+            ],
+            'no duplication modular file' => [
+                'filePath' => 'some/css/path4',
+                'allowDuplication' => false,
+                'viewParams' => [
+                    'themeModel' => $this->getMock('Magento\View\Design\ThemeInterface', [], [], '', false),
+                    'locale' => 'fr_FR',
+                    'area' => 'some_area',
+                    'module' => 'My_Module',
+                ],
+                'sourcePath' => 'custom_module_dir/some/css/path2',
+                'expected' => 'some_area/_view/fr_FR/My_Module/some/css/path4'
+            ],
+            'no duplication theme file' => [
+                'filePath' => 'some/css/path5',
+                'allowDuplication' => false,
+                'viewParams' => [
+                    'themeModel' => $this->getMock('Magento\View\Design\ThemeInterface', [], [], '', false),
+                    'locale' => 'fr_FR',
+                    'area' => 'some_area',
+                    'module' => 'My_Module',
+                ],
+                'sourcePath' => $this->themeDir . '/custom_module_dir/some/css/path5',
+                'expected' => 'some_area/_view/fr_FR/My_Module/some/css/path5'
+            ],
+        ];
+    }
+
+}
diff --git a/dev/tests/unit/testsuite/Magento/View/Publisher/FileAbstractTest.php b/dev/tests/unit/testsuite/Magento/View/Publisher/FileAbstractTest.php
new file mode 100644
index 00000000000..09a82c4360c
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/View/Publisher/FileAbstractTest.php
@@ -0,0 +1,285 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\View\Publisher;
+
+class FileAbstractTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\View\Publisher\FileAbstract|\PHPUnit_Framework_MockObject_MockObject */
+    protected $fileAbstract;
+
+    /** @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */
+    protected $filesystemMock;
+
+    /** @var \Magento\View\Service|\PHPUnit_Framework_MockObject_MockObject */
+    protected $serviceMock;
+
+    /** @var \Magento\Module\Dir\Reader|\PHPUnit_Framework_MockObject_MockObject */
+    protected $readerMock;
+
+    /** @var \Magento\View\FileSystem|\PHPUnit_Framework_MockObject_MockObject */
+    protected $viewFileSystem;
+
+    /**
+     * @var \Magento\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $rootDirectory;
+
+    /**
+     * @param string $filePath
+     * @param array $viewParams
+     * @param null|string $sourcePath
+     * @param null|string $fallback
+     */
+    protected function initModelMock($filePath, $viewParams, $sourcePath = null, $fallback = null)
+    {
+        $this->rootDirectory = $this->getMock('Magento\Filesystem\Directory\WriteInterface');
+
+        $this->filesystemMock = $this->getMock('Magento\App\Filesystem', [], [], '', false);
+        $this->filesystemMock->expects($this->once())
+            ->method('getDirectoryWrite')
+            ->with($this->equalTo(\Magento\App\Filesystem::ROOT_DIR))
+            ->will($this->returnValue($this->rootDirectory));
+        $this->serviceMock = $this->getMock('Magento\View\Service', [], [], '', false);
+        $this->readerMock = $this->getMock('Magento\Module\Dir\Reader', [], [], '', false);
+        $this->viewFileSystem = $this->getMock('Magento\View\FileSystem', [], [], '', false);
+        if ($fallback) {
+            $this->viewFileSystem->expects($this->once())
+                ->method('getViewFile')
+                ->with($this->equalTo($filePath), $this->equalTo($viewParams))
+                ->will($this->returnValue('fallback\\' . $fallback));
+
+            $this->rootDirectory->expects($this->once())
+                ->method('getRelativePath')
+                ->with('fallback\\' . $fallback)
+                ->will($this->returnValue('related\\' . $fallback));
+        }
+
+        $this->fileAbstract = $this->getMockForAbstractClass(
+            'Magento\View\Publisher\FileAbstract',
+            [
+                'filesystem' => $this->filesystemMock,
+                'viewService' => $this->serviceMock,
+                'modulesReader' => $this->readerMock,
+                'viewFileSystem' => $this->viewFileSystem,
+                'filePath' => $filePath,
+                'allowDuplication' => true,
+                'viewParams' => $viewParams,
+                'sourcePath' => $sourcePath
+            ]
+        );
+    }
+
+    /**
+     * @param string $filePath
+     * @param string $expected
+     * @dataProvider getExtensionDataProvider
+     */
+    public function testGetExtension($filePath, $expected)
+    {
+        $this->initModelMock($filePath, ['some', 'array']);
+        $this->assertSame($expected, $this->fileAbstract->getExtension());
+    }
+
+    /**
+     * @return array
+     */
+    public function getExtensionDataProvider()
+    {
+        return [
+            ['some\path\file.css', 'css'],
+            ['some\path\noextension', '']
+        ];
+    }
+
+    /**
+     * @param string $filePath
+     * @param bool $isExist
+     * @param null|string $sourcePath
+     * @param string|null $fallback
+     * @param bool $expected
+     * @internal param null|string $sourceFile
+     * @dataProvider isSourceFileExistsDataProvider
+     */
+    public function testIsSourceFileExists($filePath, $isExist, $sourcePath, $fallback, $expected)
+    {
+        $this->initModelMock($filePath, ['some', 'array'], $sourcePath, $fallback);
+        if ($fallback) {
+            $this->rootDirectory->expects($this->once())
+                ->method('isExist')
+                ->with('related\\' . $fallback)
+                ->will($this->returnValue($isExist));
+        }
+
+        $this->assertSame($expected, $this->fileAbstract->isSourceFileExists());
+    }
+
+    /**
+     * @return array
+     */
+    public function isSourceFileExistsDataProvider()
+    {
+        return [
+            [
+                'filePath' => 'some\file',
+                'isExist' => false,
+                'sourcePath' => null,
+                'fallback' => null,
+                'expectedResult' => false
+            ],
+            [
+                'filePath' => 'some\file2',
+                'isExist' => false,
+                'sourcePath' => 'some\sourcePath',
+                'fallback' => null,
+                'expectedResult' => false
+            ],
+            [
+                'filePath' => 'some\file2',
+                'isExist' => false,
+                'sourcePath' => null,
+                'fallback' => 'some\fallback\file',
+                'expectedResult' => false
+            ],
+            [
+                'filePath' => 'some\file2',
+                'isExist' => true,
+                'sourcePath' => null,
+                'fallback' => 'some\fallback\file',
+                'expectedResult' => true
+            ],
+        ];
+    }
+
+    public function testGetFilePath()
+    {
+        $filePath = 'test\me';
+        $this->initModelMock($filePath, ['some', 'array']);
+        $this->assertSame($filePath, $this->fileAbstract->getFilePath());
+    }
+
+    public function testGetViewParams()
+    {
+        $viewParams = ['some', 'array'];
+        $this->initModelMock('some\file', $viewParams);
+        $this->assertSame($viewParams, $this->fileAbstract->getViewParams());
+    }
+
+    public function testBuildPublicViewFilename()
+    {
+        $this->initModelMock('some\file', []);
+        $this->serviceMock->expects($this->once())
+            ->method('getPublicDir')->will($this->returnValue('/some/pub/dir'));
+
+        $this->fileAbstract->expects($this->once())
+            ->method('buildUniquePath')
+            ->will($this->returnValue('some/path/to/file'));
+        $this->assertSame('/some/pub/dir/some/path/to/file', $this->fileAbstract->buildPublicViewFilename());
+    }
+
+    /**
+     * @param string $filePath
+     * @param bool $isExist
+     * @param null|string $sourcePath
+     * @param string|null $fallback
+     * @param bool $expected
+     * @internal param null|string $sourceFile
+     * @dataProvider getSourcePathDataProvider
+     */
+    public function testGetSourcePath($filePath, $isExist, $sourcePath, $fallback, $expected)
+    {
+        $this->initModelMock($filePath, ['some', 'array'], $sourcePath, $fallback);
+        if ($fallback) {
+            $this->rootDirectory->expects($this->once())
+                ->method('isExist')
+                ->with('related\\' . $fallback)
+                ->will($this->returnValue($isExist));
+        }
+
+        $this->assertSame($expected, $this->fileAbstract->getSourcePath());
+    }
+
+    /**
+     * @return array
+     */
+    public function getSourcePathDataProvider()
+    {
+        return [
+            [
+                'filePath' => 'some\file',
+                'isExist' => false,
+                'sourcePath' => null,
+                'fallback' => null,
+                'expectedResult' => null
+            ],
+            [
+                'filePath' => 'some\file2',
+                'isExist' => false,
+                'sourcePath' => 'some\sourcePath',
+                'fallback' => null,
+                'expectedResult' => null
+            ],
+            [
+                'filePath' => 'some\file2',
+                'isExist' => false,
+                'sourcePath' => null,
+                'fallback' => 'some\fallback\file',
+                'expectedResult' => null
+            ],
+            [
+                'filePath' => 'some\file2',
+                'isExist' => true,
+                'sourcePath' => null,
+                'fallback' => 'some\fallback\file',
+                'expectedResult' => 'fallback\some\fallback\file'
+            ],
+        ];
+    }
+
+    /**
+     * @dataProvider sleepDataProvider
+     */
+    public function test__sleep($expected)
+    {
+        $this->initModelMock('some\file', []);
+        $this->assertEquals($expected, $this->fileAbstract->__sleep());
+    }
+
+    /**
+     * @return array
+     */
+    public function sleepDataProvider()
+    {
+        return [[[
+            'filePath',
+            'extension',
+            'viewParams',
+            'sourcePath',
+            'allowDuplication',
+            'isPublicationAllowed',
+            'isFallbackUsed',
+            'isSourcePathProvided'
+        ]]];
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/View/Publisher/FileFactoryTest.php b/dev/tests/unit/testsuite/Magento/View/Publisher/FileFactoryTest.php
new file mode 100644
index 00000000000..d6f0bb73b95
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/View/Publisher/FileFactoryTest.php
@@ -0,0 +1,125 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\View\Publisher;
+
+use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
+
+class FileFactoryTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\View\Publisher\FileFactory */
+    protected $fileFactory;
+
+    /** @var ObjectManagerHelper */
+    protected $objectManagerHelper;
+
+    /** @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject */
+    protected $objectManagerMock;
+
+    protected function setUp()
+    {
+        $this->objectManagerMock = $this->getMock('Magento\ObjectManager');
+
+        $this->objectManagerHelper = new ObjectManagerHelper($this);
+        $this->fileFactory = $this->objectManagerHelper->getObject(
+            'Magento\View\Publisher\FileFactory',
+            [
+                'objectManager' => $this->objectManagerMock
+            ]
+        );
+    }
+
+    /**
+     * @param string $filePath
+     * @param array $viewParams
+     * @param string|null $sourcePath
+     * @param string $expectedInstance
+     * @dataProvider createDataProvider
+     */
+    public function testCreate($filePath, $viewParams, $sourcePath, $expectedInstance)
+    {
+        $fileInstance = $this->getMock($expectedInstance, [], [], '', false);
+        $this->objectManagerMock->expects($this->once())
+            ->method('create')
+            ->with(
+                $this->equalTo($expectedInstance),
+                $this->equalTo(
+                    [
+                        'filePath'   => $filePath,
+                        'viewParams' => $viewParams,
+                        'sourcePath' => $sourcePath
+                    ]
+                )
+            )
+            ->will($this->returnValue($fileInstance));
+        $this->assertInstanceOf($expectedInstance, $this->fileFactory->create($filePath, $viewParams, $sourcePath));
+    }
+
+    /**
+     * @return array
+     */
+    public function createDataProvider()
+    {
+        return [
+            'css' => [
+                'some\file\path.css',
+                ['some', 'view', 'params'],
+                'some\source\path',
+                'Magento\View\Publisher\CssFile'
+            ],
+            'other' => [
+                'some\file\path.gif',
+                ['some', 'other', 'view', 'params'],
+                'some\other\source\path',
+                'Magento\View\Publisher\File'
+            ],
+        ];
+    }
+
+    /**
+     * @expectedException \UnexpectedValueException
+     * @expectedExceptionMessage stdClass has to implement the publisher file interface.
+     */
+    public function testCreateWrongInstance()
+    {
+        $filePath = 'something';
+        $viewParams = ['some', 'array'];
+        $fileInstance = new \stdClass();
+        $this->objectManagerMock->expects($this->once())
+            ->method('create')
+            ->with(
+                $this->equalTo('stdClass'),
+                $this->equalTo(
+                    [
+                        'filePath'   => $filePath,
+                        'viewParams' => $viewParams,
+                        'sourcePath' => null
+                    ]
+                )
+            )
+            ->will($this->returnValue($fileInstance));
+        $fileFactory = new FileFactory($this->objectManagerMock, 'stdClass');
+        $fileFactory->create($filePath, $viewParams);
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/View/Publisher/FileTest.php b/dev/tests/unit/testsuite/Magento/View/Publisher/FileTest.php
new file mode 100644
index 00000000000..016a1ac60a0
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/View/Publisher/FileTest.php
@@ -0,0 +1,261 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\View\Publisher;
+
+use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
+
+class FileTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\View\Publisher\File */
+    protected $file;
+
+    /** @var ObjectManagerHelper */
+    protected $objectManagerHelper;
+
+    /** @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */
+    protected $filesystemMock;
+
+    /** @var \Magento\View\Service|\PHPUnit_Framework_MockObject_MockObject */
+    protected $serviceMock;
+
+    /** @var \Magento\Module\Dir\Reader|\PHPUnit_Framework_MockObject_MockObject */
+    protected $readerMock;
+
+    /** @var \Magento\View\FileSystem|\PHPUnit_Framework_MockObject_MockObject */
+    protected $viewFileSystem;
+
+    /**
+     * @var \Magento\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $rootDirectory;
+
+    /**
+     * @var string
+     */
+    protected $libDir = '/some/pub/lib/dir';
+
+    /**
+     * @var string
+     */
+    protected $viewStaticDir = '/some/view/static/dir';
+
+    /**
+     * @var string
+     */
+    protected $themeDir = '/some/theme/dir';
+
+    /**
+     * @param string $filePath
+     * @param bool $allowDuplication
+     * @param array $viewParams
+     * @param null|string $sourcePath
+     */
+    protected function getModelMock($filePath, $allowDuplication, $viewParams, $sourcePath = null)
+    {
+        $this->rootDirectory = $this->getMock('Magento\Filesystem\Directory\WriteInterface');
+
+        $this->filesystemMock = $this->getMock('Magento\App\Filesystem', [], [], '', false);
+        $this->filesystemMock->expects($this->once())
+            ->method('getDirectoryWrite')
+            ->with($this->equalTo(\Magento\App\Filesystem::ROOT_DIR))
+            ->will($this->returnValue($this->rootDirectory));
+        $this->filesystemMock->expects($this->any())
+            ->method('getPath')
+            ->with($this->anything())
+            ->will($this->returnCallback(array($this, 'getPathCallback')));
+        $this->serviceMock = $this->getMock('Magento\View\Service', [], [], '', false);
+        $this->readerMock = $this->getMock('Magento\Module\Dir\Reader', [], [], '', false);
+        $this->viewFileSystem = $this->getMock('Magento\View\FileSystem', [], [], '', false);
+
+        if ($sourcePath) {
+            $this->rootDirectory->expects($this->any())
+                ->method('getRelativePath')
+                ->with($sourcePath)
+                ->will($this->returnValue('related\\' . $sourcePath));
+            $this->rootDirectory->expects($this->any())
+                ->method('isExist')
+                ->with('related\\' . $sourcePath)
+                ->will($this->returnValue(true));
+        }
+
+        $this->objectManagerHelper = new ObjectManagerHelper($this);
+        $this->file = $this->objectManagerHelper->getObject(
+            'Magento\View\Publisher\File',
+            [
+                'filesystem' => $this->filesystemMock,
+                'viewService' => $this->serviceMock,
+                'modulesReader' => $this->readerMock,
+                'viewFileSystem' => $this->viewFileSystem,
+                'filePath' => $filePath,
+                'allowDuplication' => $allowDuplication,
+                'viewParams' => $viewParams,
+                'sourcePath' => $sourcePath
+            ]
+        );
+    }
+
+    /**
+     * @param string $param
+     * @return string
+     * @throws \UnexpectedValueException
+     */
+    public function getPathCallback($param)
+    {
+        switch ($param) {
+            case \Magento\App\Filesystem::PUB_LIB_DIR:
+                return $this->libDir;
+            case \Magento\App\Filesystem::STATIC_VIEW_DIR:
+                return $this->viewStaticDir;
+            case \Magento\App\Filesystem::THEMES_DIR:
+                return $this->themeDir;
+            default:
+                throw new \UnexpectedValueException('Path callback received wrong value: ' . $param);
+        }
+    }
+
+    /**
+     * @param null|string $sourcePath
+     * @param bool $expected
+     * @internal param null|string $sourceFile
+     * @dataProvider isPublicationAllowedDataProvider
+     */
+    public function testIsPublicationAllowed($sourcePath, $expected)
+    {
+        $filePath = 'some/file/path';
+        $this->getModelMock($filePath, true, ['some', 'array'], $sourcePath);
+
+        $this->assertSame($expected, $this->file->isPublicationAllowed());
+    }
+
+    /**
+     * @return array
+     */
+    public function isPublicationAllowedDataProvider()
+    {
+        return [
+            [null, true],
+            ['some/interesting/path/to/file', true],
+            ['some\interesting\path\to\file', true],
+            [$this->libDir . '/path/to/file', false],
+            [$this->libDir . '\path\to\file', false],
+            [$this->viewStaticDir . '\path\to\file', false],
+            [$this->viewStaticDir . '/path/to/file', false],
+            [$this->themeDir . '/path/to/file', true],
+            [$this->themeDir . '\path\to\file', true],
+        ];
+    }
+
+    /**
+     * @param string $filePath
+     * @param bool $allowDuplication
+     * @param array $viewParams
+     * @param string|null $sourcePath
+     * @param string $expected
+     * @dataProvider buildUniquePathDataProvider
+     */
+    public function testBuildUniquePath($filePath, $allowDuplication, $viewParams, $sourcePath, $expected)
+    {
+        $this->getModelMock($filePath, $allowDuplication, $viewParams, $sourcePath);
+        if (!$allowDuplication && isset($viewParams['module'])) {
+            $this->readerMock->expects($this->once())
+                ->method('getModuleDir')
+                ->with($this->equalTo('theme'), $this->equalTo($viewParams['module']))
+                ->will($this->returnValue('custom_module_dir'));
+        }
+        $this->assertSame($expected, $this->file->buildUniquePath());
+    }
+
+    /**
+     * @return array
+     */
+    public function buildUniquePathDataProvider()
+    {
+        $themModelWithPath = $this->getMock('Magento\View\Design\ThemeInterface', [], [], '', false);
+        $themModelWithPath->expects($this->any())->method('getThemePath')->will($this->returnValue('theme/path'));
+        $themModelWithId = $this->getMock('Magento\View\Design\ThemeInterface', [], [], '', false);
+        $themModelWithId->expects($this->any())->method('getId')->will($this->returnValue(11));
+        return [
+            'theme with path' => [
+                'filePath' => 'some/file/path',
+                'allowDuplication' => true,
+                'viewParams' => [
+                    'themeModel' => $themModelWithPath,
+                    'area' => 'frontend',
+                    'locale' => 'en_US',
+                    'module' => 'some_module',
+                ],
+                'sourcePath' => null,
+                'expected' => 'frontend/theme/path/en_US/some_module/some/file/path'
+            ],
+            'theme with id' => [
+                'filePath' => 'some/file/path2',
+                'allowDuplication' => true,
+                'viewParams' => [
+                    'themeModel' => $themModelWithId,
+                    'area' => 'backend',
+                    'locale' => 'en_EN',
+                    'module' => 'some_other_module',
+                ],
+                'sourcePath' => null,
+                'expected' => 'backend/_theme11/en_EN/some_other_module/some/file/path2'
+            ],
+            'theme without any data' => [
+                'filePath' => 'some/file/path3',
+                'allowDuplication' => true,
+                'viewParams' => [
+                    'themeModel' => $this->getMock('Magento\View\Design\ThemeInterface', [], [], '', false),
+                    'locale' => 'fr_FR',
+                    'area' => 'some_area',
+                    'module' => null,
+                ],
+                'sourcePath' => null,
+                'expected' => 'some_area/_view/fr_FR/some/file/path3'
+            ],
+            'no duplication modular file' => [
+                'filePath' => 'some/file/path4',
+                'allowDuplication' => false,
+                'viewParams' => [
+                    'themeModel' => $this->getMock('Magento\View\Design\ThemeInterface', [], [], '', false),
+                    'locale' => 'fr_FR',
+                    'area' => 'some_area',
+                    'module' => 'My_Module',
+                ],
+                'sourcePath' => 'custom_module_dir/some/file/path2',
+                'expected' => '_module/My_Module/some/file/path2'
+            ],
+            'no duplication theme file' => [
+                'filePath' => 'some/file/path5',
+                'allowDuplication' => false,
+                'viewParams' => [
+                    'themeModel' => $this->getMock('Magento\View\Design\ThemeInterface', [], [], '', false),
+                    'locale' => 'fr_FR',
+                    'area' => 'some_area'
+                ],
+                'sourcePath' => $this->themeDir . '/custom_module_dir/some/file/path5',
+                'expected' => 'custom_module_dir/some/file/path5'
+            ],
+        ];
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/View/PublisherTest.php b/dev/tests/unit/testsuite/Magento/View/PublisherTest.php
new file mode 100644
index 00000000000..319d686fabf
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/View/PublisherTest.php
@@ -0,0 +1,349 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\View;
+
+use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
+
+class PublisherTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\View\Publisher */
+    protected $publisher;
+
+    /** @var ObjectManagerHelper */
+    protected $objectManagerHelper;
+
+    /** @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */
+    protected $filesystemMock;
+
+    /** @var \Magento\View\FileSystem|\PHPUnit_Framework_MockObject_MockObject */
+    protected $viewFileSystem;
+
+    /** @var \Magento\View\Asset\PreProcessor\PreProcessorInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $preProcessorMock;
+
+    /** @var \Magento\View\Publisher\FileFactory|\PHPUnit_Framework_MockObject_MockObject */
+    protected $fileFactoryMock;
+
+    /** @var \Magento\View\Publisher\FileInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $publisherFileMock;
+
+    /** @var \Magento\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $rootDirectory;
+
+    /** @var \Magento\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $tmpDirectory;
+
+    /** @var \Magento\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $pubDirectory;
+
+    protected function setUp()
+    {
+        $this->rootDirectory = $this->getMock('Magento\Filesystem\Directory\WriteInterface', [], [], '', false);
+        $this->tmpDirectory = $this->getMock('Magento\Filesystem\Directory\WriteInterface', [], [], '', false);
+        $this->pubDirectory = $this->getMock('Magento\Filesystem\Directory\WriteInterface', [], [], '', false);
+
+        $this->filesystemMock = $this->getMock('Magento\App\Filesystem', [], [], '', false);
+        $this->filesystemMock->expects($this->any())
+            ->method('getDirectoryWrite')
+            ->will($this->returnCallback(array($this, 'getDirectoryWriteCallback')));
+
+        $this->viewFileSystem = $this->getMock('Magento\View\FileSystem', [], [], '', false);
+        $this->preProcessorMock = $this->getMock('Magento\View\Asset\PreProcessor\PreProcessorInterface');
+        $this->fileFactoryMock = $this->getMock('Magento\View\Publisher\FileFactory', [], [], '', false);
+        $this->publisherFileMock = $this->getMock('Magento\View\Publisher\FileInterface', [], [], '', false);
+        $this->objectManagerHelper = new ObjectManagerHelper($this);
+        $this->publisher = $this->objectManagerHelper->getObject(
+            'Magento\View\Publisher',
+            [
+                'filesystem' => $this->filesystemMock,
+                'viewFileSystem' => $this->viewFileSystem,
+                'preProcessor' => $this->preProcessorMock,
+                'fileFactory' => $this->fileFactoryMock
+            ]
+        );
+    }
+
+    /**
+     * @param string $param
+     * @return \Magento\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject
+     * @throws \UnexpectedValueException
+     */
+    public function getDirectoryWriteCallback($param)
+    {
+        switch ($param) {
+            case \Magento\App\Filesystem::ROOT_DIR:
+                return $this->rootDirectory;
+            case \Magento\App\Filesystem::VAR_DIR:
+                return $this->tmpDirectory;
+            case \Magento\App\Filesystem::STATIC_VIEW_DIR:
+                return $this->pubDirectory;
+            default:
+                throw new \UnexpectedValueException('Directory write callback received wrong value: ' . $param);
+        }
+    }
+
+    public function testGetPublicFilePathNotAllowedExtension()
+    {
+        $filePath = 'some/file/path.php';
+        $params = ['some', 'array'];
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('getExtension')
+            ->will($this->returnValue('php'));
+
+        $this->fileFactoryMock->expects($this->once())
+            ->method('create')
+            ->with($this->equalTo($filePath), $this->equalTo($params))
+            ->will($this->returnValue($this->publisherFileMock));
+
+        $this->assertSame(null, $this->publisher->getPublicFilePath($filePath, $params));
+    }
+
+    /**
+     * @expectedException \Magento\Exception
+     * @expectedExceptionMessage Unable to locate theme file 'some/file/path'.
+     */
+    public function testGetPublicFilePathException()
+    {
+        $filePath = 'some/file/path';
+        $params = ['some', 'array2'];
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('getExtension')
+            ->will($this->returnValue('css'));
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('isSourceFileExists')
+            ->will($this->returnValue(false));
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('getFilePath')
+            ->will($this->returnValue($filePath));
+
+        $this->prepareCommonMocks($filePath, $params);
+
+        $this->publisher->getPublicFilePath($filePath, $params);
+    }
+
+    public function testGetPublicFilePathPublicationNotAllowed()
+    {
+        $filePath = 'some/file/path.css';
+        $params = ['some', 'array3'];
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('getExtension')
+            ->will($this->returnValue('css'));
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('isSourceFileExists')
+            ->will($this->returnValue(true));
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('isPublicationAllowed')
+            ->will($this->returnValue(false));
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('getSourcePath')
+            ->will($this->returnValue('some/source/path.css'));
+
+        $this->prepareCommonMocks($filePath, $params);
+
+        $this->assertSame('some/source/path.css', $this->publisher->getPublicFilePath($filePath, $params));
+    }
+
+    /**
+     * @param string[] $testConfig
+     * @dataProvider getPublicFilePathDataProvider
+     */
+    public function testGetPublicFilePath($testConfig)
+    {
+        $filePath = 'some/file/path.css';
+        $params = ['some', 'array4'];
+        $sourcePath = 'some/source/path.css';
+        $result = $testConfig['result'];
+        $timeSource = $testConfig['timeSource'];
+        $timeTarget = $testConfig['timeTarget'];
+        $isExistsTarget = $testConfig['isExistsTarget'];
+        $shouldBeUpdated = $testConfig['shouldBeUpdated'];
+        $isFile = $testConfig['isFile'];
+        $isDirectory = $testConfig['isDirectory'];
+
+        $this->prepareCommonMocks($filePath, $params);
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('getExtension')
+            ->will($this->returnValue('css'));
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('isSourceFileExists')
+            ->will($this->returnValue(true));
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('isPublicationAllowed')
+            ->will($this->returnValue(true));
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('getSourcePath')
+            ->will($this->returnValue($sourcePath));
+
+        $this->publisherFileMock->expects($this->once())
+            ->method('buildPublicViewFilename')
+            ->will($this->returnValue($result));
+
+        $uniquePath = 'unique\\' . $filePath;
+        $this->publisherFileMock->expects($this->once())
+            ->method('buildUniquePath')
+            ->will($this->returnValue($uniquePath));
+
+        $relativePath = 'relative\\' . $sourcePath;
+        $this->rootDirectory->expects($this->once())
+            ->method('getRelativePath')
+            ->with($this->equalTo($sourcePath))
+            ->will($this->returnValue($relativePath));
+
+        $this->rootDirectory->expects($this->once())
+            ->method('stat')
+            ->with($this->equalTo($relativePath))
+            ->will($this->returnValue($timeSource));
+
+        $this->pubDirectory->expects($this->once())
+            ->method('isExist')
+            ->with($this->equalTo($uniquePath))
+            ->will($this->returnValue($isExistsTarget));
+
+        if ($isExistsTarget) {
+            $this->pubDirectory->expects($this->once())
+                ->method('stat')
+                ->with($this->equalTo($uniquePath))
+                ->will($this->returnValue($timeTarget));
+        }
+
+        if ($shouldBeUpdated) {
+            if ($isFile) {
+                $this->rootDirectory->expects($this->once())
+                    ->method('isFile')
+                    ->with($this->equalTo($relativePath))
+                    ->will($this->returnValue($isFile));
+                $this->rootDirectory->expects($this->once())
+                    ->method('copyFile')
+                    ->with(
+                        $this->equalTo($relativePath),
+                        $this->equalTo($uniquePath),
+                        $this->equalTo($this->pubDirectory)
+                    )
+                    ->will($this->returnSelf());
+                $this->pubDirectory->expects($this->once())
+                    ->method('touch')
+                    ->with($this->equalTo($uniquePath), $this->equalTo($timeSource['mtime']))
+                    ->will($this->returnSelf());
+            } elseif (!$isDirectory) {
+                $this->pubDirectory->expects($this->once())
+                    ->method('isDirectory')
+                    ->with($this->equalTo($uniquePath))
+                    ->will($this->returnValue(false));
+                $this->pubDirectory->expects($this->once())
+                    ->method('create')
+                    ->with($this->equalTo($uniquePath))
+                    ->will($this->returnSelf());
+            }
+        }
+        $this->viewFileSystem->expects($this->once())
+            ->method('notifyViewFileLocationChanged')
+            ->with($this->equalTo($this->publisherFileMock))
+            ->will($this->returnSelf());
+
+        $this->assertSame($result, $this->publisher->getPublicFilePath($filePath, $params));
+    }
+
+    /**
+     * @return array
+     */
+    public function getPublicFilePathDataProvider()
+    {
+        return [
+            'file that should be published mtime' => [
+                [
+                    'isExistsTarget' => true,
+                    'timeSource' => ['mtime' => 121],
+                    'timeTarget' => ['mtime' => 111],
+                    'shouldBeUpdated' => true,
+                    'isFile' => true,
+                    'isDirectory' => false,
+                    'result' => 'some/file/path.css',
+                ],
+            ],
+            'file that should be published not exist' => [
+                [
+                    'isExistsTarget' => false,
+                    'timeSource' => ['mtime' => 111],
+                    'timeTarget' => ['mtime' => 111],
+                    'shouldBeUpdated' => false,
+                    'isFile' => false,
+                    'isDirectory' => false,
+                    'result' => 'some/file/path.img',
+                ],
+            ],
+            'dir that should be published' => [
+                [
+                    'isExistsTarget' => true,
+                    'timeSource' => ['mtime' => 121],
+                    'timeTarget' => ['mtime' => 111],
+                    'shouldBeUpdated' => true,
+                    'isFile' => false,
+                    'isDirectory' => true,
+                    'result' => 'some/dir',
+                ],
+            ],
+            'not dir not a file' => [
+                [
+                    'isExistsTarget' => true,
+                    'timeSource' => ['mtime' => 121],
+                    'timeTarget' => ['mtime' => 111],
+                    'shouldBeUpdated' => true,
+                    'isFile' => false,
+                    'isDirectory' => false,
+                    'result' => 'some/interesting/path',
+                ],
+            ],
+        ];
+    }
+
+    /**
+     * @param string $filePath
+     * @param array $params
+     */
+    protected function prepareCommonMocks($filePath, $params)
+    {
+        $this->fileFactoryMock->expects($this->once())
+            ->method('create')
+            ->with($this->equalTo($filePath), $this->equalTo($params))
+            ->will($this->returnValue($this->publisherFileMock));
+
+        $this->preProcessorMock->expects($this->once())
+            ->method('process')
+            ->with($this->equalTo($this->publisherFileMock), $this->equalTo($this->tmpDirectory))
+            ->will($this->returnValue($this->publisherFileMock));
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Wishlist/Block/Item/ConfigureTest.php b/dev/tests/unit/testsuite/Magento/Wishlist/Block/Item/ConfigureTest.php
index bc81c5c10e5..d93cd9c693d 100644
--- a/dev/tests/unit/testsuite/Magento/Wishlist/Block/Item/ConfigureTest.php
+++ b/dev/tests/unit/testsuite/Magento/Wishlist/Block/Item/ConfigureTest.php
@@ -58,7 +58,7 @@ class ConfigureTest extends \PHPUnit_Framework_TestCase
         $this->_mockContext = $this->getMockBuilder('Magento\View\Element\Template\Context')
             ->disableOriginalConstructor()
             ->getMock();
-        $this->_mockRegistry = $this->getMockBuilder('Magento\Core\Model\Registry')
+        $this->_mockRegistry = $this->getMockBuilder('Magento\Registry')
             ->disableOriginalConstructor()
             ->getMock();
 
diff --git a/dev/tests/unit/testsuite/Magento/Wishlist/Controller/IndexTest.php b/dev/tests/unit/testsuite/Magento/Wishlist/Controller/IndexTest.php
index ad2d62a1ff9..1436b776955 100644
--- a/dev/tests/unit/testsuite/Magento/Wishlist/Controller/IndexTest.php
+++ b/dev/tests/unit/testsuite/Magento/Wishlist/Controller/IndexTest.php
@@ -139,7 +139,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase
 
         $wishlistModel = $this->getMock('\Magento\Wishlist\Model\Wishlist', [], [], '', false);
 
-        $coreRegistry = $this->getMock('\Magento\Core\Model\Registry', ['registry'], [], '', false);
+        $coreRegistry = $this->getMock('\Magento\Registry', ['registry'], [], '', false);
         $coreRegistry->expects($this->once())->method('registry')->will($this->returnValue($wishlistModel));
 
         $messageManager = $this->getMock('\Magento\Message\Manager', [], [], '', false);
diff --git a/dev/tools/Magento/Tools/I18n/Code/Dictionary/Phrase.php b/dev/tools/Magento/Tools/I18n/Code/Dictionary/Phrase.php
index d852dcbc3be..914198e4ec1 100644
--- a/dev/tools/Magento/Tools/I18n/Code/Dictionary/Phrase.php
+++ b/dev/tools/Magento/Tools/I18n/Code/Dictionary/Phrase.php
@@ -29,6 +29,20 @@ namespace Magento\Tools\I18n\Code\Dictionary;
  */
 class Phrase
 {
+    /**
+     * Single quote that enclose the phrase
+     *
+     * @var string
+     */
+    const QUOTE_SINGLE = "'";
+
+    /**
+     * Double quote that enclose the phrase
+     *
+     * @var string
+     */
+    const QUOTE_DOUBLE = '"';
+
     /**
      * Phrase
      *
@@ -57,6 +71,13 @@ class Phrase
      */
     private $_contextValue = array();
 
+    /**
+     * Quote type that enclose the phrase, single or double
+     *
+     * @var string
+     */
+    private $_quote;
+
     /**
      * Phrase construct
      *
@@ -64,13 +85,15 @@ class Phrase
      * @param string $translation
      * @param string|null $contextType
      * @param string|array|null $contextValue
+     * @param string|null $quote
      */
-    public function __construct($phrase, $translation, $contextType = null, $contextValue = null)
+    public function __construct($phrase, $translation, $contextType = null, $contextValue = null, $quote = null)
     {
         $this->setPhrase($phrase);
         $this->setTranslation($translation);
         $this->setContextType($contextType);
         $this->setContextValue($contextValue);
+        $this->setQuote($quote);
     }
 
     /**
@@ -88,7 +111,7 @@ class Phrase
     }
 
     /**
-     * Get phrase
+     * Get quote type
      *
      * @return string
      */
@@ -97,6 +120,28 @@ class Phrase
         return $this->_phrase;
     }
 
+    /**
+     * Set quote type
+     *
+     * @param string $quote
+     */
+    public function setQuote($quote)
+    {
+        if (in_array($quote, [self::QUOTE_SINGLE, self::QUOTE_DOUBLE])) {
+            $this->_quote = $quote;
+        }
+    }
+
+    /**
+     * Get phrase
+     *
+     * @return string
+     */
+    public function getQuote()
+    {
+        return $this->_quote;
+    }
+
     /**
      * Set translation
      *
diff --git a/dev/tools/Magento/Tools/I18n/Code/Dictionary/Writer/Csv.php b/dev/tools/Magento/Tools/I18n/Code/Dictionary/Writer/Csv.php
index 1102218fff3..26c3788703f 100644
--- a/dev/tools/Magento/Tools/I18n/Code/Dictionary/Writer/Csv.php
+++ b/dev/tools/Magento/Tools/I18n/Code/Dictionary/Writer/Csv.php
@@ -60,6 +60,9 @@ class Csv implements WriterInterface
     public function write(Phrase $phrase)
     {
         $fields = array($phrase->getPhrase(), $phrase->getTranslation());
+        $encloseQuote = $phrase->getQuote() == Phrase::QUOTE_DOUBLE ? Phrase::QUOTE_DOUBLE : Phrase::QUOTE_SINGLE;
+        $fields[0] = $this->_compileString($fields[0], $encloseQuote);
+        $fields[1] = $this->_compileString($fields[1], $encloseQuote);
         if (($contextType = $phrase->getContextType()) && ($contextValue = $phrase->getContextValueAsString())) {
             $fields[] = $contextType;
             $fields[] = $contextValue;
@@ -68,6 +71,22 @@ class Csv implements WriterInterface
         fputcsv($this->_fileHandler, $fields, ',', '"');
     }
 
+    /**
+     * Compile PHP string based on quotes type it enclosed with
+     *
+     * @param string $string
+     * @param string $encloseQuote
+     * @return string
+     *
+     * @SuppressWarnings(PHPMD.EvalExpression)
+     */
+    protected function _compileString($string, $encloseQuote)
+    {
+        $evalString = 'return ' . $encloseQuote . $string . $encloseQuote . ';';
+        $result = @eval($evalString);
+        return is_string($result) ? $result : $string;
+    }
+
     /**
      * Close file handler
      */
diff --git a/dev/tools/Magento/Tools/I18n/Code/Factory.php b/dev/tools/Magento/Tools/I18n/Code/Factory.php
index 14decd27535..347babb30d7 100644
--- a/dev/tools/Magento/Tools/I18n/Code/Factory.php
+++ b/dev/tools/Magento/Tools/I18n/Code/Factory.php
@@ -88,7 +88,8 @@ class Factory
             $data['phrase'],
             $data['translation'],
             isset($data['context_type']) ? $data['context_type'] : null,
-            isset($data['context_value']) ? $data['context_value'] : null
+            isset($data['context_value']) ? $data['context_value'] : null,
+            isset($data['quote']) ? $data['quote'] : null
         );
     }
 }
diff --git a/dev/tools/Magento/Tools/I18n/Code/Parser/Adapter/AbstractAdapter.php b/dev/tools/Magento/Tools/I18n/Code/Parser/Adapter/AbstractAdapter.php
index 8ac981d59a9..0fecef41890 100644
--- a/dev/tools/Magento/Tools/I18n/Code/Parser/Adapter/AbstractAdapter.php
+++ b/dev/tools/Magento/Tools/I18n/Code/Parser/Adapter/AbstractAdapter.php
@@ -26,6 +26,7 @@ namespace Magento\Tools\I18n\Code\Parser\Adapter;
 
 use Magento\Tools\I18n\Code\Context;
 use Magento\Tools\I18n\Code\Parser\AdapterInterface;
+use Magento\Tools\I18n\Code\Dictionary\Phrase;
 
 /**
  * Abstract parser adapter
@@ -83,12 +84,17 @@ abstract class AbstractAdapter implements AdapterInterface
                 $this->_file, $line));
         }
         if (!isset($this->_phrases[$phrase])) {
-            $phrase = $this->_stripQuotes($phrase);
+            $quote = '';
+            if ($this->_isFirstAndLastCharIsQuote($phrase)) {
+                $quote = $phrase[0];
+                $phrase = $this->_stripFirstAndLastChar($phrase);
+            }
 
             $this->_phrases[$phrase] = array(
                 'phrase' => $phrase,
                 'file' => $this->_file,
                 'line' => $line,
+                'quote' => $quote
             );
         }
     }
@@ -99,12 +105,9 @@ abstract class AbstractAdapter implements AdapterInterface
      * @param string $phrase
      * @return string
      */
-    protected function _stripQuotes($phrase)
+    protected function _stripFirstAndLastChar($phrase)
     {
-        if ($this->_isFirstAndLastCharIsQuote($phrase)) {
-            $phrase = substr($phrase, 1, strlen($phrase) - 2);
-        }
-        return $phrase;
+        return substr($phrase, 1, strlen($phrase) - 2);
     }
 
     /**
@@ -115,6 +118,7 @@ abstract class AbstractAdapter implements AdapterInterface
      */
     protected function _isFirstAndLastCharIsQuote($phrase)
     {
-        return ($phrase[0] == '"' || $phrase[0] == "'") && $phrase[0] == $phrase[strlen($phrase) - 1];
+        return ($phrase[0] == Phrase::QUOTE_DOUBLE || $phrase[0] == Phrase::QUOTE_SINGLE)
+            && $phrase[0] == $phrase[strlen($phrase) - 1];
     }
 }
diff --git a/dev/tools/Magento/Tools/I18n/Code/Parser/Contextual.php b/dev/tools/Magento/Tools/I18n/Code/Parser/Contextual.php
index cb354749e14..30bde2c46bb 100644
--- a/dev/tools/Magento/Tools/I18n/Code/Parser/Contextual.php
+++ b/dev/tools/Magento/Tools/I18n/Code/Parser/Contextual.php
@@ -92,6 +92,7 @@ class Contextual extends AbstractParser
                 'translation' => $phraseData['phrase'],
                 'context_type' => $contextType,
                 'context_value' => array($contextValue),
+                'quote' => $phraseData['quote']
             ));
         }
     }
diff --git a/downloader/app/Magento/Downloader/Controller.php b/downloader/app/Magento/Downloader/Controller.php
index f40a5e929e6..c6cf9653c94 100755
--- a/downloader/app/Magento/Downloader/Controller.php
+++ b/downloader/app/Magento/Downloader/Controller.php
@@ -1030,7 +1030,7 @@ final class Controller
                 ->setBackupsDir(\Mage::getBaseDir('var') . '/backups');
 
             \Magento\App\ObjectManager::getInstance()
-                ->get('Magento\Core\Model\Registry')
+                ->get('Magento\Registry')
                 ->register('backup_manager', $backupManager);
 
             if ($type != \Magento\Backup\Factory::TYPE_DB) {
diff --git a/app/code/Magento/Core/Model/Acl/Cache.php b/lib/Magento/Acl/Cache.php
similarity index 92%
rename from app/code/Magento/Core/Model/Acl/Cache.php
rename to lib/Magento/Acl/Cache.php
index 79082b4ee63..3eff6c716ed 100644
--- a/app/code/Magento/Core/Model/Acl/Cache.php
+++ b/lib/Magento/Acl/Cache.php
@@ -23,14 +23,14 @@
  * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Core\Model\Acl;
+namespace Magento\Acl;
 
 class Cache implements \Magento\Acl\CacheInterface
 {
     /**
      * Cache
      *
-     * @var \Magento\App\Cache\Type\Config
+     * @var \Magento\Config\CacheInterface
      */
     protected $_cache;
 
@@ -47,10 +47,10 @@ class Cache implements \Magento\Acl\CacheInterface
     protected $_acl = null;
 
     /**
-     * @param \Magento\App\Cache\Type\Config $cache
+     * @param \Magento\Config\CacheInterface $cache
      * @param string $cacheKey
      */
-    function __construct(\Magento\App\Cache\Type\Config $cache, $cacheKey)
+    function __construct(\Magento\Config\CacheInterface $cache, $cacheKey)
     {
         $this->_cache = $cache;
         $this->_cacheKey = $cacheKey;
diff --git a/app/code/Magento/Core/Model/Acl/RootResource.php b/lib/Magento/Acl/RootResource.php
similarity index 97%
rename from app/code/Magento/Core/Model/Acl/RootResource.php
rename to lib/Magento/Acl/RootResource.php
index 2571b60a35c..1430e180b46 100644
--- a/app/code/Magento/Core/Model/Acl/RootResource.php
+++ b/lib/Magento/Acl/RootResource.php
@@ -19,11 +19,11 @@
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
- * 
+ *
  * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Core\Model\Acl;
+namespace Magento\Acl;
 
 class RootResource
 {
diff --git a/app/code/Magento/Core/Model/AbstractShell.php b/lib/Magento/App/AbstractShell.php
similarity index 95%
rename from app/code/Magento/Core/Model/AbstractShell.php
rename to lib/Magento/App/AbstractShell.php
index 2f700cada36..d1af0214e9a 100644
--- a/app/code/Magento/Core/Model/AbstractShell.php
+++ b/lib/Magento/App/AbstractShell.php
@@ -18,23 +18,14 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Core
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\App;
 
 /**
  * Shell scripts abstract class
- *
- * @category    Magento
- * @package     Magento_Core
- * @author      Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Core\Model;
-
-use Magento\Filesystem\Directory\ReadInterface;
-
 abstract class AbstractShell
 {
     /**
@@ -59,7 +50,7 @@ abstract class AbstractShell
     protected $_entryPoint = null;
 
     /**
-     * @var ReadInterface
+     * @var \Magento\Filesystem\Directory\ReadInterface
      */
     protected $rootDirectory;
 
diff --git a/lib/Magento/App/TemplateTypesInterface.php b/lib/Magento/App/TemplateTypesInterface.php
new file mode 100644
index 00000000000..aa761586f10
--- /dev/null
+++ b/lib/Magento/App/TemplateTypesInterface.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Template Types interface
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\App;
+
+interface TemplateTypesInterface
+{
+    /**
+     * Types of template
+     */
+    const TYPE_TEXT = 1;
+    const TYPE_HTML = 2;
+
+    /**
+     * Return true if template type eq text
+     *
+     * @return boolean
+     */
+    public function isPlain();
+
+    /**
+     * Getter for template type
+     *
+     * @return int
+     */
+    public function getType();
+}
diff --git a/app/code/Magento/Core/Helper/String.php b/lib/Magento/Code/NameBuilder.php
similarity index 87%
rename from app/code/Magento/Core/Helper/String.php
rename to lib/Magento/Code/NameBuilder.php
index a7f9c1005fa..17693886837 100644
--- a/app/code/Magento/Core/Helper/String.php
+++ b/lib/Magento/Code/NameBuilder.php
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Name builder
+ *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -18,18 +20,12 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Core
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Code;
 
-namespace Magento\Core\Helper;
-
-/**
- * Core data helper
- */
-class String extends \Magento\App\Helper\AbstractHelper
+class NameBuilder
 {
     /**
      * Builds namespace + classname out of the parts array
@@ -40,7 +36,7 @@ class String extends \Magento\App\Helper\AbstractHelper
      * @param string[] $parts
      * @return string
      */
-    public static function buildClassName($parts)
+    public function buildClassName($parts)
     {
         $separator = \Magento\Autoload\IncludePath::NS_SEPARATOR;
         $string = join($separator, $parts);
diff --git a/lib/Magento/Css/PreProcessor/Cache/CacheManagerFactory.php b/lib/Magento/Css/PreProcessor/Cache/CacheFactory.php
similarity index 65%
rename from lib/Magento/Css/PreProcessor/Cache/CacheManagerFactory.php
rename to lib/Magento/Css/PreProcessor/Cache/CacheFactory.php
index 94b1ea424cb..234634f362d 100644
--- a/lib/Magento/Css/PreProcessor/Cache/CacheManagerFactory.php
+++ b/lib/Magento/Css/PreProcessor/Cache/CacheFactory.php
@@ -24,11 +24,20 @@
 
 namespace Magento\Css\PreProcessor\Cache;
 
+use Magento\Css\PreProcessor\Cache\Import\Cache;
+
 /**
  * Cache manager factory
  */
-class CacheManagerFactory
+class CacheFactory
 {
+    /**
+     * @var array
+     */
+    protected $cacheTypes = [
+        Cache::IMPORT_CACHE => 'Magento\Css\PreProcessor\Cache\Import\Cache'
+    ];
+
     /**
      * @var \Magento\ObjectManager
      */
@@ -43,22 +52,27 @@ class CacheManagerFactory
     }
 
     /**
-     * @param string $filePath
-     * @param array $params
-     * @return \Magento\Css\PreProcessor\Cache\CacheManager
+     * @param string $cacheType
+     * @param \Magento\View\Publisher\FileInterface $publisherFile
+     * @return CacheInterface
      * @throws \InvalidArgumentException
      */
-    public function create($filePath, array $params)
+    public function create($cacheType, $publisherFile)
     {
-        /** @var \Magento\Css\PreProcessor\Cache\CacheManagerInterface $cacheManager */
+        if (!isset($this->cacheTypes[$cacheType])) {
+            throw new \InvalidArgumentException(
+                sprintf('No cache type registered for "%s" type.', $cacheType)
+            );
+        }
+
+        /** @var CacheInterface $cacheManager */
         $cacheManager = $this->objectManager->create(
-            'Magento\Css\PreProcessor\Cache\CacheManager',
-            array('filePath' => $filePath, 'params' => $params)
+            $this->cacheTypes[$cacheType], array('publisherFile' => $publisherFile)
         );
 
-        if (!$cacheManager instanceof \Magento\Css\PreProcessor\Cache\CacheManagerInterface) {
+        if (!$cacheManager instanceof CacheInterface) {
             throw new \InvalidArgumentException(
-                'Cache Manager does not implement \Magento\Css\PreProcessor\Cache\CacheManagerInterface'
+                'Cache Manager does not implement \Magento\Css\PreProcessor\Cache\CacheInterface'
             );
         }
 
diff --git a/lib/Magento/Css/PreProcessor/Cache/CacheManagerInterface.php b/lib/Magento/Css/PreProcessor/Cache/CacheInterface.php
similarity index 76%
rename from lib/Magento/Css/PreProcessor/Cache/CacheManagerInterface.php
rename to lib/Magento/Css/PreProcessor/Cache/CacheInterface.php
index 9bb56f46f53..c37dae5f325 100644
--- a/lib/Magento/Css/PreProcessor/Cache/CacheManagerInterface.php
+++ b/lib/Magento/Css/PreProcessor/Cache/CacheInterface.php
@@ -27,27 +27,26 @@ namespace Magento\Css\PreProcessor\Cache;
 /**
  * Less cache manager interface
  */
-interface CacheManagerInterface
+interface CacheInterface
 {
     /**
      * @return $this
      */
-    public function clearCache();
+    public function clear();
 
     /**
-     * @return null|string
+     * @return null|\Magento\View\Publisher\FileInterface
      */
-    public function getCachedFile();
+    public function get();
 
     /**
-     * @param string $filePath
-     * @param array $params
+     * @param \Magento\Less\PreProcessor\File\Less $lessFile
      */
-    public function addEntityToCache($filePath, $params);
+    public function add($lessFile);
 
     /**
-     * @param string $generatedFile
+     * @param \Magento\View\Publisher\FileInterface $cachedFile
      * @return $this
      */
-    public function saveCache($generatedFile);
+    public function save($cachedFile);
 }
diff --git a/lib/Magento/Css/PreProcessor/Cache/CacheManager.php b/lib/Magento/Css/PreProcessor/Cache/CacheManager.php
index 6b60741dac1..98e20dcc281 100644
--- a/lib/Magento/Css/PreProcessor/Cache/CacheManager.php
+++ b/lib/Magento/Css/PreProcessor/Cache/CacheManager.php
@@ -24,153 +24,85 @@
 
 namespace Magento\Css\PreProcessor\Cache;
 
-use Magento\Exception;
-use Magento\Filesystem;
-
-/**
- * Less cache manager
- */
-class CacheManager implements CacheManagerInterface
+class CacheManager
 {
     /**
-     * @var array
-     */
-    protected $importEntities = [];
-
-    /**
-     * @var string
-     */
-    protected $cachedFile;
-
-    /**
-     * @var string
+     * @var CacheFactory
      */
-    protected $uniqueFileKey;
+    protected $cacheFactory;
 
     /**
-     * @var Import\Map\Storage
+     * @var CacheInterface[]
      */
-    protected $storage;
+    protected $cacheByType = [];
 
     /**
-     * @var Import\ImportEntityFactory
-     */
-    protected $importEntityFactory;
-
-    /**
-     * @param Import\Map\Storage $storage
-     * @param Import\ImportEntityFactory $importEntityFactory
-     * @param string $filePath
-     * @param array $params
+     * @param CacheFactory $cacheFactory
      */
     public function __construct(
-        Import\Map\Storage $storage,
-        Import\ImportEntityFactory $importEntityFactory,
-        $filePath,
-        $params
+        CacheFactory $cacheFactory
     ) {
-        $this->storage = $storage;
-        $this->importEntityFactory = $importEntityFactory;
-        $this->uniqueFileKey = $this->prepareKey($filePath, $params);
-
-        $this->loadImportEntities();
-    }
-
-    /**
-     * @param string $filePath
-     * @param array $params
-     * @return string
-     */
-    protected function prepareKey($filePath, $params)
-    {
-        if (!empty($params['themeModel'])) {
-            $themeModel = $params['themeModel'];
-            $params['themeModel'] = $themeModel->getId() ?: md5($themeModel->getThemePath());
-        }
-        ksort($params);
-        return $filePath . '|' . implode('|', $params);
+        $this->cacheFactory = $cacheFactory;
     }
 
     /**
+     * @param string $cacheType
+     * @param \Magento\View\Publisher\FileInterface $publisherFile
      * @return $this
      */
-    protected function loadImportEntities()
+    public function initializeCacheByType($cacheType, $publisherFile)
     {
-        $importEntities = unserialize($this->storage->load($this->uniqueFileKey));
-        $this->cachedFile = isset($importEntities['cached_file']) ? $importEntities['cached_file'] : null;
-        $this->importEntities = isset($importEntities['imports']) ? $importEntities['imports'] : [];
-        if (!$this->isValid()) {
-            $this->clearCache();
-        }
+        $this->cacheByType[$cacheType] = $this->cacheFactory->create($cacheType, $publisherFile);
         return $this;
     }
 
     /**
-     * @return bool
+     * @param string $cacheType
+     * @return string|null
      */
-    protected function isValid()
+    public function getCachedFile($cacheType)
     {
-        if (empty($this->importEntities)) {
-            return false;
-        }
-
-        /** @var Import\ImportEntity $entity */
-        foreach ($this->importEntities as $entity) {
-            if (!$entity->isValid()) {
-                return false;
-            }
-        }
-
-        return true;
+        return $this->isCacheInitialized($cacheType) ? $this->cacheByType[$cacheType]->get() : null;
     }
 
     /**
+     * @param string $cacheType
+     * @param \Magento\Less\PreProcessor\File\Less $lessFile
      * @return $this
      */
-    public function clearCache()
+    public function addToCache($cacheType, $lessFile)
     {
-        $this->cachedFile = null;
-        $this->importEntities = [];
-        $this->storage->delete($this->uniqueFileKey);
+        !$this->isCacheInitialized($cacheType) ?: $this->cacheByType[$cacheType]->add($lessFile);
         return $this;
     }
 
     /**
-     * @return null|string
-     */
-    public function getCachedFile()
-    {
-        return $this->cachedFile;
-    }
-
-    /**
-     * @param string $filePath
-     * @param array $params
+     * @param string $cacheType
+     * @param string $cacheFile
      * @return $this
      */
-    public function addEntityToCache($filePath, $params)
+    public function saveCache($cacheType, $cacheFile)
     {
-        $fileKey = $this->prepareKey($filePath, $params);
-        $this->importEntities[$fileKey] = $this->importEntityFactory->create($filePath, $params);
+        !$this->isCacheInitialized($cacheType) ?: $this->cacheByType[$cacheType]->save($cacheFile);
         return $this;
     }
 
     /**
-     * @param string $generatedFile
+     * @param string $cacheType
      * @return $this
      */
-    public function saveCache($generatedFile)
+    public function clearCache($cacheType)
     {
-        $this->storage->save($this->uniqueFileKey, $this->prepareSaveData($generatedFile));
+        !$this->isCacheInitialized($cacheType) ?: $this->cacheByType[$cacheType]->clear();
         return $this;
     }
 
     /**
-     * @param string $cachedFile
-     * @return string
+     * @param string $cacheType
+     * @return bool
      */
-    protected function prepareSaveData($cachedFile)
+    public function isCacheInitialized($cacheType)
     {
-        return serialize(['cached_file' => $cachedFile, 'imports' => $this->importEntities]);
+        return isset($this->cacheByType[$cacheType]);
     }
 }
diff --git a/lib/Magento/Css/PreProcessor/Cache/Import/Cache.php b/lib/Magento/Css/PreProcessor/Cache/Import/Cache.php
new file mode 100644
index 00000000000..81af2d4829f
--- /dev/null
+++ b/lib/Magento/Css/PreProcessor/Cache/Import/Cache.php
@@ -0,0 +1,212 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Css\PreProcessor\Cache\Import;
+
+use Magento\Exception;
+use Magento\App\Filesystem;
+
+/**
+ * File cache entity for entry file
+ */
+class Cache implements \Magento\Css\PreProcessor\Cache\CacheInterface
+{
+    /**
+     * Cache import type
+     */
+    const IMPORT_CACHE = 'import';
+
+    /**
+     * @var array
+     */
+    protected $importEntities = [];
+
+    /**
+     * @var null|\Magento\View\Publisher\FileInterface
+     */
+    protected $cachedFile;
+
+    /**
+     * @var string
+     */
+    protected $uniqueFileKey;
+
+    /**
+     * @var Map\Storage
+     */
+    protected $storage;
+
+    /**
+     * @var ImportEntityFactory
+     */
+    protected $importEntityFactory;
+
+    /**
+     * @var \Magento\View\Publisher\FileFactory
+     */
+    protected $fileFactory;
+
+    /**
+     * @var \Magento\Filesystem\Directory\ReadInterface
+     */
+    protected $readDirectory;
+
+    /**
+     * @param Map\Storage $storage
+     * @param ImportEntityFactory $importEntityFactory
+     * @param Filesystem $filesystem
+     * @param \Magento\View\Publisher\FileInterface $publisherFile
+     * @param \Magento\View\Publisher\FileFactory $fileFactory
+     */
+    public function __construct(
+        Map\Storage $storage,
+        ImportEntityFactory $importEntityFactory,
+        Filesystem $filesystem,
+        \Magento\View\Publisher\FileInterface $publisherFile,
+        \Magento\View\Publisher\FileFactory $fileFactory
+    ) {
+        $this->storage = $storage;
+        $this->fileFactory = $fileFactory;
+        $this->readDirectory = $filesystem->getDirectoryRead(Filesystem::ROOT_DIR);
+        $this->importEntityFactory = $importEntityFactory;
+        $this->uniqueFileKey = $this->prepareKey($publisherFile);
+
+        $this->loadImportEntities();
+    }
+
+    /**
+     * Clear storage for current cached file
+     *
+     * @return $this
+     */
+    public function clear()
+    {
+        $this->cachedFile = null;
+        $this->importEntities = [];
+        $this->storage->delete($this->uniqueFileKey);
+        return $this;
+    }
+
+    /**
+     * Return cached file
+     *
+     * @return null|\Magento\View\Publisher\FileInterface
+     */
+    public function get()
+    {
+        if ($this->cachedFile instanceof \Magento\View\Publisher\FileInterface) {
+            return $this->cachedFile;
+        }
+        return null;
+    }
+
+    /**
+     * Add file to cache
+     *
+     * @param \Magento\Less\PreProcessor\File\Less $lessFile
+     * @return $this
+     */
+    public function add($lessFile)
+    {
+        $this->importEntities[$lessFile->getFileIdentifier()] = $this->importEntityFactory->create($lessFile);
+        return $this;
+    }
+
+    /**
+     * Save state of files
+     *
+     * @param \Magento\View\Publisher\FileInterface $cachedFile
+     * @return $this
+     */
+    public function save($cachedFile)
+    {
+        $this->storage->save($this->uniqueFileKey, $this->prepareSaveData($cachedFile));
+        return $this;
+    }
+
+    /**
+     * Prepare cache key for publication file
+     *
+     * @param \Magento\View\Publisher\FileInterface $lessFile
+     * @return string
+     */
+    protected function prepareKey($lessFile)
+    {
+        $params = $lessFile->getViewParams();
+        if (!empty($params['themeModel'])) {
+            $themeModel = $params['themeModel'];
+            $params['themeModel'] = $themeModel->getId() ?: md5($themeModel->getThemePath());
+        }
+        ksort($params);
+        return $lessFile->getFilePath() . '|' . implode('|', $params);
+    }
+
+    /**
+     * Load state of files
+     *
+     * @return $this
+     */
+    protected function loadImportEntities()
+    {
+        $importEntities = unserialize($this->storage->load($this->uniqueFileKey));
+        $this->cachedFile = isset($importEntities['cached_file']) ? $importEntities['cached_file'] : null;
+        $this->importEntities = isset($importEntities['imports']) ? $importEntities['imports'] : [];
+        if (!$this->isValid()) {
+            $this->clear();
+        }
+        return $this;
+    }
+
+    /**
+     * Check file change time to make sure that file wasn't changed and it doesn't need of pre-processing
+     *
+     * @return bool
+     */
+    public function isValid()
+    {
+        if (empty($this->importEntities)) {
+            return false;
+        }
+        /** @var ImportEntity $entity */
+        foreach ($this->importEntities as $entity) {
+            $fileSourcePath = $entity->getOriginalFile();
+            $fileMtime = $this->readDirectory->stat($this->readDirectory->getRelativePath($fileSourcePath))['mtime'];
+            if ($fileMtime !== $entity->getOriginalMtime()) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Serialize data of files state
+     *
+     * @param \Magento\View\Publisher\FileInterface $cachedFile
+     * @return string
+     */
+    protected function prepareSaveData($cachedFile)
+    {
+        return serialize(['cached_file' => clone $cachedFile, 'imports' => $this->importEntities]);
+    }
+}
diff --git a/lib/Magento/Css/PreProcessor/Cache/Import/ImportEntity.php b/lib/Magento/Css/PreProcessor/Cache/Import/ImportEntity.php
index 23021b06bc7..0587d96a2fd 100644
--- a/lib/Magento/Css/PreProcessor/Cache/Import/ImportEntity.php
+++ b/lib/Magento/Css/PreProcessor/Cache/Import/ImportEntity.php
@@ -24,18 +24,13 @@
 
 namespace Magento\Css\PreProcessor\Cache\Import;
 
-use Magento\Filesystem;
+use Magento\Less\PreProcessor\File\Less;
 
 /**
  * Import entity
  */
 class ImportEntity implements ImportEntityInterface
 {
-    /**
-     * @var \Magento\Filesystem\Directory\ReadInterface
-     */
-    protected $rootDirectory;
-
     /**
      * @var string
      */
@@ -47,29 +42,16 @@ class ImportEntity implements ImportEntityInterface
     protected $originalMtime;
 
     /**
-     * @param Filesystem $filesystem
-     * @param \Magento\View\FileSystem $viewFileSystem
-     * @param string $filePath
-     * @param array $params
+     * @param Less $lessFile
      */
-    public function __construct(
-        Filesystem $filesystem,
-        \Magento\View\FileSystem $viewFileSystem,
-        $filePath,
-        array $params
-    ) {
-        $this->initRootDir($filesystem);
-
-        // @todo dependency from filesystem should be removed
-        $absoluteFilePath = $viewFileSystem->getViewFile($filePath, $params);
-        $relativePath = $this->rootDirectory->getRelativePath($absoluteFilePath);
-
-        $this->originalFile = $relativePath;
-        $this->originalMtime = $this->rootDirectory->stat($relativePath)['mtime'];
+    public function __construct(Less $lessFile)
+    {
+        $this->originalFile = $lessFile->getDirectoryRead()->getRelativePath($lessFile->getSourcePath());
+        $this->originalMtime = $lessFile->getDirectoryRead()->stat($this->originalFile)['mtime'];
     }
 
     /**
-     * @return string
+     * {@inheritdoc}
      */
     public function getOriginalFile()
     {
@@ -77,58 +59,10 @@ class ImportEntity implements ImportEntityInterface
     }
 
     /**
-     * @return int
+     * {@inheritdoc}
      */
     public function getOriginalMtime()
     {
         return $this->originalMtime;
     }
-
-    /**
-     * @return bool
-     */
-    public function isValid()
-    {
-        if (!$this->isFileExist($this->getOriginalFile())) {
-            return false;
-        }
-        $originalFileMTime = $this->rootDirectory->stat($this->getOriginalFile())['mtime'];
-        return $originalFileMTime == $this->getOriginalMtime();
-    }
-
-    /**
-     * @param string $filePath
-     * @return bool
-     */
-    protected function isFileExist($filePath)
-    {
-        return $this->rootDirectory->isFile($filePath);
-    }
-
-    /**
-     * @return array
-     */
-    public function __sleep()
-    {
-        return ['originalFile', 'originalMtime'];
-    }
-
-    /**
-     * @return void
-     */
-    public function __wakeup()
-    {
-        $filesystem = \Magento\App\ObjectManager::getInstance()->get('Magento\Filesystem');
-        $this->initRootDir($filesystem);
-    }
-
-    /**
-     * @param Filesystem $filesystem
-     * @return $this
-     */
-    protected function initRootDir(\Magento\Filesystem $filesystem)
-    {
-        $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR);
-        return $this;
-    }
 }
diff --git a/lib/Magento/Css/PreProcessor/Cache/Import/ImportEntityFactory.php b/lib/Magento/Css/PreProcessor/Cache/Import/ImportEntityFactory.php
index bef6b96bd2d..25e9496c079 100644
--- a/lib/Magento/Css/PreProcessor/Cache/Import/ImportEntityFactory.php
+++ b/lib/Magento/Css/PreProcessor/Cache/Import/ImportEntityFactory.php
@@ -34,36 +34,39 @@ class ImportEntityFactory
      */
     protected $objectManager;
 
+    /**
+     * Instance name
+     *
+     * @var string
+     */
+    protected $instanceName;
+
     /**
      * @param \Magento\ObjectManager $objectManager
+     * @param string $instanceName
      */
-    public function __construct(\Magento\ObjectManager $objectManager)
-    {
+    public function __construct(
+        \Magento\ObjectManager $objectManager,
+        $instanceName = 'Magento\Css\PreProcessor\Cache\Import\ImportEntity'
+    ) {
         $this->objectManager = $objectManager;
+        $this->instanceName = $instanceName;
     }
 
     /**
-     * @param string $filePath
-     * @param array $params
-     * @return \Magento\Css\PreProcessor\Cache\Import\ImportEntityInterface
+     * @param \Magento\Less\PreProcessor\File\Less $lessFile
+     * @return ImportEntityInterface
      * @throws \InvalidArgumentException
      */
-    public function create($filePath, $params)
+    public function create($lessFile)
     {
         /** @var \Magento\Css\PreProcessor\Cache\Import\ImportEntityInterface $importEntity */
-        $importEntity = $this->objectManager->create(
-            'Magento\Css\PreProcessor\Cache\Import\ImportEntity',
-            array('filePath' => $filePath, 'params' => $params)
-        );
-
+        $importEntity = $this->objectManager->create($this->instanceName, array('lessFile' => $lessFile));
         if (!$importEntity instanceof \Magento\Css\PreProcessor\Cache\Import\ImportEntityInterface) {
             throw new \InvalidArgumentException(
                 'Import Entity does not implement \Magento\Css\PreProcessor\Cache\Import\ImportEntityInterface'
             );
         }
-
         return $importEntity;
     }
 }
-
-
diff --git a/lib/Magento/Css/PreProcessor/Cache/Import/ImportEntityInterface.php b/lib/Magento/Css/PreProcessor/Cache/Import/ImportEntityInterface.php
index f09da812f20..f2f4e58fb5d 100644
--- a/lib/Magento/Css/PreProcessor/Cache/Import/ImportEntityInterface.php
+++ b/lib/Magento/Css/PreProcessor/Cache/Import/ImportEntityInterface.php
@@ -24,25 +24,22 @@
 
 namespace Magento\Css\PreProcessor\Cache\Import;
 
-use \Magento\Filesystem;
-
 /**
  * Import entity interface
  */
 interface ImportEntityInterface
 {
     /**
+     * Source path to original file
+     *
      * @return string
      */
     public function getOriginalFile();
 
     /**
+     * Change timestamp for original file
+     *
      * @return int
      */
     public function getOriginalMtime();
-
-    /**
-     * @return bool
-     */
-    public function isValid();
 }
diff --git a/lib/Magento/Css/PreProcessor/Cache/Import/Map/Storage.php b/lib/Magento/Css/PreProcessor/Cache/Import/Map/Storage.php
index adf98c6eae8..fc46853a586 100644
--- a/lib/Magento/Css/PreProcessor/Cache/Import/Map/Storage.php
+++ b/lib/Magento/Css/PreProcessor/Cache/Import/Map/Storage.php
@@ -89,6 +89,15 @@ class Storage
         return $this;
     }
 
+    /**
+     * @return $this
+     */
+    public function clearMaps()
+    {
+        $this->mapsDirectory->delete(self::MAPS_DIR);
+        return $this;
+    }
+
     /**
      * @param string $key
      * @return string
diff --git a/lib/Magento/Css/PreProcessor/Cache/Plugin/ImportCleaner.php b/lib/Magento/Css/PreProcessor/Cache/Plugin/ImportCleaner.php
new file mode 100644
index 00000000000..907009d48bb
--- /dev/null
+++ b/lib/Magento/Css/PreProcessor/Cache/Plugin/ImportCleaner.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Css\PreProcessor\Cache\Plugin;
+
+use Magento\App\Filesystem;
+use Magento\Css\PreProcessor\Cache\Import\Map\Storage;
+
+/**
+ * Plugin for cache flushing from admin panel
+ */
+class ImportCleaner
+{
+    /**
+     * @var Storage
+     */
+    protected $importStorage;
+
+    /**
+     * @param Storage $importStorage
+     */
+    public function __construct(
+        Storage $importStorage
+    ) {
+        $this->importStorage = $importStorage;
+    }
+
+    /**
+     * @param array $arguments
+     * @return array
+     */
+    public function beforeCleanMergedJsCss(array $arguments)
+    {
+        $this->importStorage->clearMaps();
+        return $arguments;
+    }
+}
diff --git a/lib/Magento/Css/PreProcessor/Cache/Plugin/InstructionPreProcessor.php b/lib/Magento/Css/PreProcessor/Cache/Plugin/InstructionPreProcessor.php
new file mode 100644
index 00000000000..73123813ed6
--- /dev/null
+++ b/lib/Magento/Css/PreProcessor/Cache/Plugin/InstructionPreProcessor.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Css\PreProcessor\Cache\Plugin;
+
+use Magento\Css\PreProcessor\Cache\CacheManager;
+use Magento\Css\PreProcessor\Cache\Import\Cache;
+
+/**
+ * Plugin for less caching
+ */
+class InstructionPreProcessor
+{
+    /**
+     * @var CacheManager
+     */
+    protected $cacheManager;
+
+    /**
+     * @param CacheManager $cacheManager
+     */
+    public function __construct(CacheManager $cacheManager)
+    {
+        $this->cacheManager = $cacheManager;
+    }
+
+    /**
+     * Add to cache all pre-processed files that are related to initial less file
+     *
+     * @param \Magento\Less\PreProcessor\File\FileList $fileList
+     * @return \Magento\Less\PreProcessor\File\FileList
+     */
+    public function afterProcessLessInstructions($fileList)
+    {
+        foreach ($fileList as $lessFile) {
+            $this->cacheManager->addToCache(Cache::IMPORT_CACHE, $lessFile);
+        }
+        return $fileList;
+    }
+}
diff --git a/lib/Magento/Css/PreProcessor/Cache/Plugin.php b/lib/Magento/Css/PreProcessor/Cache/Plugin/Less.php
similarity index 58%
rename from lib/Magento/Css/PreProcessor/Cache/Plugin.php
rename to lib/Magento/Css/PreProcessor/Cache/Plugin/Less.php
index c4242834f02..fe1d56eacb6 100644
--- a/lib/Magento/Css/PreProcessor/Cache/Plugin.php
+++ b/lib/Magento/Css/PreProcessor/Cache/Plugin/Less.php
@@ -22,40 +22,36 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-namespace Magento\Css\PreProcessor\Cache;
+namespace Magento\Css\PreProcessor\Cache\Plugin;
 
 use Magento\Filesystem;
-use Magento\Css\PreProcessor\Cache;
+use Magento\Css\PreProcessor\Cache\CacheManager;
+use Magento\Css\PreProcessor\Cache\Import\Cache;
 
 /**
  * Plugin for less caching
  */
-class Plugin
+class Less
 {
-    /**
-     * @var CacheManagerFactory
-     */
-    protected $cacheManagerFactory;
-
     /**
      * @var \Magento\Logger
      */
     protected $logger;
 
     /**
-     * @var \Magento\Css\PreProcessor\Cache\CacheManager
+     * @var CacheManager
      */
     protected $cacheManager;
 
     /**
-     * @param CacheManagerFactory $cacheManagerFactory
+     * @param CacheManager $cacheManager
      * @param \Magento\Logger $logger
      */
     public function __construct(
-        CacheManagerFactory $cacheManagerFactory,
+        CacheManager $cacheManager,
         \Magento\Logger $logger
     ) {
-        $this->cacheManagerFactory = $cacheManagerFactory;
+        $this->cacheManager = $cacheManager;
         $this->logger = $logger;
     }
 
@@ -66,49 +62,28 @@ class Plugin
      */
     public function aroundProcess(array $arguments, \Magento\Code\Plugin\InvocationChain $invocationChain)
     {
-        // check if source path already exist
-        if (isset($arguments[3])) {
+        /** @var \Magento\View\Publisher\CssFile $publicationFile */
+        $publicationFile = $arguments[0];
+
+        if ($publicationFile->getSourcePath()) {
             return $invocationChain->proceed($arguments);
         }
 
-        $this->initializeCacheManager($arguments[0], $arguments[1]);
+        $this->cacheManager->initializeCacheByType(Cache::IMPORT_CACHE, $publicationFile);
 
-        $cachedFile = $this->cacheManager->getCachedFile();
-        if (null !== $cachedFile) {
+        $cachedFile = $this->cacheManager->getCachedFile(Cache::IMPORT_CACHE);
+        if ($cachedFile instanceof \Magento\View\Publisher\FileInterface) {
             return $cachedFile;
         }
 
         try {
+            /** @var \Magento\View\Publisher\FileInterface $result */
             $result = $invocationChain->proceed($arguments);
-            $this->cacheManager->saveCache($result);
+            $this->cacheManager->saveCache(Cache::IMPORT_CACHE, $result);
         } catch (Filesystem\FilesystemException $e) {
             $this->logger->logException($e);
             return null;
         }
         return $result;
     }
-
-    /**
-     * @param string $lessFilePath
-     * @param array $params
-     * @return $this
-     */
-    protected function initializeCacheManager($lessFilePath, $params)
-    {
-        $this->cacheManager = $this->cacheManagerFactory->create($lessFilePath, $params);
-        return $this;
-    }
-
-    /**
-     * @param array $arguments
-     * @return array
-     */
-    public function beforeProcessLessInstructions(array $arguments)
-    {
-        if (null !== $this->cacheManager) {
-            list($lessFilePath, $params) = $arguments;
-            $this->cacheManager->addEntityToCache($lessFilePath, $params);
-        }
-        return $arguments;
-    }
 }
diff --git a/lib/Magento/Css/PreProcessor/Composite.php b/lib/Magento/Css/PreProcessor/Composite.php
index 77af5a3efdf..4211d554350 100644
--- a/lib/Magento/Css/PreProcessor/Composite.php
+++ b/lib/Magento/Css/PreProcessor/Composite.php
@@ -32,6 +32,11 @@ use \Magento\View\Asset\PreProcessorFactory;
  */
 class Composite implements PreProcessorInterface
 {
+    /**
+     * Temporary directory prefix
+     */
+    const TMP_VIEW_DIR   = 'view';
+
     /**
      * @var PreProcessorInterface[]
      */
@@ -55,19 +60,17 @@ class Composite implements PreProcessorInterface
     }
 
     /**
-     * @param string $filePath
-     * @param array $params
+     * @param \Magento\View\Publisher\FileInterface $publisherFile
      * @param \Magento\Filesystem\Directory\WriteInterface $targetDirectory
-     * @param null $sourcePath
-     * @return null|string
+     * @return \Magento\View\Publisher\FileInterface
      */
-    public function process($filePath, $params, $targetDirectory, $sourcePath = null)
+    public function process(\Magento\View\Publisher\FileInterface $publisherFile, $targetDirectory)
     {
         foreach ($this->preProcessors as $preProcessor) {
-            $sourcePath = $preProcessor->process($filePath, $params, $targetDirectory, $sourcePath);
+            $publisherFile = $preProcessor->process($publisherFile, $targetDirectory);
         }
 
-        return $sourcePath;
+        return $publisherFile;
     }
 
     /**
diff --git a/lib/Magento/Css/PreProcessor/Less.php b/lib/Magento/Css/PreProcessor/Less.php
index 31556cdfc2a..855e2902fe9 100644
--- a/lib/Magento/Css/PreProcessor/Less.php
+++ b/lib/Magento/Css/PreProcessor/Less.php
@@ -31,17 +31,10 @@ use \Magento\View\Asset\PreProcessor\PreProcessorInterface;
  */
 class Less implements PreProcessorInterface
 {
-    /**#@+
-     * Temporary directories prefix group
-     */
-    const TMP_VIEW_DIR   = 'view';
-    const TMP_THEME_DIR  = 'theme_';
-    /**#@-*/
-
     /**
-     * @var \Magento\View\FileSystem
+     * Temporary directory prefix
      */
-    protected $viewFileSystem;
+    const TMP_LESS_DIR = 'less';
 
     /**
      * @var \Magento\Less\PreProcessor
@@ -49,7 +42,7 @@ class Less implements PreProcessorInterface
     protected $lessPreProcessor;
 
     /**
-     * @var \Magento\Css\PreProcessor\AdapterInterface
+     * @var AdapterInterface
      */
     protected $adapter;
 
@@ -59,93 +52,66 @@ class Less implements PreProcessorInterface
     protected $logger;
 
     /**
-     * @param \Magento\View\FileSystem $viewFileSystem
+     * @var \Magento\View\Publisher\FileFactory
+     */
+    protected $fileFactory;
+
+    /**
      * @param \Magento\Less\PreProcessor $lessPreProcessor
      * @param AdapterInterface $adapter
      * @param \Magento\Logger $logger
+     * @param \Magento\View\Publisher\FileFactory $fileFactory
      */
     public function __construct(
-        \Magento\View\FileSystem $viewFileSystem,
         \Magento\Less\PreProcessor $lessPreProcessor,
-        \Magento\Css\PreProcessor\AdapterInterface $adapter,
-        \Magento\Logger $logger
+        AdapterInterface $adapter,
+        \Magento\Logger $logger,
+        \Magento\View\Publisher\FileFactory $fileFactory
     ) {
-        $this->viewFileSystem = $viewFileSystem;
         $this->lessPreProcessor = $lessPreProcessor;
         $this->adapter = $adapter;
         $this->logger = $logger;
+        $this->fileFactory = $fileFactory;
     }
 
     /**
      * Process LESS file content
      *
-     * @param string $filePath
-     * @param array $params
+     * @param \Magento\View\Publisher\FileInterface $publisherFile
      * @param \Magento\Filesystem\Directory\WriteInterface $targetDirectory
-     * @param null|string $sourcePath
-     * @return string
+     * @return \Magento\View\Publisher\FileInterface
      */
-    public function process($filePath, $params, $targetDirectory, $sourcePath = null)
+    public function process(\Magento\View\Publisher\FileInterface $publisherFile, $targetDirectory)
     {
         // if css file has being already found_by_fallback or prepared_by_previous_pre-processor
-        if ($sourcePath) {
-            return $sourcePath;
+        if ($publisherFile->getSourcePath()) {
+            return $publisherFile;
         }
 
-        $lessFilePath = $this->replaceExtension($filePath, 'css', 'less');
         try {
-            $preparedLessFileSourcePath = $this->lessPreProcessor->processLessInstructions($lessFilePath, $params);
+            $processedFiles = $this->lessPreProcessor->processLessInstructions(
+                $this->replaceExtension($publisherFile->getFilePath(), 'css', 'less'),
+                $publisherFile->getViewParams()
+            );
+            $cssContent = $this->adapter->process($processedFiles->getPublicationPath());
         } catch (\Magento\Filesystem\FilesystemException $e) {
             $this->logger->logException($e);
-            return $sourcePath;     // It's actually 'null'
-        }
-
-        try {
-            $cssContent = $this->adapter->process($preparedLessFileSourcePath);
-        } catch (\Magento\Css\PreProcessor\Adapter\AdapterException $e) {
+            return $publisherFile; // It has 'null' source path
+        } catch (Adapter\AdapterException $e) {
             $this->logger->logException($e);
-            return $sourcePath;     // It's actually 'null'
+            return $publisherFile; // It has 'null' source path
         }
 
-        $tmpFilePath = $this->buildTmpFilePath($filePath, $params);
-
+        $tmpFilePath = Composite::TMP_VIEW_DIR . '/' . self::TMP_LESS_DIR . '/' . $publisherFile->buildUniquePath();
         $targetDirectory->writeFile($tmpFilePath, $cssContent);
-        return $targetDirectory->getAbsolutePath($tmpFilePath);
-    }
-
-    /**
-     * Build unique file path for a view file that includes area/theme/locale/module parts
-     *
-     * @param string $file
-     * @param array $params - 'themeModel', 'area', 'locale', 'module' keys are used
-     * @return string
-     */
-    protected function buildTmpFilePath($file, array $params)
-    {
-        /** @var $theme \Magento\View\Design\ThemeInterface */
-        $theme = $params['themeModel'];
-        $designPath = null;
-        if ($theme->getThemePath()) {
-            $designPath = $theme->getThemePath();
-        } elseif ($theme->getId()) {
-            $designPath = self::TMP_THEME_DIR . $theme->getId();
-        }
-
-        $parts = array();
-        $parts[] = self::TMP_VIEW_DIR;
-        $parts[] = $params['area'];
-        if ($designPath) {
-            $parts[] = $designPath;
-        }
-        $parts[] = $params['locale'];
-        if ($params['module']) {
-            $parts[] = $params['module'];
-        }
-        $parts[] = $file;
 
-        $publicFile = join('/', $parts);
+        $processedFile = $this->fileFactory->create(
+            $publisherFile->getFilePath(),
+            $publisherFile->getViewParams(),
+            $targetDirectory->getAbsolutePath($tmpFilePath)
+        );
 
-        return $publicFile;
+        return $processedFile;
     }
 
     /**
@@ -157,7 +123,7 @@ class Less implements PreProcessorInterface
     protected function replaceExtension($filePath, $search, $replace)
     {
         $extension = pathinfo($filePath, PATHINFO_EXTENSION);
-        if ($extension == $search) {
+        if ($extension === $search) {
             $dotPosition = strrpos($filePath, '.');
             $filePath = substr($filePath, 0, $dotPosition + 1) . $replace;
         }
diff --git a/lib/Magento/Css/PreProcessor/UrlResolver.php b/lib/Magento/Css/PreProcessor/UrlResolver.php
new file mode 100644
index 00000000000..78ed8cda683
--- /dev/null
+++ b/lib/Magento/Css/PreProcessor/UrlResolver.php
@@ -0,0 +1,164 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Css\PreProcessor;
+
+use Magento\View\Asset\PreProcessor\PreProcessorInterface;
+use Magento\Filesystem\Directory\WriteInterface;
+
+/**
+ * Css pre-processor url resolver
+ */
+class UrlResolver implements PreProcessorInterface
+{
+    /**
+     * Temporary directory prefix
+     */
+    const TMP_RESOLVER_DIR   = 'resolver';
+
+    /**
+     * Root directory
+     *
+     * @var WriteInterface
+     */
+    protected $rootDirectory;
+
+    /**
+     * Related file
+     *
+     * @var \Magento\View\RelatedFile
+     */
+    protected $relatedFile;
+
+    /**
+     * Helper to process css content
+     *
+     * @var \Magento\View\Url\CssResolver
+     */
+    protected $cssUrlResolver;
+
+    /**
+     * Publisher
+     *
+     * @var \Magento\View\Publisher
+     */
+    protected $publisher;
+
+    /**
+     * Logger
+     *
+     * @var \Magento\Logger
+     */
+    protected $logger;
+
+    /**
+     * Publisher file factory
+     *
+     * @var \Magento\View\Publisher\FileFactory
+     */
+    protected $fileFactory;
+
+    /**
+     * @param \Magento\App\Filesystem $filesystem
+     * @param \Magento\View\RelatedFile $relatedFile
+     * @param \Magento\View\Url\CssResolver $cssUrlResolver
+     * @param \Magento\View\Publisher $publisher
+     * @param \Magento\Logger $logger
+     * @param \Magento\View\Publisher\FileFactory $fileFactory
+     */
+    public function __construct(
+        \Magento\App\Filesystem $filesystem,
+        \Magento\View\RelatedFile $relatedFile,
+        \Magento\View\Url\CssResolver $cssUrlResolver,
+        \Magento\View\Publisher $publisher,
+        \Magento\Logger $logger,
+        \Magento\View\Publisher\FileFactory $fileFactory
+    ) {
+        $this->rootDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR);
+        $this->relatedFile = $relatedFile;
+        $this->cssUrlResolver = $cssUrlResolver;
+        $this->publisher = $publisher;
+        $this->logger = $logger;
+        $this->fileFactory = $fileFactory;
+    }
+
+    /**
+     * Process LESS file content
+     *
+     * @param \Magento\View\Publisher\FileInterface $publisherFile
+     * @param \Magento\Filesystem\Directory\WriteInterface $targetDirectory
+     * @return \Magento\View\Publisher\FileInterface
+     */
+    public function process(\Magento\View\Publisher\FileInterface $publisherFile, $targetDirectory)
+    {
+        if (!$publisherFile->isPublicationAllowed()) {
+            return $publisherFile;
+        }
+        $filePath = $publisherFile->getFilePath();
+        $sourcePath = $publisherFile->getSourcePath();
+        $content = $this->rootDirectory->readFile($this->rootDirectory->getRelativePath($sourcePath));
+        $params = $publisherFile->getViewParams();
+
+        $callback = function ($fileId) use ($filePath, $params) {
+            $relatedPathPublic = $this->publishRelatedViewFile($fileId, $filePath, $params);
+            return $relatedPathPublic;
+        };
+        try {
+            $content = $this->cssUrlResolver->replaceCssRelativeUrls(
+                $content,
+                $sourcePath,
+                $publisherFile->buildPublicViewFilename(),
+                $callback
+            );
+        } catch (\Magento\Exception $e) {
+            $this->logger->logException($e);
+        }
+
+        $tmpFilePath = Composite::TMP_VIEW_DIR . '/' . self::TMP_RESOLVER_DIR . '/'
+            . $publisherFile->buildUniquePath();
+        $targetDirectory->writeFile($tmpFilePath, $content);
+
+        $processedFile = $this->fileFactory->create(
+            $publisherFile->getFilePath(),
+            $params,
+            $targetDirectory->getAbsolutePath($tmpFilePath)
+        );
+
+        return $processedFile;
+    }
+
+    /**
+     * Publish file identified by $fileId basing on information about parent file path and name.
+     *
+     * @param string $fileId URL to the file that was extracted from $parentFilePath
+     * @param string $parentFileName original file name identifier that was requested for processing
+     * @param array $params theme/module parameters array
+     * @return string
+     */
+    protected function publishRelatedViewFile($fileId, $parentFileName, $params)
+    {
+        $relativeFilePath = $this->relatedFile->buildPath($fileId, $parentFileName, $params);
+        return $this->publisher->getPublicFilePath($relativeFilePath, $params);
+    }
+}
diff --git a/lib/Magento/Data/Collection.php b/lib/Magento/Data/Collection.php
index 410ef95f9f9..3b7adde129f 100644
--- a/lib/Magento/Data/Collection.php
+++ b/lib/Magento/Data/Collection.php
@@ -33,14 +33,14 @@
  */
 
 /**
- * TODO: Refactor use of \Magento\Core\Model\Option\ArrayInterface in library. Probably will be refactored while
+ * TODO: Refactor use of \Magento\Option\ArrayInterface in library. Probably will be refactored while
  * moving \Magento\Core to library
  */
 namespace Magento\Data;
 
 use Magento\Data\Collection\EntityFactoryInterface;
 
-class Collection implements \IteratorAggregate, \Countable, \Magento\Core\Model\Option\ArrayInterface
+class Collection implements \IteratorAggregate, \Countable, \Magento\Option\ArrayInterface
 {
     const SORT_ORDER_ASC    = 'ASC';
     const SORT_ORDER_DESC   = 'DESC';
diff --git a/app/code/Magento/Core/Model/Input/Filter.php b/lib/Magento/Filter/Input.php
similarity index 95%
rename from app/code/Magento/Core/Model/Input/Filter.php
rename to lib/Magento/Filter/Input.php
index 12398b75af7..9be90640848 100644
--- a/app/code/Magento/Core/Model/Input/Filter.php
+++ b/lib/Magento/Filter/Input.php
@@ -23,7 +23,7 @@
  * Model for multi-filtering all data which set to models
  * Example:
  * <code>
- * /** @var $filterFactory \Magento\Core\Model\Input\FilterFactory {@*}
+ * /** @var $filterFactory \Magento\Filter\InputFactory {@*}
  * $filter = $filterFactory->create()
  *     ->setFilters(array(
  *      'list_values' => array(
@@ -41,11 +41,11 @@
  *                      'zend' => 'StringToUpper',
  *                      'args' => array('encoding' => 'utf-8'))),
  *              'item2' => array(
- *                  array('model' => 'core/input_filter_maliciousCode')
+ *                  array('model' => 'Magento\Filter\Input\MaliciousCode')
  *              ),
  *              'item3' => array(
  *                  array(
- *                      'helper' => 'core',
+ *                      'helper' => 'Module\Helper\Class\Name',
  *                      'method' => 'stripTags',
  *                      'args' => array('<p> <div>', true))
  *              )
@@ -92,13 +92,12 @@
  *  ));
  * </code>
  *
- * @see \Magento\Core\Model\Input\FilterTest    See this class for manual
  * @copyright  Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Core\Model\Input;
+namespace Magento\Filter;
 
-class Filter implements \Zend_Filter_Interface
+class Input implements \Zend_Filter_Interface
 {
     /**
      * @var \Magento\ObjectManager
@@ -337,8 +336,8 @@ class Filter implements \Zend_Filter_Interface
             //use only first element because object manager cannot get more
             $filterData['args'] = $filterData['args'][0];
         }
-        if (is_string($filterData['model'])) {
-            $filter = $this->_objectManager->create($filterData['model'], $filterData['args']);
+        if (is_string($filter)) {
+            $filter = $this->_objectManager->create($filter, $filterData['args']);
         }
         if (!($filter instanceof \Zend_Filter_Interface)) {
             throw new \Exception('Filter is not instance of \Zend_Filter_Interface');
diff --git a/app/code/Magento/Core/Model/Input/Filter/MaliciousCode.php b/lib/Magento/Filter/Input/MaliciousCode.php
similarity index 98%
rename from app/code/Magento/Core/Model/Input/Filter/MaliciousCode.php
rename to lib/Magento/Filter/Input/MaliciousCode.php
index eab05a3bc0c..5ab36fd49cb 100644
--- a/app/code/Magento/Core/Model/Input/Filter/MaliciousCode.php
+++ b/lib/Magento/Filter/Input/MaliciousCode.php
@@ -23,7 +23,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Core\Model\Input\Filter;
+namespace Magento\Filter\Input;
 
 class MaliciousCode implements \Zend_Filter_Interface
 {
diff --git a/app/code/Magento/Core/Model/Image/Adapter/Config.php b/lib/Magento/Image/Adapter/Config.php
similarity index 97%
rename from app/code/Magento/Core/Model/Image/Adapter/Config.php
rename to lib/Magento/Image/Adapter/Config.php
index de696532eb4..9e7fe080cd9 100644
--- a/app/code/Magento/Core/Model/Image/Adapter/Config.php
+++ b/lib/Magento/Image/Adapter/Config.php
@@ -17,11 +17,11 @@
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
- *   
+ *
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Core\Model\Image\Adapter;
+namespace Magento\Image\Adapter;
 
 class Config implements \Magento\Image\Adapter\ConfigInterface
 {
diff --git a/lib/Magento/Less/File/Source/Library.php b/lib/Magento/Less/File/Source/Library.php
index 24bea875357..6a391def5e9 100644
--- a/lib/Magento/Less/File/Source/Library.php
+++ b/lib/Magento/Less/File/Source/Library.php
@@ -105,7 +105,7 @@ class Library implements SourceInterface
         $result = array();
         foreach ($files as $file) {
             $filename = $reader->getAbsolutePath($file);
-            $result[] = $this->fileFactory->create($filename, 'lib', $theme);
+            $result[] = $this->fileFactory->create($filename, false, $theme);
         }
         return $result;
     }
diff --git a/lib/Magento/Less/PreProcessor.php b/lib/Magento/Less/PreProcessor.php
index 0ae62fc1825..da24933c848 100644
--- a/lib/Magento/Less/PreProcessor.php
+++ b/lib/Magento/Less/PreProcessor.php
@@ -24,145 +24,91 @@
 
 namespace Magento\Less;
 
-use Magento\Less\PreProcessor\InstructionFactory;
-
 /**
  * LESS instruction preprocessor
  */
 class PreProcessor
 {
     /**
-     * Folder for publication preprocessed less files
-     */
-    const PUBLICATION_PREFIX_PATH = 'less';
-
-    /**
-     * @var \Magento\View\FileSystem
-     */
-    protected $viewFileSystem;
-
-    /**
-     * @var \Magento\Filesystem
+     * @var PreProcessor\InstructionFactory
      */
-    protected $filesystem;
+    protected $instructionFactory;
 
     /**
-     * @var InstructionFactory
+     * @var PreProcessor\File\FileListFactory
      */
-    protected $instructionFactory;
+    protected $fileListFactory;
 
     /**
-     * @var \Magento\Less\PreProcessorInterface[]
+     * List of instruction pre-processors
+     *
+     * @var array
      */
     protected $preProcessors;
 
     /**
-     * @param \Magento\View\FileSystem $viewFileSystem
-     * @param \Magento\Filesystem $filesystem
-     * @param InstructionFactory $instructionFactory
+     * @param PreProcessor\InstructionFactory $instructionFactory
+     * @param PreProcessor\File\FileListFactory $fileListFactory
      * @param array $preProcessors
      */
     public function __construct(
-        \Magento\View\FileSystem $viewFileSystem,
-        \Magento\Filesystem $filesystem,
-        InstructionFactory $instructionFactory,
+        PreProcessor\InstructionFactory $instructionFactory,
+        PreProcessor\File\FileListFactory $fileListFactory,
         array $preProcessors = array()
     ) {
-        $this->viewFileSystem = $viewFileSystem;
-        $this->filesystem = $filesystem;
         $this->instructionFactory = $instructionFactory;
-        $this->preProcessors = $this->initLessPreProcessors($preProcessors);
+        $this->fileListFactory = $fileListFactory;
+        $this->preProcessors = $preProcessors;
     }
 
     /**
-     * Instantiate instruction less preprocessors
+     * Instantiate instruction less pre-processors
      *
-     * @param $preProcessors
-     * @return \Magento\Less\PreProcessorInterface[]
+     * @param PreProcessor\File\FileList $fileList
+     * @return PreProcessorInterface[]
      */
-    protected function initLessPreProcessors($preProcessors)
+    protected function initLessPreProcessors(PreProcessor\File\FileList $fileList)
     {
         $preProcessorsInstances = [];
-        foreach ($preProcessors as $preProcessorClass) {
-            $preProcessorsInstances[] = $this->instructionFactory->create($preProcessorClass['class']);
+        foreach ($this->preProcessors as $preProcessorClass) {
+            $preProcessorsInstances[] = $this->instructionFactory->create($preProcessorClass['class'], [
+                'fileList' => $fileList
+            ]);
         }
         return $preProcessorsInstances;
     }
 
     /**
-     * Get base directory with source of less files
-     *
-     * @return \Magento\Filesystem\Directory\ReadInterface
-     */
-    protected function getDirectoryRead()
-    {
-        return $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR);
-    }
-
-    /**
-     * Get directory for publication temporary less files
-     *
-     * @return \Magento\Filesystem\Directory\WriteInterface
-     */
-    protected function getDirectoryWrite()
-    {
-        return $this->filesystem->getDirectoryWrite(\Magento\App\Filesystem::TMP_DIR);
-    }
-
-    /**
-     * Generate new source path for less file into temporary folder
-     *
-     * @param string $lessFileSourcePath
-     * @return string
-     */
-    protected function generatePath($lessFileSourcePath)
-    {
-        $sourcePathPrefix = $this->getDirectoryRead()->getAbsolutePath();
-        $targetPathPrefix = $this->getDirectoryWrite()->getAbsolutePath() . self::PUBLICATION_PREFIX_PATH . '/';
-        return str_replace($sourcePathPrefix, $targetPathPrefix, $lessFileSourcePath);
-    }
-
-    /**
-     * Save pre-processed less content to temporary folder
+     * Process less file through pre-processors and all child files that was added during pre-processing
      *
-     * @param string $lessFileSourcePath absolute path to source less file
-     * @param string $lessContent
-     * @return string absolute path to the pre-processed less file
+     * @param string $lessFilePath
+     * @param array $viewParams
+     * @return PreProcessor\File\FileList list of pre-processed files
      */
-    protected function saveLessFile($lessFileSourcePath, $lessContent)
+    public function processLessInstructions($lessFilePath, $viewParams)
     {
-        $lessFileTargetPath = $this->generatePath($lessFileSourcePath);
-        $directoryWrite = $this->getDirectoryWrite();
-        $directoryWrite->writeFile($directoryWrite->getRelativePath($lessFileTargetPath), $lessContent);
-        return $lessFileTargetPath;
+        /** @var $fileList PreProcessor\File\FileList */
+        $fileList = $this->fileListFactory->create(['lessFilePath' => $lessFilePath, 'viewParams' => $viewParams]);
+        $preProcessors = $this->initLessPreProcessors($fileList);
+        /** @var $lessFile PreProcessor\File\Less */
+        foreach ($fileList as $lessFile) {
+            $this->publishProcessedContent($preProcessors, $lessFile);
+        }
+        return $fileList;
     }
 
     /**
-     * Process less content throughout all existed instruction preprocessors
+     * Process less content and save
      *
-     * @param string $lessFilePath
-     * @param array $viewParams
-     * @return string of saved or original preprocessed less file
+     * @param PreProcessorInterface[] $preProcessors
+     * @param PreProcessor\File\Less $lessFile
      */
-    public function processLessInstructions($lessFilePath, $viewParams)
+    protected function publishProcessedContent(array $preProcessors, PreProcessor\File\Less $lessFile)
     {
-        $lessFileTargetPath = $lessFileSourcePath = $this->viewFileSystem->getViewFile($lessFilePath, $viewParams);
-        $directoryRead = $this->getDirectoryRead();
-        $lessContent = $lessSourceContent = $directoryRead->readFile(
-            $directoryRead->getRelativePath($lessFileSourcePath)
-        );
-
-        foreach ($this->preProcessors as $processor) {
-            $lessContent = $processor->process(
-                $lessContent,
-                $viewParams,
-                ['parentPath' => $lessFilePath, 'parentAbsolutePath' => $lessFileSourcePath]
-            );
-        }
-
-        if ($lessSourceContent != $lessContent) {
-            $lessFileTargetPath = $this->saveLessFile($lessFileSourcePath, $lessContent);
+        $lessContent = $lessFile->getContent();
+        foreach ($preProcessors as $processor) {
+            $lessContent = $processor->process($lessFile, $lessContent);
         }
-        return $lessFileTargetPath;
+        $lessFile->saveContent($lessContent);
     }
 }
diff --git a/lib/Magento/Less/PreProcessor/File/FileList.php b/lib/Magento/Less/PreProcessor/File/FileList.php
new file mode 100644
index 00000000000..2a79e6fd336
--- /dev/null
+++ b/lib/Magento/Less/PreProcessor/File/FileList.php
@@ -0,0 +1,153 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Less\PreProcessor\File;
+
+/**
+ * Less file list container
+ */
+class FileList implements \Iterator
+{
+    /**
+     * @var LessFactory
+     */
+    protected $lessFactory;
+
+    /**
+     * Entry less file for this container
+     *
+     * @var Less
+     */
+    protected $initialFile;
+
+    /**
+     * @var Less[]
+     */
+    protected $files = [];
+
+    /**
+     * Constructor
+     *
+     * @param LessFactory $lessFactory
+     * @param string $lessFilePath
+     * @param array $viewParams
+     * @throws \InvalidArgumentException
+     */
+    public function __construct(
+        LessFactory $lessFactory,
+        $lessFilePath = null,
+        $viewParams = []
+    ) {
+        if (empty($lessFilePath) || empty($viewParams)) {
+            throw new \InvalidArgumentException('FileList container must contain entry less file data');
+        }
+        $this->lessFactory = $lessFactory;
+        $this->initialFile = $this->createFile($lessFilePath, $viewParams);
+        $this->addFile($this->initialFile);
+    }
+
+    /**
+     * Return entry less file for this container
+     *
+     * @return Less
+     */
+    public function getInitialFile()
+    {
+        return $this->initialFile;
+    }
+
+    /**
+     * Return publication path of entry less file
+     *
+     * @return string
+     */
+    public function getPublicationPath()
+    {
+        return $this->initialFile->getPublicationPath();
+    }
+
+    /**
+     * Add file to list
+     *
+     * @param Less $file
+     * @return $this
+     */
+    public function addFile(Less $file)
+    {
+        $this->files[$file->getFileIdentifier()] = $file;
+        return $this;
+    }
+
+    /**
+     * Create instance of less file
+     *
+     * @param string $lessFilePath
+     * @param array $viewParams
+     * @return mixed
+     */
+    public function createFile($lessFilePath, $viewParams)
+    {
+        return $this->lessFactory->create(['filePath' => $lessFilePath, 'viewParams' => $viewParams]);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function current()
+    {
+        return current($this->files);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function next()
+    {
+        next($this->files);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function key()
+    {
+        return key($this->files);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function valid()
+    {
+        return (bool) current($this->files);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rewind()
+    {
+        reset($this->files);
+    }
+}
diff --git a/lib/Magento/Less/PreProcessor/File/FileListFactory.php b/lib/Magento/Less/PreProcessor/File/FileListFactory.php
new file mode 100644
index 00000000000..bed13e749d6
--- /dev/null
+++ b/lib/Magento/Less/PreProcessor/File/FileListFactory.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Less\PreProcessor\File;
+
+/**
+ * Factory class for \Magento\Less\PreProcessor\File\FileList
+ */
+class FileListFactory
+{
+    /**
+     * Object Manager instance
+     *
+     * @var \Magento\ObjectManager
+     */
+    protected $objectManager;
+
+    /**
+     * Instance name to create
+     *
+     * @var string
+     */
+    protected $instanceName;
+
+    /**
+     * Factory constructor
+     *
+     * @param \Magento\ObjectManager $objectManager
+     * @param string $instanceName
+     */
+    public function __construct(
+        \Magento\ObjectManager $objectManager,
+        $instanceName = 'Magento\Less\PreProcessor\File\FileList'
+    ) {
+        $this->objectManager = $objectManager;
+        $this->instanceName = $instanceName;
+    }
+
+    /**
+     * Create class instance with specified parameters
+     *
+     * @param array $data
+     * @return FileList
+     * @throws \UnexpectedValueException
+     */
+    public function create(array $data = array())
+    {
+        $fileList = $this->objectManager->create($this->instanceName, $data);
+        if (!$fileList instanceof FileList) {
+            throw new \UnexpectedValueException(
+                get_class($fileList) . ' doesn\'t extend \Magento\Less\PreProcessor\File\FileList'
+            );
+        }
+        return $fileList;
+    }
+}
diff --git a/lib/Magento/Less/PreProcessor/File/Less.php b/lib/Magento/Less/PreProcessor/File/Less.php
new file mode 100644
index 00000000000..2d17b07974a
--- /dev/null
+++ b/lib/Magento/Less/PreProcessor/File/Less.php
@@ -0,0 +1,201 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Less\PreProcessor\File;
+
+use Magento\View;
+
+/**
+ * Less file
+ */
+class Less
+{
+    /**
+     * Folder for publication preprocessed less files
+     */
+    const PUBLICATION_PREFIX_PATH = 'less';
+
+    /**
+     * @var View\FileSystem
+     */
+    protected $viewFileSystem;
+
+    /**
+     * @var \Magento\App\Filesystem
+     */
+    protected $filesystem;
+
+    /**
+     * @var array
+     */
+    protected $viewParams;
+
+    /**
+     * @var string
+     */
+    protected $filePath;
+
+    /**
+     * @var string
+     */
+    protected $sourcePath;
+
+    /**
+     * @var bool
+     */
+    protected $isPublished = false;
+
+    /**
+     * @param View\FileSystem $viewFileSystem
+     * @param \Magento\App\Filesystem $filesystem
+     * @param string $filePath
+     * @param array $viewParams
+     * @param string|null $sourcePath
+     */
+    public function __construct(
+        View\FileSystem $viewFileSystem,
+        \Magento\App\Filesystem $filesystem,
+        $filePath,
+        array $viewParams,
+        $sourcePath = null
+    ) {
+        $this->viewFileSystem = $viewFileSystem;
+        $this->filesystem = $filesystem;
+        $this->filePath = $filePath;
+        $this->viewParams = $viewParams;
+        $this->sourcePath = $sourcePath ?: $this->getSourcePath();
+    }
+
+    /**
+     * @return string
+     */
+    public function getFilePath()
+    {
+        return $this->filePath;
+    }
+
+    /**
+     * @return array
+     */
+    public function getViewParams()
+    {
+        return $this->viewParams;
+    }
+
+    /**
+     * Return source path of file if it's exist
+     *
+     * @return string
+     * @throws \Magento\Filesystem\FilesystemException
+     */
+    public function getSourcePath()
+    {
+        if ($this->sourcePath === null) {
+            $this->sourcePath = $this->viewFileSystem->getViewFile($this->getFilePath(), $this->getViewParams());
+            if (!$this->getDirectoryRead()->isExist($this->getDirectoryRead()->getRelativePath($this->sourcePath))) {
+                throw new \Magento\Filesystem\FilesystemException("File '{$this->sourcePath}' isn't exist");
+            }
+        }
+        return $this->sourcePath;
+    }
+
+    /**
+     * Build unique file path for publication
+     *
+     * @return string
+     */
+    public function getPublicationPath()
+    {
+        $sourcePathPrefix = $this->getDirectoryRead()->getAbsolutePath();
+        $targetPathPrefix = $this->getDirectoryWrite()->getAbsolutePath() . self::PUBLICATION_PREFIX_PATH . '/';
+        return str_replace($sourcePathPrefix, $targetPathPrefix, $this->getSourcePath());
+    }
+
+    /**
+     * @return string
+     */
+    public function getContent()
+    {
+        $directoryRead = $this->getDirectoryRead();
+        $filePath = $this->isPublished() ? $this->getPublicationPath() : $this->getSourcePath();
+        return $directoryRead->readFile($directoryRead->getRelativePath($filePath));
+    }
+
+    /**
+     * Save file content to publication path
+     *
+     * @param string $content
+     */
+    public function saveContent($content)
+    {
+        $directoryWrite = $this->getDirectoryWrite();
+        $directoryWrite->writeFile($directoryWrite->getRelativePath($this->getPublicationPath()), $content);
+        $this->isPublished = true;
+    }
+
+    /**
+     * Publishing state
+     *
+     * @return bool
+     */
+    public function isPublished()
+    {
+        return $this->isPublished;
+    }
+
+    /**
+     * Unique identifier for a file
+     *
+     * @return string
+     */
+    public function getFileIdentifier()
+    {
+        $themeIdentifier = !empty($this->viewParams['themeModel']) && $this->viewParams['themeModel']->getFullPath()
+            ? 'base'
+            : $this->viewParams['themeModel']->getFullPath();
+        $module = empty($this->viewParams['module']) ? 'base' : $this->viewParams['module'];
+        $locale = empty($this->viewParams['locale']) ? 'base' : $this->viewParams['locale'];
+        return implode('|', [$this->filePath, $module, $themeIdentifier, $locale]);
+    }
+
+    /**
+     * Get base directory with source of less files
+     *
+     * @return \Magento\Filesystem\Directory\ReadInterface
+     */
+    public function getDirectoryRead()
+    {
+        return $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR);
+    }
+
+    /**
+     * Get directory for publication temporary less files
+     *
+     * @return \Magento\Filesystem\Directory\WriteInterface
+     */
+    public function getDirectoryWrite()
+    {
+        return $this->filesystem->getDirectoryWrite(\Magento\App\Filesystem::TMP_DIR);
+    }
+}
diff --git a/lib/Magento/Less/PreProcessor/File/LessFactory.php b/lib/Magento/Less/PreProcessor/File/LessFactory.php
new file mode 100644
index 00000000000..9880d5e6666
--- /dev/null
+++ b/lib/Magento/Less/PreProcessor/File/LessFactory.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Less\PreProcessor\File;
+
+/**
+ * Factory class for \Magento\Less\PreProcessor\File\Less
+ */
+class LessFactory
+{
+    /**
+     * Object Manager instance
+     *
+     * @var \Magento\ObjectManager
+     */
+    protected $objectManager;
+
+    /**
+     * Instance name to create
+     *
+     * @var string
+     */
+    protected $instanceName;
+
+    /**
+     * Factory constructor
+     *
+     * @param \Magento\ObjectManager $objectManager
+     * @param string $instanceName
+     */
+    public function __construct(
+        \Magento\ObjectManager $objectManager,
+        $instanceName = 'Magento\Less\PreProcessor\File\Less'
+    ) {
+        $this->objectManager = $objectManager;
+        $this->instanceName = $instanceName;
+    }
+
+    /**
+     * Create class instance with specified parameters
+     *
+     * @param array $data
+     * @return \Magento\Less\PreProcessor\File\Less
+     * @throws \UnexpectedValueException
+     */
+    public function create(array $data = array())
+    {
+        $fileLessProcessor = $this->objectManager->create($this->instanceName, $data);
+        if (!$fileLessProcessor instanceof Less) {
+            throw new \UnexpectedValueException(
+                get_class($fileLessProcessor) . ' doesn\'t extend \Magento\Less\PreProcessor\File\Less'
+            );
+        }
+        return $fileLessProcessor;
+    }
+}
diff --git a/lib/Magento/Less/PreProcessor/Instruction/Import.php b/lib/Magento/Less/PreProcessor/Instruction/Import.php
index 1f842193108..55645e42566 100644
--- a/lib/Magento/Less/PreProcessor/Instruction/Import.php
+++ b/lib/Magento/Less/PreProcessor/Instruction/Import.php
@@ -26,6 +26,7 @@ namespace Magento\Less\PreProcessor\Instruction;
 
 use Magento\Less\PreProcessorInterface;
 use Magento\Less\PreProcessor;
+use Magento\View;
 
 /**
  * Less @import instruction preprocessor
@@ -39,58 +40,60 @@ class Import implements PreProcessorInterface
         '#@import\s+(\((?P<type>\w+)\)\s+)?[\'\"](?P<path>(?![/\\\]|\w:[/\\\])[^\"\']+)[\'\"]\s*?(?P<media>.*?);#';
 
     /**
-     * @var \Magento\Less\PreProcessor
+     * @var PreProcessor\File\FileList
      */
-    protected $preProcessor;
+    protected $fileList;
 
     /**
-     * @var \Magento\View\RelatedFile
+     * Pre-processor error handler
+     *
+     * @var PreProcessor\ErrorHandlerInterface
      */
-    protected $relatedFile;
+    protected $errorHandler;
 
     /**
-     * @var PreProcessor\ErrorHandlerInterface
+     * Related file
+     *
+     * @var View\RelatedFile
      */
-    protected $errorHandler;
+    protected $relatedFile;
 
     /**
-     * @param PreProcessor $preProcessor
+     * @param View\RelatedFile $relatedFile
      * @param PreProcessor\ErrorHandlerInterface $errorHandler
-     * @param \Magento\View\RelatedFile $relatedFile
+     * @param PreProcessor\File\FileList $fileList
      */
     public function __construct(
-        PreProcessor $preProcessor,
+        View\RelatedFile $relatedFile,
         PreProcessor\ErrorHandlerInterface $errorHandler,
-        \Magento\View\RelatedFile $relatedFile
+        PreProcessor\File\FileList $fileList
     ) {
-        $this->preProcessor = $preProcessor;
-        $this->errorHandler = $errorHandler;
         $this->relatedFile = $relatedFile;
+        $this->errorHandler = $errorHandler;
+        $this->fileList = $fileList;
     }
 
     /**
      * Explode import paths
      *
+     * @param \Magento\Less\PreProcessor\File\Less $lessFile
      * @param array $matchedPaths
-     * @param array $viewParams
-     * @param array $params
      * @return array
      */
-    protected function generatePaths($matchedPaths, $viewParams, array $params)
+    protected function generatePaths(PreProcessor\File\Less $lessFile, $matchedPaths)
     {
         $importPaths = array();
         foreach ($matchedPaths as $path) {
-            $resolvedPath = $this->relatedFile->buildPath(
-                $this->preparePath($path),
-                $params['parentAbsolutePath'],
-                $params['parentPath'],
-                $viewParams
-            );
             try {
-                $importPaths[$path] = $this->preProcessor->processLessInstructions(
-                    $resolvedPath,
+                $viewParams = $lessFile->getViewParams();
+                $resolvedPath = $this->relatedFile->buildPath(
+                    $this->preparePath($path),
+                    $lessFile->getFilePath(),
                     $viewParams
                 );
+                $importedLessFile = $this->fileList->createFile($resolvedPath, $viewParams);
+                $this->fileList->addFile($importedLessFile);
+                $importPaths[$path] = $importedLessFile->getPublicationPath();
             } catch (\Magento\Filesystem\FilesystemException $e) {
                 $this->errorHandler->processException($e);
             }
@@ -112,11 +115,11 @@ class Import implements PreProcessorInterface
     /**
      * {@inheritdoc}
      */
-    public function process($lessContent, array $viewParams, array $params = [])
+    public function process(PreProcessor\File\Less $lessFile, $lessContent)
     {
         $matches = [];
         preg_match_all(self::REPLACE_PATTERN, $lessContent, $matches);
-        $importPaths = $this->generatePaths($matches['path'], $viewParams, $params);
+        $importPaths = $this->generatePaths($lessFile, $matches['path']);
         $replaceCallback = function ($matchContent) use ($importPaths) {
             return $this->replace($matchContent, $importPaths);
         };
@@ -127,17 +130,17 @@ class Import implements PreProcessorInterface
      * Replace import path to file
      *
      * @param array $matchContent
-     * @param $importPaths
+     * @param array $importPaths
      * @return string
      */
     protected function replace($matchContent, $importPaths)
     {
-        $path = $matchContent['path'];
-        if (empty($importPaths[$path])) {
+        if (empty($importPaths[$matchContent['path']])) {
             return '';
         }
-        $typeString  = empty($matchContent['type']) ? '' : '(' . $matchContent['type'] . ') ';
-        $mediaString  = empty($matchContent['media']) ? '' : ' ' . $matchContent['media'];
-        return "@import {$typeString}'{$importPaths[$path]}'{$mediaString};";
+        $filePath = $importPaths[$matchContent['path']];
+        $typeString = empty($matchContent['type']) ? '' : '(' . $matchContent['type'] . ') ';
+        $mediaString = empty($matchContent['media']) ? '' : ' ' . $matchContent['media'];
+        return "@import {$typeString}'{$filePath}'{$mediaString};";
     }
 }
diff --git a/lib/Magento/Less/PreProcessor/Instruction/MagentoImport.php b/lib/Magento/Less/PreProcessor/Instruction/MagentoImport.php
index f54dadd8e05..71d2c52e2db 100644
--- a/lib/Magento/Less/PreProcessor/Instruction/MagentoImport.php
+++ b/lib/Magento/Less/PreProcessor/Instruction/MagentoImport.php
@@ -26,6 +26,7 @@ namespace Magento\Less\PreProcessor\Instruction;
 
 use Magento\Less\PreProcessor;
 use Magento\Less\PreProcessorInterface;
+use Magento\View;
 
 /**
  * Less @magento_import instruction preprocessor
@@ -38,35 +39,43 @@ class MagentoImport implements PreProcessorInterface
     const REPLACE_PATTERN = '#//@magento_import\s+[\'\"](?P<path>(?![/\\\]|\w:[/\\\])[^\"\']+)[\'\"]\s*?;#';
 
     /**
+     * Layout file source
+     *
      * @var \Magento\View\Layout\File\SourceInterface
      */
     protected $fileSource;
 
     /**
+     * Pre-processor error handler
+     *
      * @var PreProcessor\ErrorHandlerInterface
      */
     protected $errorHandler;
 
     /**
+     * Related file
+     *
      * @var \Magento\View\RelatedFile
      */
     protected $relatedFile;
 
     /**
+     * View service
+     *
      * @var \Magento\View\Service
      */
     protected $viewService;
 
     /**
-     * @param \Magento\View\Layout\File\SourceInterface $fileSource
-     * @param \Magento\View\Service $viewService
-     * @param \Magento\View\RelatedFile $relatedFile
+     * @param View\Layout\File\SourceInterface $fileSource
+     * @param View\Service $viewService
+     * @param View\RelatedFile $relatedFile
      * @param PreProcessor\ErrorHandlerInterface $errorHandler
      */
     public function __construct(
-        \Magento\View\Layout\File\SourceInterface $fileSource,
-        \Magento\View\Service $viewService,
-        \Magento\View\RelatedFile $relatedFile,
+        View\Layout\File\SourceInterface $fileSource,
+        View\Service $viewService,
+        View\RelatedFile $relatedFile,
         PreProcessor\ErrorHandlerInterface $errorHandler
     ) {
         $this->fileSource = $fileSource;
@@ -78,11 +87,13 @@ class MagentoImport implements PreProcessorInterface
     /**
      * {@inheritdoc}
      */
-    public function process($lessContent, array $viewParams, array $paths = [])
+    public function process(PreProcessor\File\Less $lessFile, $lessContent)
     {
+        $viewParams = $lessFile->getViewParams();
+        $parentPath = $lessFile->getFilePath();
         $this->viewService->updateDesignParams($viewParams);
-        $replaceCallback = function ($matchContent) use ($viewParams, $paths) {
-            return $this->replace($matchContent, $viewParams, $paths);
+        $replaceCallback = function ($matchContent) use ($viewParams, $parentPath) {
+            return $this->replace($matchContent, $viewParams, $parentPath);
         };
         return preg_replace_callback(self::REPLACE_PATTERN, $replaceCallback, $lessContent);
     }
@@ -92,23 +103,20 @@ class MagentoImport implements PreProcessorInterface
      *
      * @param array $matchContent
      * @param array $viewParams
-     * @param array $paths
+     * @param string $parentPath
      * @return string
      */
-    protected function replace($matchContent, $viewParams, $paths)
+    protected function replace($matchContent, $viewParams, $parentPath)
     {
         $importsContent = '';
         try {
-            $resolvedPath = $this->relatedFile->buildPath(
-                $matchContent['path'],
-                $paths['parentAbsolutePath'],
-                $paths['parentPath'],
-                $viewParams
-            );
+            $resolvedPath = $this->relatedFile->buildPath($matchContent['path'], $parentPath, $viewParams);
             $importFiles = $this->fileSource->getFiles($viewParams['themeModel'], $resolvedPath);
             /** @var $importFile \Magento\View\Layout\File */
             foreach ($importFiles as $importFile) {
-                $importsContent .= "@import '{$importFile->getFilename()}';\n";
+                $importsContent .=  $importFile->getModule()
+                    ? "@import '{$importFile->getModule()}::{$resolvedPath}';\n"
+                    : "@import '{$matchContent['path']}';\n";
             }
         } catch (\LogicException $e) {
             $this->errorHandler->processException($e);
diff --git a/lib/Magento/Less/PreProcessor/InstructionFactory.php b/lib/Magento/Less/PreProcessor/InstructionFactory.php
index 1118454c72d..bb635f68fac 100644
--- a/lib/Magento/Less/PreProcessor/InstructionFactory.php
+++ b/lib/Magento/Less/PreProcessor/InstructionFactory.php
@@ -34,7 +34,7 @@ class InstructionFactory
      *
      * @var \Magento\ObjectManager
      */
-    protected $_objectManager;
+    protected $objectManager;
 
     /**
      * Factory constructor
@@ -43,22 +43,23 @@ class InstructionFactory
      */
     public function __construct(\Magento\ObjectManager $objectManager)
     {
-        $this->_objectManager = $objectManager;
+        $this->objectManager = $objectManager;
     }
 
     /**
      * Create class instance with specified parameters
      *
      * @param string $className
+     * @param array $data
      * @return \Magento\Less\PreProcessorInterface
      * @throws \InvalidArgumentException
      */
-    public function create($className)
+    public function create($className, array $data = [])
     {
-        $preProcessor = $this->_objectManager->create($className);
+        $preProcessor = $this->objectManager->create($className, $data);
         if (!$preProcessor instanceof \Magento\Less\PreProcessorInterface) {
             throw new \InvalidArgumentException(
-                "{$className} aren't instance of \\Magento\\Less\\PreProcessorInterface"
+                "{$className} doesn't implement \\Magento\\Less\\PreProcessorInterface"
             );
         }
         return $preProcessor;
diff --git a/lib/Magento/Less/PreProcessorInterface.php b/lib/Magento/Less/PreProcessorInterface.php
index a68ba7b1cff..40f3c44e148 100644
--- a/lib/Magento/Less/PreProcessorInterface.php
+++ b/lib/Magento/Less/PreProcessorInterface.php
@@ -32,10 +32,9 @@ interface PreProcessorInterface
     /**
      * Process less content to adapt magento view system
      *
+     * @param PreProcessor\File\Less $lessFile
      * @param string $lessContent
-     * @param array $viewParams
-     * @param array $params
      * @return string of processed content
      */
-    public function process($lessContent, array $viewParams, array $params = []);
+    public function process(PreProcessor\File\Less $lessFile, $lessContent);
 }
diff --git a/app/code/Magento/Core/Model/Log/Adapter.php b/lib/Magento/Logger/Adapter.php
similarity index 93%
rename from app/code/Magento/Core/Model/Log/Adapter.php
rename to lib/Magento/Logger/Adapter.php
index e6ed6be0331..1fefbbf1d82 100644
--- a/app/code/Magento/Core/Model/Log/Adapter.php
+++ b/lib/Magento/Logger/Adapter.php
@@ -18,25 +18,19 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Core
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Logger;
 
 /**
  * Log Adapter
- *
- * @category   Magento
- * @package    Magento_Core
- * @author     Magento Core Team <core@magentocommerce.com>
  */
-namespace Magento\Core\Model\Log;
-
 class Adapter
 {
- /**
-     * Store log file name
+
+    /**
+     * Log file name
      *
      * @var string
      */
@@ -101,7 +95,6 @@ class Adapter
      * @param string|array $key
      * @param mixed $value
      * @return $this
-     * @todo replace whole data
      */
     public function setData($key, $value = null)
     {
diff --git a/app/code/Magento/Email/Model/Transport.php b/lib/Magento/Mail/Exception.php
similarity index 86%
rename from app/code/Magento/Email/Model/Transport.php
rename to lib/Magento/Mail/Exception.php
index 7e08b9ac711..50de73a3361 100644
--- a/app/code/Magento/Email/Model/Transport.php
+++ b/lib/Magento/Mail/Exception.php
@@ -18,16 +18,13 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Email
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\Mail;
 
-namespace Magento\Email\Model;
-
-class Transport extends \Zend_Mail_Transport_Sendmail
+class Exception extends \Exception
 {
 
 }
diff --git a/lib/Magento/Mail/Message.php b/lib/Magento/Mail/Message.php
index bfb53e4cbf6..f85771aa851 100644
--- a/lib/Magento/Mail/Message.php
+++ b/lib/Magento/Mail/Message.php
@@ -28,7 +28,7 @@ namespace Magento\Mail;
 class Message extends \Zend_Mail implements MessageInterface
 {
     /**
-     * Body
+     * Message type
      *
      * @var string
      */
@@ -55,49 +55,6 @@ class Message extends \Zend_Mail implements MessageInterface
         return $this->messageType == self::TYPE_TEXT ? $this->getBodyText() : $this->getBodyHtml();
     }
 
-    /**
-     * Set to address
-     *
-     * @param string|array $toAddress
-     * @return $this
-     */
-    public function setTo($toAddress)
-    {
-        return $this->addTo($toAddress);
-    }
-
-    /**
-     * Set cc address
-     * @param string|array $ccAddress
-     * @return $this
-     */
-    public function setCc($ccAddress)
-    {
-        return $this->addCc($ccAddress);
-    }
-
-    /**
-     * Set bcc address
-     *
-     * @param string|array $bccAddress
-     * @return $this
-     */
-    public function setBcc($bccAddress)
-    {
-        return $this->addBcc($bccAddress);
-    }
-
-    /**
-     * Set reply-to address
-     *
-     * @param string|array $replyToAddress
-     * @return $this
-     */
-    public function addReplyTo($replyToAddress)
-    {
-        return $this->addBcc($replyToAddress);
-    }
-
     /**
      * Set message type
      *
diff --git a/lib/Magento/Mail/MessageInterface.php b/lib/Magento/Mail/MessageInterface.php
index d7d60ec5e1f..cef9b4d469e 100644
--- a/lib/Magento/Mail/MessageInterface.php
+++ b/lib/Magento/Mail/MessageInterface.php
@@ -71,14 +71,6 @@ interface MessageInterface
      */
     public function setFrom($fromAddress);
 
-    /**
-     * Set to address
-     *
-     * @param string|array $toAddress
-     * @return $this
-     */
-    public function setTo($toAddress);
-
     /**
      * Add to address
      *
@@ -87,13 +79,6 @@ interface MessageInterface
      */
     public function addTo($toAddress);
 
-    /**
-     * Set cc address
-     * @param string|array $ccAddress
-     * @return $this
-     */
-    public function setCc($ccAddress);
-
     /**
      * Add cc address
      *
@@ -102,14 +87,6 @@ interface MessageInterface
      */
     public function addCc($ccAddress);
 
-    /**
-     * Set bcc address
-     *
-     * @param string|array $bccAddress
-     * @return $this
-     */
-    public function setBcc($bccAddress);
-
     /**
      * Add bcc address
      *
@@ -126,14 +103,6 @@ interface MessageInterface
      */
     public function setReplyTo($replyToAddress);
 
-    /**
-     * Add reply-to address
-     *
-     * @param string|array $replyToAddress
-     * @return $this
-     */
-    public function addReplyTo($replyToAddress);
-
     /**
      * Set message type
      *
diff --git a/lib/Magento/Mail/Template/Factory.php b/lib/Magento/Mail/Template/Factory.php
new file mode 100644
index 00000000000..b37582a99b7
--- /dev/null
+++ b/lib/Magento/Mail/Template/Factory.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Mail Template Factory
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Mail\Template;
+
+class Factory implements \Magento\Mail\Template\FactoryInterface
+{
+    /**
+     * @var \Magento\ObjectManager
+     */
+    protected $_objectManager = null;
+
+    /**
+     * @var string
+     */
+    protected $_instanceName = null;
+
+    /**
+     * @param \Magento\ObjectManager $objectManager
+     * @param string $instanceName
+     */
+    public function __construct(\Magento\ObjectManager $objectManager, $instanceName = 'Magento\Mail\TemplateInterface')
+    {
+        $this->_objectManager = $objectManager;
+        $this->_instanceName = $instanceName;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function get($identifier)
+    {
+        return $this->_objectManager->create(
+            $this->_instanceName,
+            array('data' => array('template_id' => $identifier))
+        );
+    }
+}
diff --git a/lib/Magento/Mail/Template/FactoryInterface.php b/lib/Magento/Mail/Template/FactoryInterface.php
index 462f63669d0..d94523e8fa4 100644
--- a/lib/Magento/Mail/Template/FactoryInterface.php
+++ b/lib/Magento/Mail/Template/FactoryInterface.php
@@ -29,7 +29,7 @@ interface FactoryInterface
 {
     /**
      * @param string $identifier
-     * @return \Magento\Mail\Template\TemplateInterface
+     * @return \Magento\Mail\TemplateInterface
      */
     public function get($identifier);
 }
\ No newline at end of file
diff --git a/lib/Magento/Mail/Template/SenderResolverInterface.php b/lib/Magento/Mail/Template/SenderResolverInterface.php
new file mode 100644
index 00000000000..ff1ad7b028d
--- /dev/null
+++ b/lib/Magento/Mail/Template/SenderResolverInterface.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Mail Sender Resolver interface
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Mail\Template;
+
+interface SenderResolverInterface
+{
+    /**
+     * Resolve sender data
+     * @throws \Magento\Mail\Exception
+     * @param string|array $sender
+     * @param int|null $scopeId
+     * @return array
+     */
+    public function resolve($sender, $scopeId = null);
+}
diff --git a/lib/Magento/Mail/Template/TransportBuilder.php b/lib/Magento/Mail/Template/TransportBuilder.php
index 149e54fefc7..6a54ef1bcfa 100644
--- a/lib/Magento/Mail/Template/TransportBuilder.php
+++ b/lib/Magento/Mail/Template/TransportBuilder.php
@@ -76,42 +76,92 @@ class TransportBuilder
      */
     protected $message;
 
+    /**
+     * Sender resolver
+     *
+     * @var \Magento\Mail\Template\SenderResolverInterface
+     */
+    protected $_senderResolver;
+
     /**
      * @param FactoryInterface $templateFactory
      * @param \Magento\Mail\Message $message
+     * @param \Magento\Mail\Template\SenderResolverInterface $senderResolver
      * @param \Magento\ObjectManager $objectManager
      */
     public function __construct(
         \Magento\Mail\Template\FactoryInterface $templateFactory,
         \Magento\Mail\Message $message,
+        \Magento\Mail\Template\SenderResolverInterface $senderResolver,
         \Magento\ObjectManager $objectManager
     ) {
         $this->templateFactory = $templateFactory;
         $this->message = $message;
         $this->objectManager = $objectManager;
+        $this->_senderResolver = $senderResolver;
     }
 
     /**
      * Add cc address
      *
      * @param array|string $address
+     * @param string $name
+     * @return $this
+     */
+    public function addCc($address, $name = '')
+    {
+        $this->message->addCc($address, $name);
+        return $this;
+    }
+
+    /**
+     * Add to address
+     *
+     * @param array|string $address
+     * @param string $name
+     * @return $this
+     */
+    public function addTo($address, $name = '')
+    {
+        $this->message->addTo($address, $name);
+        return $this;
+    }
+
+    /**
+     * Add bcc address
+     *
+     * @param array|string $address
+     * @return $this
+     */
+    public function addBcc($address)
+    {
+        $this->message->addBcc($address);
+        return $this;
+    }
+
+    /**
+     * Set Reply-To Header
+     *
+     * @param string $email
+     * @param string|null $name
      * @return $this
      */
-    public function addCc($address)
+    public function setReplyTo($email, $name = null)
     {
-        $this->message->addCc($address);
+        $this->message->setReplyTo($email, $name);
         return $this;
     }
 
     /**
      * Set mail from address
      *
-     * @param string $from
+     * @param string|array $from
      * @return $this
      */
     public function setFrom($from)
     {
-        $this->message->setFrom($from);
+        $result = $this->_senderResolver->resolve($from);
+        $this->message->setFrom($result['email'], $result['name']);
         return $this;
     }
 
@@ -158,19 +208,62 @@ class TransportBuilder
      */
     public function getTransport()
     {
-        $template = $this->templateFactory->get($this->templateIdentifier)
+        $this->prepareMessage();
+
+        $result = $this->objectManager->create('Magento\Mail\TransportInterface', array(
+            'message' => clone $this->message
+        ));
+
+        $this->reset();
+
+        return $result;
+    }
+
+    /**
+     * Reset object state
+     *
+     * @return $this
+     */
+    protected function reset()
+    {
+        $this->message = $this->objectManager->create('Magento\Mail\Message');
+        $this->templateIdentifier = null;
+        $this->templateVars = null;
+        $this->templateOptions = null;
+        return $this;
+    }
+
+    /**
+     * Get template
+     *
+     * @return \Magento\Mail\TemplateInterface
+     */
+    protected function getTemplate()
+    {
+        return $this->templateFactory->get($this->templateIdentifier)
             ->setVars($this->templateVars)
             ->setOptions($this->templateOptions);
+    }
+
+    /**
+     * Prepare message
+     *
+     * @return $this
+     */
+    protected function prepareMessage()
+    {
+        $template = $this->getTemplate();
         $types = array(
-            \Magento\Mail\Template\TemplateInterface::TYPE_TEXT => \Magento\Mail\MessageInterface::TYPE_TEXT,
-            \Magento\Mail\Template\TemplateInterface::TYPE_HTML => \Magento\Mail\MessageInterface::TYPE_HTML,
+            \Magento\App\TemplateTypesInterface::TYPE_TEXT => \Magento\Mail\MessageInterface::TYPE_TEXT,
+            \Magento\App\TemplateTypesInterface::TYPE_HTML => \Magento\Mail\MessageInterface::TYPE_HTML,
         );
 
-        $this->message->setMessageType($types[$template->getType()])
-            ->setBody($template->processTemplate())
+        $body = $template->processTemplate();
+        $this->message
+            ->setMessageType($types[$template->getType()])
+            ->setBody($body)
             ->setSubject($template->getSubject());
 
-        return $this->objectManager->create('\Magento\Mail\TransportInterface', array('message' => $this->message));
-
+        return $this;
     }
-}
\ No newline at end of file
+}
diff --git a/lib/Magento/Mail/Template/TemplateInterface.php b/lib/Magento/Mail/TemplateInterface.php
similarity index 81%
rename from lib/Magento/Mail/Template/TemplateInterface.php
rename to lib/Magento/Mail/TemplateInterface.php
index 0961a2932af..cc4264c17d3 100644
--- a/lib/Magento/Mail/Template/TemplateInterface.php
+++ b/lib/Magento/Mail/TemplateInterface.php
@@ -23,16 +23,10 @@
  * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Mail\Template;
+namespace Magento\Mail;
 
-interface TemplateInterface
+interface TemplateInterface extends \Magento\App\TemplateTypesInterface
 {
-    /**
-     * Types of template
-     */
-    const TYPE_TEXT = 1;
-    const TYPE_HTML = 2;
-
     /**
      * Get processed template
      *
@@ -47,20 +41,13 @@ interface TemplateInterface
      */
     public function getSubject();
 
-    /**
-     * Get Type
-     *
-     * @return int
-     */
-    public function getType();
-
     /**
      * Set template variables
      *
      * @param array $vars
      * @return $this
      */
-    public function setVars($vars);
+    public function setVars(array $vars);
 
     /**
      * Set template options
@@ -68,5 +55,5 @@ interface TemplateInterface
      * @param array $options
      * @return $this
      */
-    public function setOptions($options);
+    public function setOptions(array $options);
 }
diff --git a/lib/Magento/Mail/Transport.php b/lib/Magento/Mail/Transport.php
index ea3efb37b9b..64c410d1255 100644
--- a/lib/Magento/Mail/Transport.php
+++ b/lib/Magento/Mail/Transport.php
@@ -27,16 +27,35 @@ namespace Magento\Mail;
 class Transport extends \Zend_Mail_Transport_Sendmail implements \Magento\Mail\TransportInterface
 {
     /**
-     * Send a mail using this transport
-     *
-     * @param \Magento\Mail\MessageInterface $message
+     * @var \Magento\Mail\MessageInterface
+     */
+    protected $_message;
+
+    /**
+     * @param MessageInterface $message
+     * @param null $parameters
      * @throws \InvalidArgumentException
      */
-    public function sendMessage(\Magento\Mail\MessageInterface $message)
+    public function __construct(\Magento\Mail\MessageInterface $message, $parameters = null)
     {
         if (!$message instanceof \Zend_Mail) {
             throw new \InvalidArgumentException('The message should be an instance of \Zend_Mail');
         }
-        parent::send($message);
+        parent::__construct($parameters);
+        $this->_message = $message;
+    }
+
+    /**
+     * Send a mail using this transport
+     *
+     * @throws \Magento\Mail\Exception
+     */
+    public function sendMessage()
+    {
+        try {
+            parent::send($this->_message);
+        } catch (\Exception $e) {
+            throw new \Magento\Mail\Exception($e->getMessage(), $e->getCode(), $e);
+        }
     }
 }
diff --git a/lib/Magento/Mail/TransportInterface.php b/lib/Magento/Mail/TransportInterface.php
index 11ec3d6e7ca..bc019c5520c 100644
--- a/lib/Magento/Mail/TransportInterface.php
+++ b/lib/Magento/Mail/TransportInterface.php
@@ -30,7 +30,7 @@ interface TransportInterface
     /**
      * Send a mail using this transport
      *
-     * @param \Magento\Mail\MessageInterface $message
+     * @throws \Magento\Mail\Exception
      */
-    public function sendMessage(\Magento\Mail\MessageInterface $message);
+    public function sendMessage();
 }
diff --git a/app/code/Magento/Core/Model/Calculator.php b/lib/Magento/Math/Calculator.php
similarity index 73%
rename from app/code/Magento/Core/Model/Calculator.php
rename to lib/Magento/Math/Calculator.php
index b3082090cf2..3e9f17c22f9 100644
--- a/app/code/Magento/Core/Model/Calculator.php
+++ b/lib/Magento/Math/Calculator.php
@@ -18,22 +18,14 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Core
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
+namespace Magento\Math;
 
 /**
- * Calculations model
- *
- * @category    Magento
- * @package     Magento_Core
- * @author      Magento Core Team <core@magentocommerce.com>
+ * Calculations Library
  */
-namespace Magento\Core\Model;
-
 class Calculator
 {
     /**
@@ -46,22 +38,18 @@ class Calculator
     /**
      * Store instance
      *
-     * @var Store|null
+     * @var \Magento\BaseScopeInterface|null
      */
-    protected $_store = null;
+    protected $_scope = null;
 
     /**
      * Initialize calculator
      *
-     * @param Store|int $store
-     * @param StoreManagerInterface $storeManager
+     * @param \Magento\BaseScopeInterface
      */
-    public function __construct($store, StoreManagerInterface $storeManager)
+    public function __construct(\Magento\BaseScopeInterface $scope)
     {
-        if (!($store instanceof \Magento\Core\Model\Store)) {
-            $store = $storeManager->getStore($store);
-        }
-        $this->_store = $store;
+        $this->_scope = $scope;
     }
 
     /**
@@ -79,7 +67,7 @@ class Calculator
                 $this->_delta = -$this->_delta;
             }
             $price  += $this->_delta;
-            $roundedPrice = $this->_store->roundPrice($price);
+            $roundedPrice = $this->_scope->roundPrice($price);
             $this->_delta = $price - $roundedPrice;
             if ($negative) {
                 $this->_delta = -$this->_delta;
diff --git a/app/code/Magento/Core/Model/Context.php b/lib/Magento/Model/Context.php
similarity index 98%
rename from app/code/Magento/Core/Model/Context.php
rename to lib/Magento/Model/Context.php
index b24824dd376..6fda9df5430 100644
--- a/app/code/Magento/Core/Model/Context.php
+++ b/lib/Magento/Model/Context.php
@@ -23,7 +23,7 @@
  * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Core\Model;
+namespace Magento\Model;
 
 class Context implements \Magento\ObjectManager\ContextInterface
 {
diff --git a/app/code/Magento/Core/Model/Option/ArrayInterface.php b/lib/Magento/Option/ArrayInterface.php
similarity index 96%
rename from app/code/Magento/Core/Model/Option/ArrayInterface.php
rename to lib/Magento/Option/ArrayInterface.php
index 4a7a45ac284..3c044e481bb 100644
--- a/app/code/Magento/Core/Model/Option/ArrayInterface.php
+++ b/lib/Magento/Option/ArrayInterface.php
@@ -21,12 +21,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-
-namespace Magento\Core\Model\Option;
+namespace Magento\Option;
 
 /**
  * @todo Remove in favor of the ancestor interface
  */
 interface ArrayInterface extends \Magento\Data\OptionSourceInterface
 {
-}
+}
\ No newline at end of file
diff --git a/app/code/Magento/Core/Model/Option/ArrayPool.php b/lib/Magento/Option/ArrayPool.php
similarity index 82%
rename from app/code/Magento/Core/Model/Option/ArrayPool.php
rename to lib/Magento/Option/ArrayPool.php
index 60e52a1e1c8..ddb5ffe0bdc 100644
--- a/app/code/Magento/Core/Model/Option/ArrayPool.php
+++ b/lib/Magento/Option/ArrayPool.php
@@ -18,12 +18,10 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Core
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Core\Model\Option;
+namespace Magento\Option;
 
 /**
  * Array optioned object factory
@@ -48,14 +46,14 @@ class ArrayPool
      *
      * @param string $model
      * @throws \InvalidArgumentException
-     * @return \Magento\Core\Model\Option\ArrayInterface
+     * @return \Magento\Option\ArrayInterface
      */
     public function get($model)
     {
         $modelInstance = $this->_objectManager->get($model);
-        if (false == ($modelInstance instanceof \Magento\Core\Model\Option\ArrayInterface)) {
+        if (false == ($modelInstance instanceof \Magento\Option\ArrayInterface)) {
             throw new \InvalidArgumentException(
-                $model . 'doesn\'t implement \Magento\Core\Model\Option\ArrayInterface'
+                $model . 'doesn\'t implement \Magento\Option\ArrayInterface'
             );
         }
         return $modelInstance;
diff --git a/lib/Magento/Pear.php b/lib/Magento/Pear.php
index fc36991d412..c26a7a46461 100644
--- a/lib/Magento/Pear.php
+++ b/lib/Magento/Pear.php
@@ -33,9 +33,9 @@
  */
 namespace Magento;
 
-use Magento\Exception;
-use Magento\Pear\Frontend;
-use Magento\Pear\Registry;
+use \Magento\Exception;
+use \Magento\Pear\Frontend;
+use \Magento\Pear\Registry as PearRegistry;
 
 // Looks like PEAR is being developed without E_NOTICE (1.7.0RC1)
 error_reporting(E_ALL & ~E_NOTICE);
@@ -56,14 +56,6 @@ if (strpos($_includePath, $_pearPhpDir) === false) {
     set_include_path($_includePath);
 }
 
-// include necessary PEAR libs
-//require_once $_pearPhpDir."/PEAR.php";
-//require_once $_pearPhpDir."/PEAR/Frontend.php";
-//require_once $_pearPhpDir."/PEAR/Registry.php";
-//require_once $_pearPhpDir."/PEAR/Config.php";
-//require_once $_pearPhpDir."/PEAR/Command.php";
-//require_once $_pearPhpDir."/PEAR/Exception.php";
-
 require_once __DIR__ . "/Pear/Frontend.php";
 require_once __DIR__ . "/Pear/Package.php";
 
@@ -77,7 +69,7 @@ class Pear
     protected $_config;
 
     /**
-     * @var Registry
+     * @var PearRegistry
      */
     protected $_registry;
 
@@ -101,7 +93,7 @@ class Pear
      */
     static public $reloadOnRegistryUpdate = true;
 
-    
+
     public function __construct()
     {
         $this->getConfig();
@@ -200,12 +192,12 @@ class Pear
 
     /**
      * @param bool $redirectOnChange
-     * @return Registry
+     * @return PearRegistry
      */
     public function getRegistry($redirectOnChange=true)
     {
         if (!$this->_registry) {
-            $this->_registry = new Registry($this->getPearDir() . '/php');
+            $this->_registry = new PearRegistry($this->getPearDir() . '/php');
 
             $changed = false;
             foreach ($this->getMagentoChannels() as $channel) {
@@ -216,7 +208,7 @@ class Pear
             }
 
             if ($changed) {
-                $this->_registry = new \Magento\Pear\Registry($this->getPearDir() . '/php');
+                $this->_registry = new PearRegistry($this->getPearDir() . '/php');
             }
 //            if ($changed && self::$reloadOnRegistryUpdate && empty($_GET['pear_registry'])) {
 //                echo "TEST:";
diff --git a/app/code/Magento/Core/Model/Registry.php b/lib/Magento/Registry.php
similarity index 96%
rename from app/code/Magento/Core/Model/Registry.php
rename to lib/Magento/Registry.php
index c81cbd3fb96..428fae997da 100644
--- a/app/code/Magento/Core/Model/Registry.php
+++ b/lib/Magento/Registry.php
@@ -18,12 +18,10 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @category    Magento
- * @package     Magento_Core
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Core\Model;
+namespace Magento;
 
 /**
  * Registry model. Used to manage values in registry
diff --git a/lib/Magento/Service/Entity/AbstractDto.php b/lib/Magento/Service/Entity/AbstractDto.php
index fd9dda8d8ff..c1c884381db 100644
--- a/lib/Magento/Service/Entity/AbstractDto.php
+++ b/lib/Magento/Service/Entity/AbstractDto.php
@@ -38,8 +38,9 @@ abstract class AbstractDto
      * Initialize internal storage
      *
      * @param array $data
+     * @throws \InvalidArgumentException
      */
-    public function __construct(array $data)
+    public function __construct($data)
     {
         $this->_data = $data;
     }
diff --git a/lib/Magento/Service/Entity/AbstractDtoBuilder.php b/lib/Magento/Service/Entity/AbstractDtoBuilder.php
index 95c2e601b93..079594c1648 100644
--- a/lib/Magento/Service/Entity/AbstractDtoBuilder.php
+++ b/lib/Magento/Service/Entity/AbstractDtoBuilder.php
@@ -21,6 +21,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Service\Entity;
 
 abstract class AbstractDtoBuilder
@@ -52,7 +53,6 @@ abstract class AbstractDtoBuilder
     /**
      * Populates the fields with data from the array.
      *
-     * The $data array should be a map that only contain scalar types or arrays of scalar types.
      * Keys for the map are snake_case attribute/field names.
      *
      * @param array $data
@@ -74,6 +74,32 @@ abstract class AbstractDtoBuilder
         return $this;
     }
 
+    /**
+     * Merge second DTO data with first DTO data and create new DTO object based on merge result.
+     *
+     * @param AbstractDto $firstDto
+     * @param AbstractDto $secondDto
+     * @return AbstractDto
+     */
+    public function mergeDtos(AbstractDto $firstDto, AbstractDto $secondDto)
+    {
+        $this->_data = array_merge($firstDto->__toArray(), $secondDto->__toArray());
+        return $this->create();
+    }
+
+    /**
+     * Merged data provided in array format with DTO data and create new DTO object based on merge result.
+     *
+     * @param AbstractDto $dto
+     * @param array $data
+     * @return AbstractDto
+     */
+    public function mergeDtoWithArray(AbstractDto $dto, array $data)
+    {
+        $this->_data = array_merge($dto->__toArray(), $data);
+        return $this->create();
+    }
+
     /**
      * Builds the entity.
      *
diff --git a/lib/Magento/View/Asset/PreProcessor/Composite.php b/lib/Magento/View/Asset/PreProcessor/Composite.php
index 03397049a81..02786e4e5fe 100644
--- a/lib/Magento/View/Asset/PreProcessor/Composite.php
+++ b/lib/Magento/View/Asset/PreProcessor/Composite.php
@@ -69,21 +69,17 @@ class Composite implements PreProcessorInterface
     /**
      * Process view asset pro-processors
      *
-     * @param string $filePath
-     * @param array $params
+     * @param \Magento\View\Publisher\FileInterface $publisherFile
      * @param \Magento\Filesystem\Directory\WriteInterface $targetDirectory
-     * @param null|string $sourcePath
-     * @return null|string
+     * @return \Magento\View\Publisher\FileInterface
      */
-    public function process($filePath, $params, $targetDirectory, $sourcePath = null)
+    public function process(\Magento\View\Publisher\FileInterface $publisherFile, $targetDirectory)
     {
-        $assetType = pathinfo($filePath, PATHINFO_EXTENSION);
-
-        foreach ($this->getAssetTypePreProcessors($assetType) as $preProcessor) {
-            $sourcePath = $preProcessor->process($filePath, $params, $targetDirectory, $sourcePath);
+        foreach ($this->getAssetTypePreProcessors($publisherFile->getExtension()) as $preProcessor) {
+            $publisherFile = $preProcessor->process($publisherFile, $targetDirectory);
         }
 
-        return $sourcePath;
+        return $publisherFile;
     }
 
     /**
diff --git a/lib/Magento/View/Asset/PreProcessor/PreProcessorInterface.php b/lib/Magento/View/Asset/PreProcessor/PreProcessorInterface.php
index 2bc563a2257..2bab848e1cf 100644
--- a/lib/Magento/View/Asset/PreProcessor/PreProcessorInterface.php
+++ b/lib/Magento/View/Asset/PreProcessor/PreProcessorInterface.php
@@ -26,18 +26,16 @@ namespace Magento\View\Asset\PreProcessor;
 
 /**
  * The pre-processors which implement this interface are supposed to publish processed content to the $targetDirectory
- * and return the path to the published file.
+ * and return publisher file object with updated path to the published file.
  */
 interface PreProcessorInterface
 {
     /**
      * Process content
      *
-     * @param string $filePath
-     * @param array $params
+     * @param \Magento\View\Publisher\FileInterface $publisherFile
      * @param \Magento\Filesystem\Directory\WriteInterface $targetDirectory
-     * @param string|null $sourcePath
-     * @return string
+     * @return \Magento\View\Publisher\FileInterface
      */
-    public function process($filePath, $params, $targetDirectory, $sourcePath = null);
+    public function process(\Magento\View\Publisher\FileInterface $publisherFile, $targetDirectory);
 }
diff --git a/lib/Magento/View/FileSystem.php b/lib/Magento/View/FileSystem.php
index 878e014dcab..39a865e9771 100644
--- a/lib/Magento/View/FileSystem.php
+++ b/lib/Magento/View/FileSystem.php
@@ -83,8 +83,12 @@ class FileSystem
     {
         $this->_viewService->updateDesignParams($params);
         $skipProxy = isset($params['skipProxy']) && $params['skipProxy'];
-        return $this->_resolutionPool->getLocaleStrategy($skipProxy)->getLocaleFile($params['area'],
-            $params['themeModel'], $params['locale'], $file);
+        return $this->_resolutionPool->getLocaleStrategy($skipProxy)->getLocaleFile(
+            $params['area'],
+            $params['themeModel'],
+            $params['locale'],
+            $file
+        );
     }
 
     /**
@@ -100,28 +104,34 @@ class FileSystem
         $this->_viewService->updateDesignParams($params);
         $skipProxy = isset($params['skipProxy']) && $params['skipProxy'];
         return $this->_resolutionPool->getViewStrategy($skipProxy)->getViewFile(
-            $params['area'], $params['themeModel'], $params['locale'], $filePath, $params['module']
+            $params['area'],
+            $params['themeModel'],
+            $params['locale'],
+            $filePath,
+            $params['module']
         );
     }
 
     /**
      * Notify that view file resolved path was changed (i.e. it was published to a public directory)
      *
-     * @param string $targetPath
-     * @param string $fileId
-     * @param array $params
+     * @param Publisher\FileInterface $publisherFile
      * @return $this
      */
-    public function notifyViewFileLocationChanged($targetPath, $fileId, $params)
+    public function notifyViewFileLocationChanged(Publisher\FileInterface $publisherFile)
     {
+        $params = $publisherFile->getViewParams();
         $skipProxy = isset($params['skipProxy']) && $params['skipProxy'];
         $strategy = $this->_resolutionPool->getViewStrategy($skipProxy);
-        if ($strategy instanceof \Magento\View\Design\FileResolution\Strategy\View\NotifiableInterface) {
-            /** @var $strategy \Magento\View\Design\FileResolution\Strategy\View\NotifiableInterface  */
-            $filePath = $this->_viewService->extractScope($this->normalizePath($fileId), $params);
-            $this->_viewService->updateDesignParams($params);
+        if ($strategy instanceof Design\FileResolution\Strategy\View\NotifiableInterface) {
+            /** @var $strategy Design\FileResolution\Strategy\View\NotifiableInterface  */
             $strategy->setViewFilePathToMap(
-                $params['area'], $params['themeModel'], $params['locale'], $params['module'], $filePath, $targetPath
+                $params['area'],
+                $params['themeModel'],
+                $params['locale'],
+                $params['module'],
+                $publisherFile->getFilePath(),
+                $publisherFile->buildPublicViewFilename()
             );
         }
 
diff --git a/lib/Magento/View/Layout/File/FileList/Factory.php b/lib/Magento/View/Layout/File/FileList/Factory.php
index bde65d00003..a85c23dba26 100644
--- a/lib/Magento/View/Layout/File/FileList/Factory.php
+++ b/lib/Magento/View/Layout/File/FileList/Factory.php
@@ -56,14 +56,16 @@ class Factory
     /**
      * Return newly created instance of a layout file list
      *
-     * @param string $collator
+     * @param string $instanceName
      * @return \Magento\View\Layout\File\FileList
+     * @throws \UnexpectedValueException
      */
-    public function create($collator = self::FILE_LIST_COLLATOR)
+    public function create($instanceName = self::FILE_LIST_COLLATOR)
     {
-        return $this->objectManager->create(
-            'Magento\View\Layout\File\FileList',
-            array('collator' => $this->objectManager->get($collator))
-        );
+        $collator = $this->objectManager->get($instanceName);
+        if (!$collator instanceof CollateInterface) {
+            throw new \UnexpectedValueException("$instanceName has to implement the collate interface.");
+        }
+        return $this->objectManager->create('Magento\View\Layout\File\FileList', array('collator' => $collator));
     }
 }
diff --git a/lib/Magento/View/Publisher.php b/lib/Magento/View/Publisher.php
index 304b6fc671a..7ad85bbe5fd 100644
--- a/lib/Magento/View/Publisher.php
+++ b/lib/Magento/View/Publisher.php
@@ -26,7 +26,10 @@ namespace Magento\View;
 
 use Magento\Filesystem\Directory\WriteInterface;
 
-class Publisher implements \Magento\View\PublicFilesManagerInterface
+/**
+ * Magento view file publisher
+ */
+class Publisher implements PublicFilesManagerInterface
 {
     /**#@+
      * Extensions group for static files
@@ -43,62 +46,26 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface
     const CONTENT_TYPE_XML   = 'xml';
     /**#@-*/
 
-    /**#@+
-     * Public directories prefix group
-     */
-    const PUBLIC_MODULE_DIR = '_module';
-    const PUBLIC_VIEW_DIR   = '_view';
-    const PUBLIC_THEME_DIR  = '_theme';
-    /**#@-*/
-
-    /**
-     * File system
-     *
-     * @var \Magento\App\Filesystem
-     */
-    protected $_filesystem;
-
-    /**
-     * Helper to process css content
-     *
-     * @var \Magento\View\Url\CssResolver
-     */
-    protected $_cssUrlResolver;
-
-    /**
-     * View service
-     *
-     * @var \Magento\View\Service
-     */
-    protected $_viewService;
-
     /**
      * View file system
      *
      * @var \Magento\View\FileSystem
      */
-    protected $_viewFileSystem;
-
-    /**
-     * Logger
-     *
-     * @var \Magento\Logger
-     */
-    protected $_logger;
+    protected $viewFileSystem;
 
     /**
-     * Indicates how to materialize view files: with or without "duplication"
+     * Pre-processor
      *
-     * @var bool
+     * @var \Magento\View\Asset\PreProcessor\PreProcessorInterface
      */
-    protected $_allowDuplication;
+    protected $preProcessor;
 
     /**
-     * Modules reader
+     * Publisher file factory
      *
-     * @var \Magento\Module\Dir\Reader
+     * @var Publisher\FileFactory
      */
-    protected $_modulesReader;
+    protected $fileFactory;
 
     /**
      * Root directory
@@ -108,53 +75,37 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface
     protected $rootDirectory;
 
     /**
-     * Related file
+     * Pre-processors temporary directory
      *
-     * @var RelatedFile
+     * @var WriteInterface
      */
-    protected $relatedFile;
+    protected $tmpDirectory;
 
     /**
-     * Pre-processor
+     * Public directory
      *
-     * @var \Magento\View\Asset\PreProcessor\PreProcessorInterface
+     * @var WriteInterface
      */
-    protected $preProcessor;
+    protected $pubDirectory;
 
     /**
-     * Constructor
-     *
-     * @param \Magento\Logger $logger
      * @param \Magento\App\Filesystem $filesystem
-     * @param \Magento\View\Url\CssResolver $cssUrlResolver
-     * @param \Magento\View\Service $viewService
-     * @param \Magento\View\FileSystem $viewFileSystem
-     * @param \Magento\Module\Dir\Reader $modulesReader
-     * @param RelatedFile $relatedFile
-     * @param \Magento\View\Asset\PreProcessor\PreProcessorInterface $preProcessor
-     * @param bool $allowDuplication
+     * @param FileSystem $viewFileSystem
+     * @param Asset\PreProcessor\PreProcessorInterface $preProcessor
+     * @param Publisher\FileFactory $fileFactory
      */
     public function __construct(
-        \Magento\Logger $logger,
         \Magento\App\Filesystem $filesystem,
-        \Magento\View\Url\CssResolver $cssUrlResolver,
-        \Magento\View\Service $viewService,
         \Magento\View\FileSystem $viewFileSystem,
-        \Magento\Module\Dir\Reader $modulesReader,
-        RelatedFile $relatedFile,
         \Magento\View\Asset\PreProcessor\PreProcessorInterface $preProcessor,
-        $allowDuplication
+        Publisher\FileFactory $fileFactory
     ) {
-        $this->_filesystem = $filesystem;
         $this->rootDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR);
-        $this->_cssUrlResolver = $cssUrlResolver;
-        $this->_viewService = $viewService;
-        $this->_viewFileSystem = $viewFileSystem;
-        $this->_modulesReader = $modulesReader;
-        $this->_logger = $logger;
-        $this->_allowDuplication = $allowDuplication;
-        $this->relatedFile = $relatedFile;
+        $this->tmpDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR);
+        $this->pubDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::STATIC_VIEW_DIR);
+        $this->viewFileSystem = $viewFileSystem;
         $this->preProcessor = $preProcessor;
+        $this->fileFactory = $fileFactory;
     }
 
     /**
@@ -166,22 +117,24 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface
      */
     public function getPublicFilePath($filePath, $params)
     {
-        return $this->_getPublishedFilePath($filePath, $params);
+        return $this->getPublishedFilePath($this->fileFactory->create($filePath, $params));
     }
 
     /**
-     * Publish file identified by $fileId basing on information about parent file path and name.
-     *
-     * @param string $fileId URL to the file that was extracted from $parentFilePath
-     * @param string $parentFilePath path to the file
-     * @param string $parentFileName original file name identifier that was requested for processing
-     * @param array $params theme/module parameters array
-     * @return string
+     * @param string $extension
+     * @return bool
      */
-    protected function _publishRelatedViewFile($fileId, $parentFilePath, $parentFileName, $params)
+    protected function isAllowedExtension($extension)
     {
-        $relativeFilePath = $this->relatedFile->buildPath($fileId, $parentFilePath, $parentFileName, $params);
-        return $this->_getPublishedFilePath($relativeFilePath, $params);
+        $protectedExtensions = array(
+            self::CONTENT_TYPE_PHP,
+            self::CONTENT_TYPE_PHTML,
+            self::CONTENT_TYPE_XML
+        );
+        if (in_array($extension, $protectedExtensions)) {
+            return false;
+        }
+        return true;
     }
 
     /**
@@ -189,260 +142,59 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface
      *
      * Check, if requested theme file has public access, and move it to public folder, if the file has no public access
      *
-     * @param  string $filePath
-     * @param  array $params
-     * @return string
+     * @param Publisher\FileInterface $publisherFile
+     * @return string|null
      * @throws \Magento\Exception
      */
-    protected function _getPublishedFilePath($filePath, $params)
+    protected function getPublishedFilePath(Publisher\FileInterface $publisherFile)
     {
-        //TODO: Do we need this? It throws exception in production mode!
-        if (!$this->_viewService->isViewFileOperationAllowed()) {
-            throw new \Magento\Exception('Filesystem operations are not permitted for view files');
-        }
-
-        // 1. Fallback look-up for view files. Remember it can be file of any type: CSS, LESS, JS, image
-        $sourcePath = $this->_viewFileSystem->getViewFile($filePath, $params);
-
-        // 2. If $sourcePath returned actually not exists replace it with null value.
-        if (!$this->rootDirectory->isExist($this->rootDirectory->getRelativePath($sourcePath))) {
-            $sourcePath = null;
+        /** If $filePath points to file with protected extension - no publishing, return null */
+        if (!$this->isAllowedExtension($publisherFile->getExtension())) {
+            return null;
         }
 
-        /**
-         * 3. Target directory to save temporary files in. It was 'pub/static' dir, but I guess it's more correct
-         * to have it in 'var/tmp' dir.
-         */
-        //TODO: Why should publisher control where pre-processors save temporary files
-        $targetDirectory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR);
+        $fileToPublish = $this->preProcessor->process($publisherFile, $this->tmpDirectory);
 
-        /**
-         * 4. Execute asset pre-processors
-         *      in case if $sourcePath was null, then pre-processors will be executed and original source file
-         *          will be processed, then new $sourcePath targeting pre-processed file in 'var/tmp' dir
-         *          will be returned back
-         *      in case if $sourcePath was not null then $sourcePath passed will be returned back
-         */
-        $sourcePath = $this->preProcessor->process($filePath, $params, $targetDirectory, $sourcePath);
-
-        // 5. If $sourcePath returned still doesn't exists throw Exception
-        if ($sourcePath === null
-            || !$this->rootDirectory->isExist($this->rootDirectory->getRelativePath($sourcePath))
-        ) {
-            throw new \Magento\Exception("Unable to locate theme file '{$filePath}'.");
+        if (!$fileToPublish->isSourceFileExists()) {
+            throw new \Magento\Exception("Unable to locate theme file '{$fileToPublish->getFilePath()}'.");
         }
 
-        /**
-         * 6.
-         * If $sourcePath points to file in 'pub/lib' dir - no publishing required
-         * If $sourcePath points to file with protected extension - no publishing, return unchanged
-         * If $sourcePath points to file in 'pub/static' dir - no publishing required
-         * If $sourcePath points to CSS file and developer mode is enabled - publish file
-         */
-        if ($this->canSkipFilePublication($sourcePath)) {
-            return $sourcePath;
+        if (!$fileToPublish->isPublicationAllowed()) {
+            return $fileToPublish->getSourcePath();
         }
 
-        return $this->_publishFile($filePath, $params, $sourcePath);
+        $this->publishFile($fileToPublish);
+        return $fileToPublish->buildPublicViewFilename();
     }
 
     /**
      * Publish file
      *
-     * @param string $filePath
-     * @param array $params
-     * @param string $sourcePath
-     * @return string
+     * @param Publisher\FileInterface $publisherFile
+     * @return $this
      */
-    protected function _publishFile($filePath, $params, $sourcePath)
+    protected function publishFile(Publisher\FileInterface $publisherFile)
     {
-        $filePath = $this->_viewFileSystem->normalizePath($filePath);
-        $sourcePath = $this->_viewFileSystem->normalizePath($sourcePath);
-        $targetPath = $this->_buildPublishedFilePath($filePath, $params, $sourcePath);
-
-        $targetDirectory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::STATIC_VIEW_DIR);
+        $sourcePath = $publisherFile->getSourcePath();
         $sourcePathRelative = $this->rootDirectory->getRelativePath($sourcePath);
-        $targetPathRelative = $targetDirectory->getRelativePath($targetPath);
 
-        if ($this->_getExtension($filePath) == self::CONTENT_TYPE_CSS) {
-            $cssContent = $this->_getPublicCssContent($sourcePath, $targetPath, $filePath, $params);
-        }
+        $targetPathRelative = $publisherFile->buildUniquePath();
 
-        $fileMTime = $this->rootDirectory->stat($sourcePathRelative)['mtime'];
+        $targetDirectory = $this->pubDirectory;
 
+        $fileMTime = $this->rootDirectory->stat($sourcePathRelative)['mtime'];
         if (!$targetDirectory->isExist($targetPathRelative)
             || $fileMTime != $targetDirectory->stat($targetPathRelative)['mtime']
         ) {
-            if (isset($cssContent)) {
-                $targetDirectory->writeFile($targetPathRelative, $cssContent);
-                $targetDirectory->touch($targetPathRelative, $fileMTime);
-            } elseif ($this->rootDirectory->isFile($sourcePathRelative)) {
+            if ($this->rootDirectory->isFile($sourcePathRelative)) {
                 $this->rootDirectory->copyFile($sourcePathRelative, $targetPathRelative, $targetDirectory);
                 $targetDirectory->touch($targetPathRelative, $fileMTime);
+            } elseif (!$targetDirectory->isDirectory($targetPathRelative)) {
+                $targetDirectory->create($targetPathRelative);
             }
         }
 
-        $this->_viewFileSystem->notifyViewFileLocationChanged($targetPath, $filePath, $params);
-        return $targetPath;
-    }
-
-    /**
-     * Build published file path
-     *
-     * @param string $filePath
-     * @param array $params
-     * @param string $sourcePath
-     * @return string
-     */
-    protected function _buildPublishedFilePath($filePath, $params, $sourcePath)
-    {
-        $isCssFile = $this->_getExtension($filePath) == self::CONTENT_TYPE_CSS;
-        if ($this->_allowDuplication || $isCssFile) {
-            $targetPath = $this->_buildPublicViewRedundantFilename($filePath, $params);
-        } else {
-            $targetPath = $this->_buildPublicViewSufficientFilename($sourcePath, $params);
-        }
-        $targetPath = $this->_buildPublicViewFilename($targetPath);
-
-        return $targetPath;
-    }
-
-    /**
-     * Determine whether a file needs to be published
-     *
-     * All files located in 'pub/lib' dir should not be published cause it's already publicly accessible.
-     * All other files must be processed either if they are not published already (located in 'pub/static'),
-     * or if they are css-files and we're working in developer mode.
-     *
-     * @param string $filePath
-     * @return bool
-     *
-     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
-     */
-    protected function canSkipFilePublication($filePath)
-    {
-        $filePath = str_replace('\\', '/', $filePath);
-
-        $pubLibDir = $this->_filesystem->getPath(\Magento\App\Filesystem::PUB_LIB_DIR) . '/';
-        if (strncmp($filePath, $pubLibDir, strlen($pubLibDir)) === 0) {
-            return true;
-        }
-
-        $protectedExtensions = array(
-            self::CONTENT_TYPE_PHP,
-            self::CONTENT_TYPE_PHTML,
-            self::CONTENT_TYPE_XML
-        );
-        if (in_array($this->_getExtension($filePath), $protectedExtensions)) {
-            return true;
-        }
-
-        $pubStaticDir = $this->_filesystem->getPath(\Magento\App\Filesystem::STATIC_VIEW_DIR) . '/';
-        if (strncmp($filePath, $pubStaticDir, strlen($pubStaticDir)) !== 0) {
-            return false;
-        }
-
-        if ($this->_viewService->getAppMode() !== \Magento\App\State::MODE_DEVELOPER) {
-            return true;
-        }
-
-        return $this->_getExtension($filePath) !== self::CONTENT_TYPE_CSS;
-    }
-
-    /**
-     * Get file extension by file path
-     *
-     * @param string $filePath
-     * @return string
-     */
-    protected function _getExtension($filePath)
-    {
-        return strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
-    }
-
-    /**
-     * Build public filename for a theme file that always includes area/package/theme/locate parameters
-     *
-     * @param string $file
-     * @param array $params
-     * @return string
-     */
-    protected function _buildPublicViewRedundantFilename($file, array $params)
-    {
-        /** @var $theme \Magento\View\Design\ThemeInterface */
-        $theme = $params['themeModel'];
-        if ($theme->getThemePath()) {
-            $designPath = $theme->getThemePath();
-        } elseif ($theme->getId()) {
-            $designPath = self::PUBLIC_THEME_DIR . $theme->getId();
-        } else {
-            $designPath = self::PUBLIC_VIEW_DIR;
-        }
-
-        $publicFile = $params['area'] . '/' . $designPath . '/' . $params['locale'] .
-            ($params['module'] ? '/' . $params['module'] : '') . '/' . $file;
-
-        return $publicFile;
-    }
-
-    /**
-     * Build public filename for a view file that sufficiently depends on the passed parameters
-     *
-     * @param string $filename
-     * @param array $params
-     * @return string
-     */
-    protected function _buildPublicViewSufficientFilename($filename, array $params)
-    {
-        $designDir = $this->_filesystem->getPath(\Magento\App\Filesystem::THEMES_DIR) . '/';
-        if (0 === strpos($filename, $designDir)) {
-            // theme file
-            $publicFile = substr($filename, strlen($designDir));
-        } else {
-            // modular file
-            $module = $params['module'];
-            $moduleDir = $this->_modulesReader->getModuleDir('theme', $module) . '/';
-            $publicFile = substr($filename, strlen($moduleDir));
-            $publicFile = self::PUBLIC_MODULE_DIR . '/' . $module . '/' . $publicFile;
-        }
-        return $publicFile;
-    }
-
-    /**
-     * Retrieve processed CSS file content that contains URLs relative to the specified public directory
-     *
-     * @param string $sourcePath Absolute path to the current location of CSS file
-     * @param string $publicPath Absolute path to location of the CSS file, where it will be published
-     * @param string $fileName File name used for reference
-     * @param array $params Design parameters
-     * @return string
-     */
-    protected function _getPublicCssContent($sourcePath, $publicPath, $fileName, $params)
-    {
-        $content = $this->rootDirectory->readFile($this->rootDirectory->getRelativePath($sourcePath));
-
-        $callback = function ($fileId, $originalPath) use ($fileName, $params) {
-            $relatedPathPublic = $this->_publishRelatedViewFile(
-                $fileId, $originalPath, $fileName, $params
-            );
-            return $relatedPathPublic;
-        };
-        try {
-            $content = $this->_cssUrlResolver->replaceCssRelativeUrls($content, $sourcePath, $publicPath, $callback);
-        } catch (\Magento\Exception $e) {
-            $this->_logger->logException($e);
-        }
-        return $content;
-    }
-
-    /**
-     * Build path to file located in public folder
-     *
-     * @param string $file
-     * @return string
-     */
-    protected function _buildPublicViewFilename($file)
-    {
-        return $this->_viewService->getPublicDir() . '/' . $file;
+        $this->viewFileSystem->notifyViewFileLocationChanged($publisherFile);
+        return $this;
     }
 }
diff --git a/lib/Magento/View/Publisher/CssFile.php b/lib/Magento/View/Publisher/CssFile.php
new file mode 100644
index 00000000000..6da22bbe1ad
--- /dev/null
+++ b/lib/Magento/View/Publisher/CssFile.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\View\Publisher;
+
+/**
+ * Publisher file type CSS
+ */
+class CssFile extends FileAbstract
+{
+    /**
+     * Determine whether a file needs to be published
+     *
+     * If sourcePath points to CSS file and developer mode is enabled - publish file
+     *
+     * @return bool
+     */
+    public function isPublicationAllowed()
+    {
+        if ($this->isPublicationAllowed === null) {
+            $filePath = str_replace('\\', '/', $this->sourcePath);
+
+            if ($this->isLibFile($filePath)) {
+                $this->isPublicationAllowed = false;
+            } elseif (!$this->isViewStaticFile($filePath)) {
+                $this->isPublicationAllowed = true;
+            } else {
+                $this->isPublicationAllowed = $this->viewService->getAppMode() === \Magento\App\State::MODE_DEVELOPER;
+            }
+        }
+        return $this->isPublicationAllowed;
+    }
+
+    /**
+     * Build unique file path for publication
+     *
+     * @return string
+     */
+    public function buildUniquePath()
+    {
+        return $this->buildPublicViewRedundantFilename();
+    }
+}
diff --git a/lib/Magento/View/Publisher/File.php b/lib/Magento/View/Publisher/File.php
new file mode 100644
index 00000000000..7be20e5b282
--- /dev/null
+++ b/lib/Magento/View/Publisher/File.php
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\View\Publisher;
+
+/**
+ * Basic publisher file type
+ */
+class File extends FileAbstract
+{
+    /**
+     * Determine whether a file needs to be published
+     *
+     * All files located in 'pub/lib' dir should not be published cause it's already publicly accessible.
+     * All other files must be processed either if they are not published already (located in 'pub/static'),
+     * or if they are css-files and we're working in developer mode.
+     *
+     * If sourcePath points to file in 'pub/lib' dir - no publishing required
+     * If sourcePath points to file in 'pub/static' dir - no publishing required
+     *
+     * @return bool
+     */
+    public function isPublicationAllowed()
+    {
+        if ($this->isPublicationAllowed === null) {
+            $filePath = str_replace('\\', '/', $this->sourcePath);
+            $this->isPublicationAllowed = !$this->isLibFile($filePath) && !$this->isViewStaticFile($filePath);
+        }
+
+        return $this->isPublicationAllowed;
+    }
+
+    /**
+     * Build unique file path for publication
+     *
+     * @return string
+     */
+    public function buildUniquePath()
+    {
+        if ($this->allowDuplication) {
+            $targetPath = $this->buildPublicViewRedundantFilename();
+        } else {
+            $targetPath = $this->buildPublicViewSufficientFilename();
+        }
+        return $targetPath;
+    }
+}
diff --git a/lib/Magento/View/Publisher/FileAbstract.php b/lib/Magento/View/Publisher/FileAbstract.php
new file mode 100644
index 00000000000..f7ec420a6b6
--- /dev/null
+++ b/lib/Magento/View/Publisher/FileAbstract.php
@@ -0,0 +1,345 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\View\Publisher;
+
+use Magento\Filesystem\Directory\WriteInterface;
+
+/**
+ * Abstract publisher file type
+ */
+abstract class FileAbstract implements FileInterface
+{
+    /**
+     * @var \Magento\App\Filesystem
+     */
+    protected $filesystem;
+
+    /**
+     * @var \Magento\View\Service
+     */
+    protected $viewService;
+
+    /**
+     * @var \Magento\Module\Dir\Reader
+     */
+    protected $modulesReader;
+
+    /**
+     * @var \Magento\View\FileSystem
+     */
+    protected $viewFileSystem;
+
+    /**
+     * @var string
+     */
+    protected $filePath;
+
+    /**
+     * @var string
+     */
+    protected $extension;
+
+    /**
+     * @var array
+     */
+    protected $viewParams;
+
+    /**
+     * @var string|null
+     */
+    protected $sourcePath;
+
+    /**
+     * Indicates how to materialize view files: with or without "duplication"
+     *
+     * @var bool
+     */
+    protected $allowDuplication;
+
+    /**
+     * @var bool
+     */
+    protected $isPublicationAllowed;
+
+    /**
+     * @var WriteInterface
+     */
+    protected $rootDirectory;
+
+    /**
+     * Makes sure that fallback is only used once per file and only if no 'valid' source path was passed to constructor
+     *
+     * @var bool
+     */
+    protected $isFallbackUsed = false;
+
+    /**
+     * Makes sure that source path is not overwritten when 'valid' value of source path was passed to constructor
+     *
+     * @var bool
+     */
+    protected $isSourcePathProvided;
+
+    /**
+     * @param \Magento\App\Filesystem $filesystem
+     * @param \Magento\View\Service $viewService
+     * @param \Magento\Module\Dir\Reader $modulesReader
+     * @param \Magento\View\FileSystem $viewFileSystem
+     * @param string $filePath
+     * @param bool $allowDuplication
+     * @param array $viewParams
+     * @param string|null $sourcePath
+     */
+    public function __construct(
+        \Magento\App\Filesystem $filesystem,
+        \Magento\View\Service $viewService,
+        \Magento\Module\Dir\Reader $modulesReader,
+        \Magento\View\FileSystem $viewFileSystem,
+        $filePath,
+        $allowDuplication,
+        array $viewParams,
+        $sourcePath = null
+    ) {
+        $this->filesystem = $filesystem;
+        $this->viewService = $viewService;
+        $this->modulesReader = $modulesReader;
+        $this->filePath = $filePath;
+        $this->allowDuplication = $allowDuplication;
+        $this->viewParams = $viewParams;
+        $this->viewFileSystem = $viewFileSystem;
+        $this->rootDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR);
+        $this->setSourcePath($sourcePath);
+        $this->isSourcePathProvided = $sourcePath !== null;
+    }
+
+    /**
+     * Determine whether a file needs to be published
+     *
+     * All files located in 'pub/lib' dir should not be published cause it's already publicly accessible.
+     * All other files must be processed either if they are not published already (located in 'pub/static'),
+     * or if they are css-files and we're working in developer mode.
+     *
+     * If sourcePath points to file in 'pub/lib' dir - no publishing required
+     * If sourcePath points to file in 'pub/static' dir - no publishing required
+     *
+     * @return bool
+     */
+    abstract public function isPublicationAllowed();
+
+    /**
+     * Build unique file path for publication
+     *
+     * @return string
+     */
+    abstract public function buildUniquePath();
+
+    /**
+     * Original file extension
+     *
+     * @return string
+     */
+    public function getExtension()
+    {
+        if ($this->extension === null) {
+            $this->extension = strtolower(pathinfo($this->getFilePath(), PATHINFO_EXTENSION));
+        }
+        return $this->extension;
+    }
+
+    /**
+     * @return bool
+     */
+    public function isSourceFileExists()
+    {
+        return $this->getSourcePath() !== null;
+    }
+
+    /**
+     * @return string
+     */
+    public function getFilePath()
+    {
+        return $this->filePath;
+    }
+
+    /**
+     * @return array
+     */
+    public function getViewParams()
+    {
+        return $this->viewParams;
+    }
+
+    /**
+     * Build path to file located in public folder
+     *
+     * @return string
+     */
+    public function buildPublicViewFilename()
+    {
+        return $this->viewService->getPublicDir() . '/' . $this->buildUniquePath();
+    }
+
+    /**
+     * @return string|null
+     */
+    public function getSourcePath()
+    {
+        if (!$this->isSourcePathProvided && !$this->isFallbackUsed) {
+            $this->isFallbackUsed = true;
+
+            // Fallback look-up for view files. Remember it can be file of any type: CSS, LESS, JS, image
+            $fallbackSourcePath = $this->viewFileSystem->getViewFile($this->getFilePath(), $this->getViewParams());
+            $this->setSourcePath($fallbackSourcePath);
+        }
+        return $this->sourcePath;
+    }
+
+    /**
+     * @param string $sourcePath
+     * @return $this
+     */
+    protected function setSourcePath($sourcePath)
+    {
+        if ($sourcePath === null
+            || !$this->rootDirectory->isExist($this->rootDirectory->getRelativePath($sourcePath))
+        ) {
+            $this->sourcePath = null;
+        } else {
+            $this->sourcePath = $sourcePath;
+        }
+
+        return $this;
+    }
+
+    /**
+     * @param string $filePath
+     * @return bool
+     */
+    protected function isLibFile($filePath)
+    {
+        $pubLibDir = $this->filesystem->getPath(\Magento\App\Filesystem::PUB_LIB_DIR) . '/';
+        if (strncmp($filePath, $pubLibDir, strlen($pubLibDir)) === 0) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * @param string $filePath
+     * @return bool
+     */
+    protected function isViewStaticFile($filePath)
+    {
+        $pubStaticDir = $this->filesystem->getPath(\Magento\App\Filesystem::STATIC_VIEW_DIR) . '/';
+        if (strncmp($filePath, $pubStaticDir, strlen($pubStaticDir)) === 0) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Build public filename for a theme file that always includes area/package/theme/locate parameters
+     *
+     * @return string
+     */
+    protected function buildPublicViewRedundantFilename()
+    {
+        /** @var $theme \Magento\View\Design\ThemeInterface */
+        $theme = $this->getViewParams()['themeModel'];
+        if ($theme->getThemePath()) {
+            $designPath = $theme->getThemePath();
+        } elseif ($theme->getId()) {
+            $designPath = self::PUBLIC_THEME_DIR . $theme->getId();
+        } else {
+            $designPath = self::PUBLIC_VIEW_DIR;
+        }
+
+        $publicFile = $this->getViewParams()['area'] . '/' . $designPath . '/' . $this->getViewParams()['locale']
+            . ($this->getViewParams()['module'] ? '/' . $this->getViewParams()['module'] : '')
+            . '/' . $this->getFilePath();
+
+        return $publicFile;
+    }
+
+    /**
+     * Build public filename for a view file that sufficiently depends on the passed parameters
+     *
+     * @return string
+     */
+    protected function buildPublicViewSufficientFilename()
+    {
+        $designDir = $this->filesystem->getPath(\Magento\App\Filesystem::THEMES_DIR) . '/';
+        if (0 === strpos($this->getSourcePath(), $designDir)) {
+            // theme file
+            $publicFile = substr($this->getSourcePath(), strlen($designDir));
+        } else {
+            // modular file
+            $module = $this->getViewParams()['module'];
+            $moduleDir = $this->modulesReader->getModuleDir('theme', $module) . '/';
+            $publicFile = substr($this->getSourcePath(), strlen($moduleDir));
+            $publicFile = self::PUBLIC_MODULE_DIR . '/' . $module . '/' . $publicFile;
+        }
+        return $publicFile;
+    }
+
+    /**
+     * @return array
+     */
+    public function __sleep()
+    {
+        if (!empty($this->viewParams['themeModel'])) {
+            $this->viewParams['themeId'] = $this->viewParams['themeModel']->getId();
+            unset($this->viewParams['themeModel']);
+        }
+
+        return [
+            'filePath',
+            'extension',
+            'viewParams',
+            'sourcePath',
+            'allowDuplication',
+            'isPublicationAllowed',
+            'isFallbackUsed',
+            'isSourcePathProvided'
+        ];
+    }
+
+    /**
+     * return void
+     */
+    public function __wakeup()
+    {
+        $objectManager = \Magento\App\ObjectManager::getInstance();
+        $this->filesystem = $objectManager->get('\Magento\App\Filesystem');
+        $this->viewService = $objectManager->get('\Magento\View\Service');
+        $this->modulesReader = $objectManager->get('\Magento\Module\Dir\Reader');
+        $this->viewFileSystem = $objectManager->get('\Magento\View\FileSystem');
+
+        $this->viewService->updateDesignParams($this->viewParams);
+
+        $this->rootDirectory = $this->filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR);
+    }
+}
diff --git a/lib/Magento/View/Publisher/FileFactory.php b/lib/Magento/View/Publisher/FileFactory.php
new file mode 100644
index 00000000000..87323fc968d
--- /dev/null
+++ b/lib/Magento/View/Publisher/FileFactory.php
@@ -0,0 +1,107 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\View\Publisher;
+
+use Magento\ObjectManager;
+
+/**
+ * Publisher file factory
+ */
+class FileFactory
+{
+    /**
+     * Default publisher file class
+     */
+    const DEFAULT_FILE_INSTANCE_CLASS = 'Magento\View\Publisher\File';
+
+    /**
+     * @var ObjectManager
+     */
+    protected $objectManager;
+
+    /**
+     * @var string
+     */
+    protected $instanceName;
+
+    /**
+     * @var array
+     */
+    protected $publisherFileTypes = [
+        'css' => 'Magento\View\Publisher\CssFile'
+    ];
+
+    /**
+     * @param ObjectManager $objectManager
+     * @param string $instanceName
+     */
+    public function __construct(ObjectManager $objectManager, $instanceName = self::DEFAULT_FILE_INSTANCE_CLASS)
+    {
+        $this->objectManager = $objectManager;
+        $this->instanceName = $instanceName;
+    }
+
+    /**
+     * Return newly created instance of a publisher file
+     *
+     * @param string $filePath
+     * @param array $viewParams
+     * @param null|string $sourcePath
+     * @return FileInterface
+     * @throws \UnexpectedValueException
+     */
+    public function create($filePath, array $viewParams, $sourcePath = null)
+    {
+        $instanceName = $this->instanceName;
+        $extension = $this->getExtension($filePath);
+        if (isset($this->publisherFileTypes[$extension])) {
+            $instanceName = $this->publisherFileTypes[$extension];
+        }
+        $publisherFile = $this->objectManager->create(
+            $instanceName,
+            [
+                'filePath'   => $filePath,
+                'viewParams' => $viewParams,
+                'sourcePath' => $sourcePath
+            ]
+        );
+
+        if (!$publisherFile instanceof FileInterface) {
+            throw new \UnexpectedValueException("$instanceName has to implement the publisher file interface.");
+        }
+        return $publisherFile;
+    }
+
+    /**
+     * Get file extension by file path
+     *
+     * @param string $filePath
+     * @return string
+     */
+    protected function getExtension($filePath)
+    {
+        return strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
+    }
+}
diff --git a/lib/Magento/View/Publisher/FileInterface.php b/lib/Magento/View/Publisher/FileInterface.php
new file mode 100644
index 00000000000..5a293853bc4
--- /dev/null
+++ b/lib/Magento/View/Publisher/FileInterface.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\View\Publisher;
+
+/**
+ * Publisher file interface
+ */
+interface FileInterface
+{
+    /**#@+
+     * Public directories prefix group
+     */
+    const PUBLIC_MODULE_DIR = '_module';
+    const PUBLIC_VIEW_DIR   = '_view';
+    const PUBLIC_THEME_DIR  = '_theme';
+    /**#@-*/
+
+    /**
+     * Check is publication allowed for a file
+     *
+     * @return bool
+     */
+    public function isPublicationAllowed();
+
+    /**
+     * Build unique file path for publication
+     *
+     * @return string
+     */
+    public function buildUniquePath();
+
+    /**
+     * Original file extension
+     *
+     * @return string
+     */
+    public function getExtension();
+
+    /**
+     * @return bool
+     */
+    public function isSourceFileExists();
+
+    /**
+     * @return string
+     */
+    public function getFilePath();
+
+    /**
+     * @return array
+     */
+    public function getViewParams();
+
+    /**
+     * Build path to file located in public folder
+     *
+     * @return string
+     */
+    public function buildPublicViewFilename();
+
+    /**
+     * Returns absolute path
+     *
+     * @return string|null
+     */
+    public function getSourcePath();
+}
diff --git a/lib/Magento/View/RelatedFile.php b/lib/Magento/View/RelatedFile.php
index 6c724e402cf..0a84bf50756 100644
--- a/lib/Magento/View/RelatedFile.php
+++ b/lib/Magento/View/RelatedFile.php
@@ -44,61 +44,32 @@ class RelatedFile
     protected $viewFileSystem;
 
     /**
-     * File system
-     *
-     * @var \Magento\Filesystem
-     */
-    protected $filesystem;
-
-    /**
-     * Constructor
-     *
      * @param Service $viewService
      * @param FileSystem $viewFileSystem
-     * @param \Magento\App\Filesystem $filesystem
      */
     public function __construct(
         Service $viewService,
-        FileSystem $viewFileSystem,
-        \Magento\App\Filesystem $filesystem
+        FileSystem $viewFileSystem
     ) {
         $this->viewService = $viewService;
         $this->viewFileSystem = $viewFileSystem;
-        $this->filesystem = $filesystem;
     }
 
     /**
      * Get relative $fileUrl based on information about parent file path and name.
      *
-     * @param string $relatedFilePath URL to the file that was extracted from $parentPath
-     * @param string $parentPath path to the file
+     * @param string $relativeFilePath URL to the file that was extracted from $parentPath
      * @param string $parentRelativePath original file name identifier that was requested for processing
      * @param array &$params theme/module parameters array
      * @return string
      */
-    public function buildPath($relatedFilePath, $parentPath, $parentRelativePath, &$params)
+    public function buildPath($relativeFilePath, $parentRelativePath, &$params)
     {
-        if (strpos($relatedFilePath, \Magento\View\Service::SCOPE_SEPARATOR)) {
-            $filePath = $this->viewService->extractScope(
-                $this->viewFileSystem->normalizePath($relatedFilePath),
-                $params
-            );
+        if (strpos($relativeFilePath, \Magento\View\Service::SCOPE_SEPARATOR)) {
+            $relativeFilePath = $this->viewService->extractScope($relativeFilePath, $params);
         } else {
-            /* Check if module file overridden on theme level based on _module property and file path */
-            $themesPath = $this->filesystem->getPath(\Magento\App\Filesystem::THEMES_DIR);
-            if ($params['module'] && strpos($parentPath, $themesPath) === 0) {
-                /* Add module directory to relative URL */
-                $filePath = dirname($params['module'] . '/' . $parentRelativePath) . '/' . $relatedFilePath;
-                if (strpos($filePath, $params['module']) === 0) {
-                    $filePath = ltrim(str_replace($params['module'], '', $filePath), '/');
-                } else {
-                    $params['module'] = false;
-                }
-            } else {
-                $filePath = dirname($parentRelativePath) . '/' . $relatedFilePath;
-            }
+            $relativeFilePath = dirname($parentRelativePath) . '/' . $relativeFilePath;
         }
-
-        return $this->viewFileSystem->normalizePath($filePath);
+        return $this->viewFileSystem->normalizePath($relativeFilePath);
     }
 }
diff --git a/lib/Magento/View/Url/CssResolver.php b/lib/Magento/View/Url/CssResolver.php
index 1c63ad90a3c..22bcf537611 100644
--- a/lib/Magento/View/Url/CssResolver.php
+++ b/lib/Magento/View/Url/CssResolver.php
@@ -76,12 +76,10 @@ class CssResolver
      */
     public function replaceCssRelativeUrls($cssContent, $originalPath, $newPath, $cbRelUrlToPublicPath = null)
     {
-        $originalPath = $this->viewFileSystem->normalizePath($originalPath);
-        $newPath = $this->viewFileSystem->normalizePath($newPath);
         $relativeUrls = $this->_extractCssRelativeUrls($cssContent);
         foreach ($relativeUrls as $urlNotation => $originalRelativeUrl) {
             if ($cbRelUrlToPublicPath) {
-                $filePath = call_user_func($cbRelUrlToPublicPath, $originalRelativeUrl, $originalPath);
+                $filePath = call_user_func($cbRelUrlToPublicPath, $originalRelativeUrl);
             } else {
                 $filePath = dirname($originalPath) . '/' . $originalRelativeUrl;
             }
diff --git a/lib/googlecheckout/googlerequest.php b/lib/googlecheckout/googlerequest.php
index 5fa40198000..8db4a29b263 100644
--- a/lib/googlecheckout/googlerequest.php
+++ b/lib/googlecheckout/googlerequest.php
@@ -55,7 +55,7 @@
     var $log;
 
       /**
-       * @var \Magento\Core\Model\Log\AdapterFactory
+       * @var \Magento\Logger\AdapterFactory
        */
       protected $_logAdapterFactory;
 
@@ -65,11 +65,11 @@
       protected $_coreStoreConfig;
 
       /**
-       * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory
+       * @param \Magento\Logger\AdapterFactory $logAdapterFactory
        * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig
        */
       public function __construct(
-          \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory,
+          \Magento\Logger\AdapterFactory $logAdapterFactory,
           \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig
       ) {
           $this->_logAdapterFactory = $logAdapterFactory;
-- 
GitLab