added same domain check and fixed issue with add value for Categorical variable
added some utility functions