It's not clear to me what A and B are until I read the code. I assume that A is unrestricted and B is restricted.

May also help specifying that the ratio is the percentage of A in the total count.