Ajax calls refactoring.