ajax file refactored