Refactor ajax for comments