Refactored to use inheritance and separate logic where possible. Addressed comments. Change-Id: I9e62414cd83121575bdf99a3b47466a7585bedb6 Former-commit-id: 6e015b3f61c20635077d6e8271e9b763e5a32fe1
Change-Id: I38f2890097e074cc42735657855ffff97a455707 Former-commit-id: c75780f9e3c7b9a5447b0f72b11e42a3c8dce68b