move accept in while loop