should be while instead of for