Adjusting code to slightly different backend and ajax.