Change array indexing to IEnumerable so that we can operate on the output of LINQ queries directly, thus running in constant space. This may result in a performance penalty.