Improve code as required in code review comments