Refactor form.js legislator code