added more comments to main routine