ajax new button working needs refractoring