Move ajax callbacks into own methods for easier viewing