As mentioned in the other PR, in legacy we used bitmask for this stuff I think. Or is this how it was done in legacy as well in this case?