Encode/decode working everywhere now.
Add new api usage mechanism.
Add test