cancel posts properly and ajax loader and refactor form code