updated JS for the main view