Changed control to loop