Refactored ajax loader