Added more comments into the code