Use closure to preserve proper `key` value