Fix for trim to properly skip comparing against the same sequence. Use toTrimIndex == resultIndex && seqs1 == seqs2 instead of toTrimIndex == resultIndex. toTrimIndex == resultIndex was introduced to fix a bug where ruby is doing object comparison instead of equivalency comparisions. What I didn't realize was that result gets written to during the iteration, and we do want to compare if the object has changed. So, try checking both. I'm not 100 percent sure this is the right fix, but it makes a lot of tests pass. Committing for now, and I'll noodle on it tomorrow.