Tidy up javascript.