added comment details and adjustment of code