Fixed bugs, added JS client-side form validation