Clean up ajax for sorting