Implemented efficient way of getting races per categories.