Simplified the loop