Use iterators for better performance