Code modified according to code review