I agree, this should be possible to do with subsets and much nicer (we don't copy memory around and the code will be more readable).