Added guard to key extraction for edge cases without "|".