Add character_ids function