switch from wakeful to resting. also switch to using jquery promises.