removed unnecessary loop condition