Use javascript form verification, and improve general error checking