Removing slow iteration code