Improved JavaScript on form