I'd rather revert all the above code and just add something like:
```javascript
if (typeof options.beforeSend === 'function') {
    options.beforeSend(xhr, settings);
}
```
into our custom beforeSend function.