documented a tricky case
replaced duplicate() with mark() & reset()
TODO comments