Change Config API to encode and decode