Cache encoded payload

Caching the encoded payload

pulled from #29