added code in form of comments