Refactor as per comments from code review