added alternative input for Categorical and flatten in util