Issue #6: implement Gabriel's suggestion

I believe this solve #6.

On the other hand, I don't know about removing `encode` from the exported module (as it might be a be drastic for the lib user). I will let you decide to keep this change or not.