This loop here loops through all features in the input feature set, which is not a scalable design. We probably need to discuss this further.