Code refactoring done. Added code review comments