changed the way of hiding the element