Changed logic in hiding the divs