Key conversion should have its own function. This is not sane to read.