added some comments within code