Pull an existing id from header, only generate a new id when needed.

Fixes #2 as well. Used Guava Optional and Supplier. I went with the
supplier after reading about urandom performance. Cleaned up the tests a
little as well.