simplified loop condition