More work on ajax endpoint