added some logic for ajaxing the buttons