change loops to use labels