Fixes to AJAX including Sara's latest pull request