Address code review comments of #299