replace_char functions
cleaned up