decode refactored as function instead of S3 method. keyvaluem1 coerced to keyvalue internally for decode.