Added comments throughout code