use and-patterns to remove duplications in match
rename 'record' to 'rec'. rec can only create anonymous records now.