Refactor comments AJAX scripts