refactor extractKeyValue to parse values encapsulated by quotes