using local variables in for loop
Adding quit mode