Changed Ajax success functions to promise structure.