Fixed the issues discovered from the code review