refactored ajax requests