clean up javascript, ready to take crack at submit functionality