Refactor to namespace and create a token object
Fixes in encoding/decoding
Update reference to firebase
Fix example in read me