TO SQUASH(chirayu): rebased PR 2223 and and made some changes.