I think the attribute names `key` and `code` are a bit ambiguous. I'd suggest `name` as a replacement for the current `key`.