changed sentinel value of case 1; changed comments and format