Tidy up JavaScript for links and documentation