Added idx_from_end option.
Refactored tests (they work again)
cleanup of dead code.
slightly better example output when -v == 5