Refactored for multiple roxie inputs