updating javascript to work with new controller data structure