rewritten ajax replace and adjust_case