loop continuation and added some comments