Updated JavaScript and fixed header collapse