Filled in insert_char function