Revamp serialization

* Combine encoder and decoder into one class
* Set Accept header