added more comments into code