Add format_keys feature and fix method to strip down and rebuild the key