Performance improvements

Tried switching from Lists to Sequences for the literal trail, but it
used more memory and was slower.  Might try storing the literal trail
backwards instead