I'd replace this with `if` statements here just because a pattern-match on every record is fairly expensive. But it's a minor thing.