Switch to using an enum for KeyFormat.