Rebased and addressed code review comments.