FIX Javascript so it doesn't refresh when not needed