Faster processing with loop