Instead of filter+map, use a new method reduce so feature extraction is in one loop