Use extractors instead of ugly if else if