Cleaning up code on form.html and main.js