moving form into template file, adding ajax hooks