Caste calculation