Address code review remarks
Refactoring