refactor form.js