Refactored to use inheritance and separate logic where possible. Addressed comments. Change-Id: I9e62414cd83121575bdf99a3b47466a7585bedb6 Former-commit-id: 6e015b3f61c20635077d6e8271e9b763e5a32fe1
review comments Change-Id: I9911c531a0e2ac735df949cc3f9aa72dc192483d Former-commit-id: 2f1aa28a4389c15e20724ebc8d79501c338f565e