added appropriate comments in the code