updated the code to include comments