Calculating category classes