Refactored AJAX upload system