Added character class api and some validation for index