Added some comments throughout code