Refactor number-of-type into function
Two pairs?