Fix duplicate tokens and tail-end bug.
Remove buggy tail optimization. Move stdin cruft to cli.
Remove indentation level.
Refactor to be more functional.
Simplify to 2 arrays.
Teeny.