Using until instead of loop